mcvirt.virtual_machine.hard_drive package

Submodules

mcvirt.virtual_machine.hard_drive.base module

Provide base operations to manage all hard drives, used by VMs

class mcvirt.virtual_machine.hard_drive.base.Base(vm_object, disk_id=None, driver=None)[source]

Bases: mcvirt.rpc.pyro_object.PyroObject

Provides base operations to manage all hard drives, used by VMs

DEFAULT_DRIVER
MAXIMUM_DEVICES = 1
SNAPSHOT_SIZE = '500M'
SNAPSHOT_SUFFIX = '_snapshot'
activateDisk()[source]

Activates the storage volume

activateLogicalVolume(*args, **kwargs)
addToVirtualMachine(*args, **kwargs)
clone(destination_vm_object)[source]

Clone a VM, using snapshotting, attaching it to the new VM object

config_properties

Return the disk object config items

create()[source]

Creates a new disk image, attaches the disk to the VM and records the disk in the VM configuration

createBackupSnapshot()[source]

Creates a snapshot of the logical volume for backing up and locks the VM

createLogicalVolume(*args, **kwargs)
deactivateDisk()[source]

Deactivates the storage volume

delete()[source]

Delete the logical volume for the disk

deleteBackupSnapshot()[source]

Deletes the backup snapshot for the disk and unlocks the VM

disk_id

Return the disk ID of the current disk, generating a new one if there is not already one present

driver

Return the disk drive driver name

duplicate(destination_vm_object)[source]

Clone the hard drive and attach it to the new VM object

getDiskConfig()[source]

Returns the disk configuration for the hard drive

getDiskPath()[source]

Exposed method for _getDiskPath

getSize()[source]

Gets the size of the disk (in MB)

get_remote_object(node_name=None, remote_node=None, registered=True)[source]

Obtain an instance of the current hard drive object on a remote node

get_type()[source]

Return the type of storage for the hard drive

increaseSize(*args, **kwargs)
static isAvailable(pyro_object)[source]

Returns whether the storage type is available on the node

move(destination_node, source_node)[source]

Moves the storage to another node in the cluster

postOnlineMigration()[source]

Performs post tasks after a VM has performed an online migration

preMigrationChecks(destination_node)[source]

Determines if the disk is in a state to allow the attached VM to be migrated to another node

preOnlineMigration()[source]

Performs required tasks in order for the underlying VM to perform an online migration

removeFromVirtualMachine(*args, **kwargs)
removeLogicalVolume(*args, **kwargs)
zeroLogicalVolume(*args, **kwargs)

mcvirt.virtual_machine.hard_drive.drbd module

class mcvirt.virtual_machine.hard_drive.drbd.Drbd(drbd_minor=None, drbd_port=None, *args, **kwargs)[source]

Bases: mcvirt.virtual_machine.hard_drive.base.Base

Provides operations to manage Drbd-backed hard drives, used by VMs

CACHE_MODE = 'none'
CREATE_PROGRESS
Drbd_CONFIG_TEMPLATE = '/usr/lib/mcvirt/templates/drbd_resource.conf'
Drbd_META_SUFFIX = 'meta'
Drbd_RAW_SUFFIX = 'raw'
Drbd_STATES = {'CONNECTION': {'CONNECTED': [<Mock id='140218819339792'>, <Mock id='140218831801808'>, <Mock id='140218822557008'>, <Mock id='140218822705040'>, <Mock id='140218821472720'>, <Mock id='140218816840976'>, <Mock id='140218816939152'>, <Mock id='140218814241424'>, <Mock id='140218817195088'>, <Mock id='140218823155536'>], 'WARNING': [<Mock id='140218823318096'>, <Mock id='140218823075088'>, <Mock id='140218823079888'>, <Mock id='140218823109264'>, <Mock id='140218823085392'>, <Mock id='140218819866704'>, <Mock id='140218819859216'>], 'OK': [<Mock id='140218828977104'>, <Mock id='140218819906320'>, <Mock id='140218828842256'>, <Mock id='140218825534864'>, <Mock id='140218825923408'>, <Mock id='140218820569744'>, <Mock id='140218829137360'>, <Mock id='140218820744976'>, <Mock id='140218819806800'>]}, 'DISK': {'WARNING': [<Mock id='140218819873616'>, <Mock id='140218819866128'>], 'OK': [<Mock id='140218819881104'>]}, 'ROLE': {'WARNING': [], 'OK': [<Mock id='140218819888592'>]}}
INITIAL_MINOR = 1
INITIAL_PORT = 7789
activateDisk()[source]

Ensure that the disk is ready to be used by a VM on the local node

config_properties

Return the disk object config items

create(size)[source]

Creates a new hard drive, attaches the disk to the VM and records the disk in the VM configuration

deactivateDisk()[source]

Marks Drbd volume as secondary

drbdConnect(*args, **kwargs)
drbdDisconnect(*args, **kwargs)
drbdDown(*args, **kwargs)
drbdGetConnectionState()[source]

Provide an exposed method for _drbdGetConnectionState

drbdGetDiskState()[source]

Provide an exposed method for drbdGetDiskState

drbdSetPrimary(*args, **kwargs)
drbdSetSecondary(*args, **kwargs)
drbdUp(*args, **kwargs)
drbd_minor

Returns the Drbd port assigned to the hard drive

drbd_port

Returns the Drbd port assigned to the hard drive

generateDrbdConfig(*args, **kwargs)
getSize()[source]

Gets the size of the disk (in MB)

initialiseMetaData(*args, **kwargs)
static isAvailable(pyro_object)[source]

Determine if Drbd is available on the node

move(destination_node, source_node)[source]

Replaces a remote node for the Drbd volume with a new node and syncs the data

postOnlineMigration()[source]

Performs post tasks after a VM has performed an online migration

preMigrationChecks()[source]

Ensures that the Drbd state of the disk is in a state suitable for migration

preOnlineMigration(destination_node)[source]

Performs required tasks in order for the underlying VM to perform an online migration

removeDrbdConfig(*args, **kwargs)
resource_name

Returns the Drbd resource name for the hard drive object

setSyncState(*args, **kwargs)
setTwoPrimariesConfig(*args, **kwargs)
verify()[source]

Performs a verification of a Drbd hard drive

mcvirt.virtual_machine.hard_drive.factory module

class mcvirt.virtual_machine.hard_drive.factory.Factory[source]

Bases: mcvirt.rpc.pyro_object.PyroObject

Provides a factory for creating hard drive/hard drive config objects

DEFAULT_STORAGE_TYPE = 'Local'
HARD_DRIVE_CLASS

alias of Base

OBJECT_TYPE = 'hard disk'
STORAGE_TYPES = [<class 'mcvirt.virtual_machine.hard_drive.local.Local'>, <class 'mcvirt.virtual_machine.hard_drive.drbd.Drbd'>]
create(*args, **kwargs)
getClass(storage_type)[source]

Obtains the hard drive class for a given storage type

getDrbdObjectByResourceName(resource_name)[source]

Obtains a hard drive object for a Drbd drive, based on the resource name

getObject(vm_object, disk_id, **config)[source]

Returns the storage object for a given disk

getStorageTypes()[source]

Returns the available storage types that MCVirt provides

mcvirt.virtual_machine.hard_drive.local module

class mcvirt.virtual_machine.hard_drive.local.Local(*args, **kwargs)[source]

Bases: mcvirt.virtual_machine.hard_drive.base.Base

Provides operations to manage local hard drives, used by VMs

CACHE_MODE = 'directsync'
MAXIMUM_DEVICES = 4
activateDisk()[source]

Starts the disk logical volume

clone(destination_vm_object)[source]

Clone a VM, using snapshotting, attaching it to the new VM object

create(size)[source]

Creates a new disk image, attaches the disk to the VM and records the disk in the VM configuration

deactivateDisk()[source]

Deactivates the disk loglcal volume

getSize()[source]

Gets the size of the disk (in MB)

increaseSize(*args, **kwargs)
static isAvailable(pyro_object)[source]

Determine if local storage is available on the node

preMigrationChecks()[source]

Perform pre-migration checks

Module contents