oslo_vmware.objects package¶
Submodules¶
oslo_vmware.objects.datacenter module¶
- class oslo_vmware.objects.datacenter.Datacenter(ref, name)¶
Bases:
object
oslo_vmware.objects.datastore module¶
- class oslo_vmware.objects.datastore.Datastore(ref, name, capacity=None, freespace=None, uncommitted=None, type=None, datacenter=None)¶
Bases:
object
- build_path(*paths)¶
Constructs and returns a DatastorePath.
- Parameters
paths – list of path components, for constructing a path relative to the root directory of the datastore
- Returns
a DatastorePath object
- build_url(scheme, server, rel_path, datacenter_name=None)¶
Constructs and returns a DatastoreURL.
- Parameters
scheme – scheme of the URL (http, https).
server – hostname or ip
rel_path – relative path of the file on the datastore
datacenter_name – (optional) datacenter name
- Returns
a DatastoreURL object
- static choose_host(hosts)¶
- get_connected_hosts(session)¶
Get a list of usable (accessible, mounted, read-writable) hosts where the datastore is mounted.
- Param
session: session
- Returns
list of HostSystem managed object references
- get_summary(session)¶
Get datastore summary.
- Parameters
datastore – Reference to the datastore
- Returns
‘summary’ property of the datastore
- static is_datastore_mount_usable(mount_info)¶
Check if a datastore is usable as per the given mount info.
The datastore is considered to be usable for a host only if it is writable, mounted and accessible.
- Parameters
mount_info – HostMountInfo data object
- Returns
True if datastore is usable
- class oslo_vmware.objects.datastore.DatastorePath(datastore_name, *paths)¶
Bases:
object
Class for representing a directory or file path in a vSphere datatore.
This provides various helper methods to access components and useful variants of the datastore path.
Example usage:
DatastorePath(“datastore1”, “_base/foo”, “foo.vmdk”) creates an object that describes the “[datastore1] _base/foo/foo.vmdk” datastore file path to a virtual disk.
Note:
Datastore path representations always uses forward slash as separator (hence the use of the posixpath module).
Datastore names are enclosed in square brackets.
Path part of datastore path is relative to the root directory of the datastore, and is always separated from the [ds_name] part with a single space.
- property basename¶
- property datastore¶
- property dirname¶
- join(*paths)¶
Join one or more path components intelligently into a datastore path.
If any component is an absolute path, all previous components are thrown away, and joining continues. The return value is the concatenation of the paths with exactly one slash (‘/’) inserted between components, unless p is empty.
- Returns
A datastore path
- property parent¶
- classmethod parse(datastore_path)¶
Constructs a DatastorePath object given a datastore path string.
- property rel_path¶
- class oslo_vmware.objects.datastore.DatastoreURL(scheme, server, path, datacenter_path, datastore_name)¶
Bases:
object
Class for representing a URL to HTTP access a file in a datastore.
This provides various helper methods to access components and useful variants of the datastore URL.
- connect(method, content_length, cookie)¶
- property datacenter_path¶
- property datastore_name¶
- get_transfer_ticket(session, method)¶
- property path¶
- classmethod urlparse(url)¶
- oslo_vmware.objects.datastore.get_datastore_by_ref(session, ds_ref)¶
Returns a datastore object for a given reference.
- Parameters
session – a vmware api session object
ds_ref – managed object reference of a datastore
- Return type
a datastore object
- oslo_vmware.objects.datastore.get_dsc_ref_and_name(session, dsc_val)¶
Return reference and name of the specified datastore cluster.
- Parameters
ds_val – datastore cluster name or datastore cluster moid
- Returns
tuple of dastastore cluster moref and datastore cluster name
- oslo_vmware.objects.datastore.get_recommended_datastore(session, sp_spec)¶
- oslo_vmware.objects.datastore.get_recommended_datastore_clone(session, dsc_ref, clone_spec, vm_ref, folder, name, resource_pool=None, host_ref=None)¶
Returns a key which identifies the most recommended datastore from the specified datastore cluster where the specified VM can be cloned to.
- oslo_vmware.objects.datastore.get_recommended_datastore_create(session, dsc_ref, config_spec, resource_pool, folder, host_ref=None)¶
Returns SDRS recommendation key for creating a VM.
- oslo_vmware.objects.datastore.sdrs_enabled(session, dsc_ref)¶
Check if Storage DRS is enabled for the given datastore cluster.
- Parameters
session – VMwareAPISession object
dsc_ref – datastore cluster moref