The oslo_vmware.rw_handles
Module¶
Classes defining read and write handles for image transfer.
This module defines various classes for reading and writing files including VMDK files in VMware servers. It also contains a class to read images from glance server.
-
class
oslo_vmware.rw_handles.
FileHandle
(file_handle)¶ Bases:
object
Base class for VMware server file (including VMDK) access over HTTP.
This class wraps a backing file handle and provides utility methods for various sub-classes.
-
close
()¶ Close the file handle.
-
get_size
()¶ Get size of the file to be read.
Raises: NotImplementedError
-
read
(chunk_size)¶ Read a chunk of data.
Parameters: chunk_size – read chunk size Raises: NotImplementedError
-
write
(data)¶ Write data to the file.
Parameters: data – data to be written Raises: NotImplementedError
-
-
class
oslo_vmware.rw_handles.
FileWriteHandle
(host, port, data_center_name, datastore_name, cookies, file_path, file_size, scheme='https', cacerts=False, thumbprint=None)¶ Bases:
oslo_vmware.rw_handles.FileHandle
Write handle for a file in VMware server.
-
close
()¶ Get the response and close the connection.
-
write
(data)¶ Write data to the file.
Parameters: data – data to be written Raises: VimConnectionException, VimException
-
-
class
oslo_vmware.rw_handles.
ImageReadHandle
(glance_read_iter)¶ Bases:
object
Read handle for glance images.
-
close
()¶ Close the read handle.
This is a NOP.
-
get_next
()¶ Get the next item from the image iterator.
-
read
(chunk_size)¶ Read an item from the image data iterator.
The input chunk size is ignored since the client ImageBodyIterator uses its own chunk size.
-
-
class
oslo_vmware.rw_handles.
VmdkHandle
(session, lease, url, file_handle)¶ Bases:
oslo_vmware.rw_handles.FileHandle
VMDK handle based on HttpNfcLease.
-
update_progress
()¶ Updates progress to lease.
This call back to the lease is essential to keep the lease alive across long running write/read operations.
Raises: VimException, VimFaultException, VimAttributeException, VimSessionOverLoadException, VimConnectionException
-
-
class
oslo_vmware.rw_handles.
VmdkReadHandle
(session, host, port, vm_ref, vmdk_path, vmdk_size)¶ Bases:
oslo_vmware.rw_handles.VmdkHandle
VMDK read handle based on HttpNfcLease.
-
close
()¶ Releases the lease and close the connection.
Raises: VimException, VimFaultException, VimAttributeException, VimSessionOverLoadException, VimConnectionException
-
read
(chunk_size)¶ Read a chunk of data from the VMDK file.
Parameters: chunk_size – size of read chunk Returns: the data Raises: VimException
-
-
class
oslo_vmware.rw_handles.
VmdkWriteHandle
(session, host, port, rp_ref, vm_folder_ref, import_spec, vmdk_size, http_method='PUT')¶ Bases:
oslo_vmware.rw_handles.VmdkHandle
VMDK write handle based on HttpNfcLease.
This class creates a vApp in the specified resource pool and uploads the virtual disk contents.
-
close
()¶ Releases the lease and close the connection.
Raises: VimAttributeException, VimSessionOverLoadException, VimConnectionException
-
get_imported_vm
()¶ “Get managed object reference of the VM created for import.
-
write
(data)¶ Write data to the file.
Parameters: data – data to be written Raises: VimConnectionException, VimException
-