The oslo_vmware.image_transfer Module

Functions and classes for image transfer between ESX/VC & image service.

oslo_vmware.image_transfer.copy_stream_optimized_disk(context, timeout_secs, write_handle, **kwargs)

Copy virtual disk from VMware server to the given write handle.

Parameters:
  • context – context
  • timeout_secs – time in seconds to wait for the copy to complete
  • write_handle – copy destination
  • kwargs – keyword arguments to configure the source VMDK read handle
Raises:

VimException, VimFaultException, VimAttributeException, VimSessionOverLoadException, VimConnectionException, ImageTransferException, ValueError

oslo_vmware.image_transfer.download_file(read_handle, host, port, dc_name, ds_name, cookies, upload_file_path, file_size, cacerts, timeout_secs)

Download file to VMware server.

Parameters:
  • read_handle – file read handle
  • host – VMware server host name or IP address
  • port – VMware server port number
  • dc_name – name of the datacenter which contains the destination datastore
  • ds_name – name of the destination datastore
  • cookies – cookies to build the cookie header while establishing http connection with VMware server
  • upload_file_path – destination datastore file path
  • file_size – source file size
  • cacerts – CA bundle file to use for SSL verification
  • timeout_secs – timeout in seconds to wait for the download to complete
oslo_vmware.image_transfer.download_flat_image(context, timeout_secs, image_service, image_id, **kwargs)

Download flat image from the image service to VMware server.

Parameters:
  • context – image service write context
  • timeout_secs – time in seconds to wait for the download to complete
  • image_service – image service handle
  • image_id – ID of the image to be downloaded
  • kwargs – keyword arguments to configure the destination file write handle
Raises:

VimConnectionException, ImageTransferException, ValueError

oslo_vmware.image_transfer.download_image(image, image_meta, session, datastore, rel_path, bypass=True, timeout_secs=7200)

Transfer an image to a datastore.

Parameters:
  • image – file-like iterator
  • image_meta – image metadata
  • session – VMwareAPISession object
  • datastore – Datastore object
  • rel_path – path where the file will be stored in the datastore
  • bypass – if set to True, bypass vCenter to download the image
  • timeout_secs – time in seconds to wait for the xfer to complete
oslo_vmware.image_transfer.download_stream_optimized_data(context, timeout_secs, read_handle, **kwargs)

Download stream optimized data to VMware server.

Parameters:
  • context – image service write context
  • timeout_secs – time in seconds to wait for the download to complete
  • read_handle – handle from which to read the image data
  • kwargs – keyword arguments to configure the destination VMDK write handle
Returns:

managed object reference of the VM created for import to VMware server

Raises:

VimException, VimFaultException, VimAttributeException, VimSessionOverLoadException, VimConnectionException, ImageTransferException, ValueError

oslo_vmware.image_transfer.download_stream_optimized_image(context, timeout_secs, image_service, image_id, **kwargs)

Download stream optimized image from image service to VMware server.

Parameters:
  • context – image service write context
  • timeout_secs – time in seconds to wait for the download to complete
  • image_service – image service handle
  • image_id – ID of the image to be downloaded
  • kwargs – keyword arguments to configure the destination VMDK write handle
Returns:

managed object reference of the VM created for import to VMware server

Raises:

VimException, VimFaultException, VimAttributeException, VimSessionOverLoadException, VimConnectionException, ImageTransferException, ValueError

oslo_vmware.image_transfer.upload_image(context, timeout_secs, image_service, image_id, owner_id, **kwargs)

Upload the VM’s disk file to image service.

Parameters:
  • context – image service write context
  • timeout_secs – time in seconds to wait for the upload to complete
  • image_service – image service handle
  • image_id – upload destination image ID
  • kwargs – keyword arguments to configure the source VMDK read handle
Raises:

VimException, VimFaultException, VimAttributeException, VimSessionOverLoadException, VimConnectionException, ImageTransferException, ValueError