cinder.volume.drivers.vmware.volumeops
Modulecinder.volume.drivers.vmware.volumeops
Module¶Implements operations on volumes residing on VMware datastores.
ControllerType
¶Bases: object
Encapsulate various controller types.
BUS_LOGIC
= ‘VirtualBusLogicController’¶CONTROLLER_TYPE_DICT
= {‘paraVirtual’: ‘ParaVirtualSCSIController’, ‘ide’: ‘VirtualIDEController’, ‘busLogic’: ‘VirtualBusLogicController’, ‘lsiLogicsas’: ‘VirtualLsiLogicSASController’, ‘lsiLogic’: ‘VirtualLsiLogicController’}¶IDE
= ‘VirtualIDEController’¶LSI_LOGIC
= ‘VirtualLsiLogicController’¶LSI_LOGIC_SAS
= ‘VirtualLsiLogicSASController’¶PARA_VIRTUAL
= ‘ParaVirtualSCSIController’¶get_controller_type
(adapter_type)¶Get the disk controller type based on the given adapter type.
Parameters: | adapter_type – disk adapter type |
---|---|
Returns: | controller type corresponding to the given adapter type |
Raises: | InvalidAdapterTypeException |
is_scsi_controller
(controller_type)¶Check if the given controller is a SCSI controller.
Parameters: | controller_type – controller type |
---|---|
Returns: | True if the controller is a SCSI controller |
FlatExtentVirtualDiskPath
(ds_name, folder_path, disk_name)¶Bases: cinder.volume.drivers.vmware.volumeops.VirtualDiskPath
Paths of files in a non-monolithic disk with a single flat extent.
get_flat_extent_ds_file_path
()¶Get datastore file path of the flat extent.
get_flat_extent_file_path
()¶Get absolute file path of the flat extent.
MonolithicSparseVirtualDiskPath
(ds_name, folder_path, disk_name)¶Bases: cinder.volume.drivers.vmware.volumeops.VirtualDiskPath
Paths of file comprising a monolithic sparse disk.
VMwareVolumeOps
(session, max_objects)¶Bases: object
Manages volume operations.
attach_disk_to_backing
(backing, size_in_kb, disk_type, adapter_type, profile_id, vmdk_ds_file_path)¶Attach an existing virtual disk to the backing VM.
Parameters: |
|
---|
build_backing_ref_cache
(name_regex=None)¶cancel_retrieval
(retrieve_result)¶Cancel retrieval of results if necessary.
Parameters: | retrieve_result – Result from RetrievePropertiesEx |
---|
change_backing_profile
(backing, profile_id)¶Change storage profile of the backing VM.
The current profile is removed if the new profile is None.
clone_backing
(name, backing, snapshot, clone_type, datastore, disk_type=None, host=None, resource_pool=None, extra_config=None, folder=None, disks_to_clone=None)¶Clone backing.
If the clone_type is ‘full’, then a full clone of the source volume backing will be created. Else, if it is ‘linked’, then a linked clone of the source volume backing will be created.
Parameters: |
|
---|
continue_retrieval
(retrieve_result)¶Continue retrieval of results if necessary.
Parameters: | retrieve_result – Result from RetrievePropertiesEx |
---|
copy_datastore_file
(vsphere_url, dest_dc_ref, dest_ds_file_path)¶Copy file to datastore location.
Parameters: |
|
---|
copy_vmdk_file
(src_dc_ref, src_vmdk_file_path, dest_vmdk_file_path, dest_dc_ref=None)¶Copy contents of the src vmdk file to dest vmdk file.
Parameters: |
|
---|
create_backing
(name, size_kb, disk_type, folder, resource_pool, host, ds_name, profileId=None, adapter_type=’lsiLogic’, extra_config=None)¶Create backing for the volume.
Creates a VM with one VMDK based on the given inputs.
Parameters: |
|
---|---|
Returns: | Reference to the created backing entity |
create_backing_disk_less
(name, folder, resource_pool, host, ds_name, profileId=None, extra_config=None)¶Create disk-less volume backing.
This type of backing is useful for creating volume from image. The downloaded image from the image service can be copied to a virtual disk of desired provisioning type and added to the backing VM.
Parameters: |
|
---|---|
Returns: | Reference to the created backing entity |
create_datastore_folder
(ds_name, folder_path, datacenter)¶Creates a datastore folder.
This method returns silently if the folder already exists.
Parameters: |
|
---|
create_flat_extent_virtual_disk_descriptor
(dc_ref, path, size_in_kb, adapter_type, disk_type)¶Create descriptor for a single flat extent virtual disk.
To create the descriptor, we create a virtual disk and delete its flat extent.
Parameters: |
|
---|
create_folder
(parent_folder, child_folder_name)¶Creates child folder under the given parent folder.
Parameters: |
|
---|---|
Returns: | Reference to the child folder |
create_snapshot
(backing, name, description, quiesce=False)¶Create snapshot of the backing with given name and description.
Parameters: |
|
---|---|
Returns: | Created snapshot entity reference |
create_virtual_disk
(dc_ref, vmdk_ds_file_path, size_in_kb, adapter_type=’busLogic’, disk_type=’preallocated’)¶Create virtual disk with the given settings.
Parameters: |
|
---|
create_vm_inventory_folder
(datacenter, path_comp)¶Create and return a VM inventory folder.
This method caches references to inventory folders returned.
Parameters: |
|
---|
delete_backing
(backing)¶Delete the backing.
Parameters: | backing – Managed object reference to the backing |
---|
delete_file
(file_path, datacenter=None)¶Delete file or folder on the datastore.
Parameters: | file_path – Datastore path of the file or folder |
---|
delete_snapshot
(backing, name)¶Delete a given snapshot from volume backing.
Parameters: |
|
---|
delete_vmdk_file
(vmdk_file_path, dc_ref)¶Delete given vmdk files.
Parameters: |
|
---|
detach_disk_from_backing
(backing, disk_device)¶Detach the given disk from backing.
extend_virtual_disk
(requested_size_in_gb, path, dc_ref, eager_zero=False)¶Extend the virtual disk to the requested size.
Parameters: |
|
---|
get_backing
(name, backing_uuid)¶Get the backing based on name or uuid.
Parameters: |
|
---|---|
Returns: | Managed object reference to the backing |
get_backing_by_uuid
(uuid)¶get_cluster_hosts
(cluster)¶Get hosts in the given cluster.
Parameters: | cluster – cluster reference |
---|---|
Returns: | references to hosts in the cluster |
get_cluster_refs
(names)¶Get references to given clusters.
Parameters: | names – list of cluster names |
---|---|
Returns: | Dictionary of cluster names to references |
get_connected_hosts
(datastore)¶Get all the hosts to which the datastore is connected and usable.
The datastore is considered to be usable for a host only if it is writable, mounted and accessible.
Parameters: | datastore – Reference to the datastore entity |
---|---|
Returns: | List of managed object references of all connected hosts |
get_create_spec
(name, size_kb, disk_type, ds_name, profile_id=None, adapter_type=’lsiLogic’, extra_config=None)¶Return spec for creating backing with a single disk.
Parameters: |
|
---|---|
Returns: | spec for creation |
get_datastore
(backing)¶Get datastore where the backing resides.
Parameters: | backing – Reference to the backing |
---|---|
Returns: | Datastore reference to which the backing belongs |
get_dc
(child)¶Get parent datacenter up the hierarchy via ‘parent’ property.
Parameters: | child – Reference of the child entity |
---|---|
Returns: | Parent Datacenter of the param child entity |
get_disk_device
(vm, vmdk_path)¶Get the disk device of the VM which corresponds to the given path.
Parameters: |
|
---|---|
Returns: | Matching disk device |
get_disk_size
(backing)¶Get disk size of the backing.
Parameters: | backing – backing VM reference |
---|---|
Returns: | disk size in bytes |
get_entity_by_inventory_path
(path)¶Returns the managed object identified by the given inventory path.
Parameters: | path – Inventory path |
---|---|
Returns: | Reference to the managed object |
get_entity_name
(entity)¶Get name of the managed entity.
Parameters: | entity – Reference to the entity |
---|---|
Returns: | Name of the managed entity |
get_host
(instance)¶Get host under which instance is present.
Parameters: | instance – Managed object reference of the instance VM |
---|---|
Returns: | Host managing the instance VM |
get_hosts
()¶Get all host from the inventory.
Returns: | All the hosts from the inventory |
---|
get_inventory_path
(entity)¶get_path_name
(backing)¶Get path name of the backing.
Parameters: | backing – Reference to the backing entity |
---|---|
Returns: | Path name of the backing |
get_snapshot
(backing, name)¶Get snapshot of the backing with given name.
Parameters: |
|
---|---|
Returns: | Snapshot entity of the backing with given name |
get_summary
(datastore)¶Get datastore summary.
Parameters: | datastore – Reference to the datastore |
---|---|
Returns: | ‘summary’ property of the datastore |
get_vmdk_path
(backing)¶Get the vmdk file name of the backing.
The vmdk file path of the backing returned is of the form: “[datastore1] my_folder/my_vm.vmdk”
Parameters: | backing – Reference to the backing |
---|---|
Returns: | VMDK file path of the backing |
get_vmfolder
(datacenter)¶Get the vmFolder.
Parameters: | datacenter – Reference to the datacenter entity |
---|---|
Returns: | vmFolder property of the datacenter |
is_datastore_accessible
(datastore, host)¶Check if the datastore is accessible to the given host.
Parameters: | datastore – datastore reference |
---|---|
Returns: | True if the datastore is accessible |
mark_backing_as_template
(backing)¶move_backing_to_folder
(backing, folder)¶Move the volume backing to the folder.
Parameters: |
|
---|
move_vmdk_file
(src_dc_ref, src_vmdk_file_path, dest_vmdk_file_path, dest_dc_ref=None)¶Move the given vmdk file to another datastore location.
Parameters: |
|
---|
relocate_backing
(backing, datastore, resource_pool, host, disk_type=None)¶Relocates backing to the input datastore and resource pool.
The implementation uses moveAllDiskBackingsAndAllowSharing disk move type.
Parameters: |
|
---|
rename_backing
(backing, new_name)¶Rename backing VM.
Parameters: |
|
---|
snapshot_exists
(backing)¶Check if the given backing contains snapshots.
update_backing_disk_uuid
(backing, disk_uuid)¶Update backing VM’s disk UUID.
Parameters: |
|
---|
update_backing_extra_config
(backing, extra_config)¶update_backing_uuid
(backing, uuid)¶VirtualDiskAdapterType
¶Bases: object
Supported virtual disk adapter types.
BUS_LOGIC
= ‘busLogic’¶IDE
= ‘ide’¶LSI_LOGIC
= ‘lsiLogic’¶LSI_LOGIC_SAS
= ‘lsiLogicsas’¶PARA_VIRTUAL
= ‘paraVirtual’¶get_adapter_type
(extra_spec_adapter)¶Get the adapter type to be used in VirtualDiskSpec.
Parameters: | extra_spec_adapter – adapter type in the extra_spec |
---|---|
Returns: | adapter type to be used in VirtualDiskSpec |
is_valid
(adapter_type)¶Check if the given adapter type is valid.
Parameters: | adapter_type – adapter type to check |
---|---|
Returns: | True if valid |
validate
(extra_spec_adapter_type)¶Validate the given adapter type in extra_spec.
This method throws an instance of InvalidAdapterTypeException if the given adapter type is invalid.
Parameters: | extra_spec_adapter_type – adapter type in extra_spec |
---|---|
Raises: | InvalidAdapterTypeException |
VirtualDiskPath
(ds_name, folder_path, disk_name)¶Bases: object
Class representing paths of files comprising a virtual disk.
get_datastore_file_path
(ds_name, file_path)¶Get datastore path corresponding to the given file path.
Parameters: |
|
---|---|
Returns: | datastore file path |
get_descriptor_ds_file_path
()¶Get datastore file path of the virtual disk descriptor.
get_descriptor_file_path
()¶Get absolute file path of the virtual disk descriptor.
VirtualDiskType
¶Bases: object
Supported virtual disk types.
EAGER_ZEROED_THICK
= ‘eagerZeroedThick’¶EXTRA_SPEC_DISK_TYPE_DICT
= {‘thick’: ‘preallocated’, ‘eagerZeroedThick’: ‘eagerZeroedThick’, ‘thin’: ‘thin’}¶PREALLOCATED
= ‘preallocated’¶THIN
= ‘thin’¶get_virtual_disk_type
(extra_spec_disk_type)¶Return disk type corresponding to the extra_spec disk type.
Parameters: | extra_spec_disk_type – disk type in extra_spec |
---|---|
Returns: | virtual disk type |
Raises: | InvalidDiskTypeException |
is_valid
(extra_spec_disk_type)¶Check if the given disk type in extra_spec is valid.
Parameters: | extra_spec_disk_type – disk type in extra_spec |
---|---|
Returns: | True if valid |
validate
(extra_spec_disk_type)¶Validate the given disk type in extra_spec.
This method throws an instance of InvalidDiskTypeException if the given disk type is invalid.
Parameters: | extra_spec_disk_type – disk type in extra_spec |
---|---|
Raises: | InvalidDiskTypeException |
split_datastore_path
(datastore_path)¶Split the datastore path to components.
return the datastore name, relative folder path and the file name
E.g. datastore_path = [datastore1] my_volume/my_volume.vmdk, returns (datastore1, my_volume/, my_volume.vmdk)
Parameters: | datastore_path – Datastore path of a file |
---|---|
Returns: | Parsed datastore name, relative folder path and file name |
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.