cinder.volume.drivers.vmware.vmdk
Module¶Volume driver for VMware vCenter managed datastores.
The volumes created by this driver are backed by VMDK (Virtual Machine Disk) files stored in datastores. For ease of managing the VMDKs, the driver creates a virtual machine for each of the volumes. This virtual machine is never powered on and is often referred as the shadow VM.
ImageDiskType
¶Bases: object
Supported disk types in images.
PREALLOCATED
= 'preallocated'¶SPARSE
= 'sparse'¶STREAM_OPTIMIZED
= 'streamOptimized'¶THIN
= 'thin'¶is_valid
(extra_spec_disk_type)¶Check if the given disk type in extra_spec is valid.
Parameters: | extra_spec_disk_type – disk type to check |
---|---|
Returns: | True if valid |
validate
(extra_spec_disk_type)¶Validate the given disk type in extra_spec.
This method throws ImageUnacceptable if the disk type is not a supported one.
Parameters: | extra_spec_disk_type – disk type |
---|---|
Raises: | ImageUnacceptable |
VMwareVcVmdkDriver
(*args, **kwargs)¶Bases: cinder.volume.driver.VolumeDriver
Manage volumes on VMware vCenter server.
CI_WIKI_NAME
= 'VMware_CI'¶MIN_SUPPORTED_VC_VERSION
= '5.5'¶NEXT_MIN_SUPPORTED_VC_VERSION
= '5.5'¶PBM_ENABLED_VC_VERSION
= '5.5'¶VERSION
= '3.2.0'¶accept_transfer
(context, volume, new_user, new_project)¶Accept the transfer of a volume for a new user/project.
check_for_setup_error
()¶copy_image_to_volume
(context, volume, image_service, image_id)¶Creates volume from image.
This method only supports Glance image of VMDK disk format. Uses flat vmdk file copy for “sparse” and “preallocated” disk types Uses HttpNfc import API for “streamOptimized” disk types. This API creates a backing VM that wraps the VMDK in the vCenter inventory.
Parameters: |
|
---|
copy_volume_to_image
(context, volume, image_service, image_meta)¶Creates glance image from volume.
Upload of only available volume is supported. The uploaded glance image has a vmdk disk type of “streamOptimized” that can only be downloaded using the HttpNfc API. Steps followed are: 1. Get the name of the vmdk file which the volume points to right now. Can be a chain of snapshots, so we need to know the last in the chain. 2. Use Nfc APIs to upload the contents of the vmdk file to glance.
create_cloned_volume
(volume, src_vref)¶Creates volume clone.
Parameters: |
|
---|
create_export
(context, volume, connector)¶Exports the volume.
Can optionally return a Dictionary of changes to the volume object to be persisted.
create_snapshot
(snapshot)¶Creates a snapshot.
Parameters: | snapshot – Snapshot object |
---|
create_volume
(volume)¶Creates a volume.
We do not create any backing. We do it only the first time it is being attached to a virtual machine.
Parameters: | volume – Volume object |
---|
create_volume_from_snapshot
(volume, snapshot)¶Creates a volume from a snapshot.
Parameters: |
|
---|
delete_snapshot
(snapshot)¶Delete snapshot.
Parameters: | snapshot – Snapshot object |
---|
delete_volume
(volume)¶Deletes volume backing.
Parameters: | volume – Volume object |
---|
do_setup
(context)¶Any initialization the volume driver does while starting.
ds_sel
¶ensure_export
(context, volume)¶Synchronously recreates an export for a volume.
extend_volume
(volume, new_size)¶Extend volume to new size.
Extends the volume backing’s virtual disk to new size. First, try to extend in place on the same datastore. If that fails due to insufficient disk space, then try to relocate the volume to a different datastore that can accommodate the backing with new size and retry extend.
Parameters: |
|
---|
get_volume_stats
(refresh=False)¶Obtain status of the volume service.
Parameters: | refresh – Whether to get refreshed information |
---|
initialize_connection
(volume, connector)¶Allow connection to connector and return connection info.
The implementation returns the following information:
{
'driver_volume_type': 'vmdk',
'data': {'volume': $VOLUME_MOREF_VALUE,
'volume_id': $VOLUME_ID
}
}
Parameters: |
|
---|---|
Returns: | Return connection information |
manage_existing
(volume, existing_ref)¶Brings an existing virtual disk under Cinder management.
Detaches the virtual disk identified by existing_ref and attaches it to a volume backing.
Parameters: |
|
---|
manage_existing_get_size
(volume, existing_ref)¶Return size of the volume to be managed by manage_existing.
When calculating the size, round up to the next GB.
Parameters: |
|
---|
remove_export
(context, volume)¶Removes an export for a volume.
retype
(ctxt, volume, new_type, diff, host)¶Convert the volume to be of the new type.
The retype is performed only if the volume is not in use. Retype is NOP if the backing doesn’t exist. If disk type conversion is needed, the volume is cloned. If disk type conversion is needed and the volume contains snapshots, the backing is relocated instead of cloning. The backing is also relocated if the current datastore is not compliant with the new storage profile (if any). Finally, the storage profile of the backing VM is updated.
Parameters: |
|
---|---|
Returns: | True if the retype occurred; False otherwise. |
revert_to_snapshot
(context, volume, snapshot)¶Revert volume to snapshot.
Note: the revert process should not change the volume’s current size, that means if the driver shrank the volume during the process, it should extend the volume internally.
session
¶terminate_connection
(volume, connector, force=False, **kwargs)¶Disallow connection from connector
Parameters: |
|
---|
unmanage
(volume)¶Removes the specified volume from Cinder management.
Does not delete the underlying backend storage object.
For most drivers, this will not need to do anything. However, some drivers might use this call as an opportunity to clean up any Cinder-specific configuration that they have associated with the backend storage object.
Parameters: | volume – Cinder volume to unmanage |
---|
volumeops
¶Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.