diskbackend: Document the various classes

This commit is contained in:
Cole Robinson 2014-12-08 15:02:27 -05:00
parent cff08223ba
commit db0942bd09

View File

@ -151,7 +151,14 @@ def manage_path(conn, path):
return vol, pool return vol, pool
##############################################
# Classes for tracking storage media details #
##############################################
class _StorageBase(object): class _StorageBase(object):
"""
Storage base class, defining the API used by VirtualDisk
"""
def __init__(self, conn): def __init__(self, conn):
self._conn = conn self._conn = conn
@ -166,6 +173,9 @@ class _StorageBase(object):
class _StorageCreator(_StorageBase): class _StorageCreator(_StorageBase):
"""
Base object for classes that will actually create storage on disk
"""
def __init__(self, conn): def __init__(self, conn):
_StorageBase.__init__(self, conn) _StorageBase.__init__(self, conn)
@ -246,6 +256,12 @@ class _StorageCreator(_StorageBase):
class CloneStorageCreator(_StorageCreator): class CloneStorageCreator(_StorageCreator):
"""
Handles manually copying local files for Cloner
Many clone scenarios will use libvirt storage APIs, which will use
the ManagedStorageCreator
"""
def __init__(self, conn, output_path, input_path, size, sparse): def __init__(self, conn, output_path, input_path, size, sparse):
_StorageCreator.__init__(self, conn) _StorageCreator.__init__(self, conn)
@ -356,6 +372,11 @@ class CloneStorageCreator(_StorageCreator):
class ManagedStorageCreator(_StorageCreator): class ManagedStorageCreator(_StorageCreator):
"""
Handles storage creation via libvirt APIs. All the actual creation
logic lives in StorageVolume, this is mostly about pulling out bits
from that class and mapping them to VirtualDisk elements
"""
def __init__(self, conn, vol_install): def __init__(self, conn, vol_install):
_StorageCreator.__init__(self, conn) _StorageCreator.__init__(self, conn)