diff options
author | Vui Lam <vui@vmware.com> | 2014-05-08 17:09:25 -0700 |
---|---|---|
committer | Radoslav Gerganov <rgerganov@vmware.com> | 2014-12-03 11:06:52 +0200 |
commit | 530af8301030d1a4498a72690278db02c71558a1 (patch) | |
tree | 6b7aefe6d0f3478726b148ef8059c5c733496c5b /nova/virt/vmwareapi/ds_util.py | |
parent | 1e059f254bc31d4b136d18dbf694131a5f6a8857 (diff) | |
download | nova-530af8301030d1a4498a72690278db02c71558a1.tar.gz |
VMware: support spawn of stream-optimized image
This adds support of spawning instances using stream-optimized
disk images. This format is better suited as a glance format as it is
compressed, sparsed and optimized for streaming. The change uses the
oslo.vmware library to provide the functionality to transfer the image
to the server by importing it as a virtual machine.
Implements: blueprint vmware-vsan-support
Co-authored-by: Radoslav Gerganov <rgerganov@vmware.com>
Change-Id: I5c5c2aae733a2d55643d2ea5c293873b21325db6
Diffstat (limited to 'nova/virt/vmwareapi/ds_util.py')
-rw-r--r-- | nova/virt/vmwareapi/ds_util.py | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/nova/virt/vmwareapi/ds_util.py b/nova/virt/vmwareapi/ds_util.py index 68d61401d4..cd4518046d 100644 --- a/nova/virt/vmwareapi/ds_util.py +++ b/nova/virt/vmwareapi/ds_util.py @@ -21,7 +21,7 @@ from oslo.vmware import exceptions as vexc from oslo.vmware import pbm from nova import exception -from nova.i18n import _, _LE +from nova.i18n import _, _LE, _LI from nova.openstack.common import log as logging from nova.virt.vmwareapi import vim_util from nova.virt.vmwareapi import vm_util @@ -364,6 +364,46 @@ def file_delete(session, ds_path, dc_ref): LOG.debug("Deleted the datastore file") +def disk_move(session, dc_ref, src_file, dst_file): + """Moves the source virtual disk to the destination. + + The list of possible faults that the server can return on error + include: + + * CannotAccessFile: Thrown if the source file or folder cannot be + moved because of insufficient permissions. + * FileAlreadyExists: Thrown if a file with the given name already + exists at the destination. + * FileFault: Thrown if there is a generic file error + * FileLocked: Thrown if the source file or folder is currently + locked or in use. + * FileNotFound: Thrown if the file or folder specified by sourceName + is not found. + * InvalidDatastore: Thrown if the operation cannot be performed on + the source or destination datastores. + * NoDiskSpace: Thrown if there is not enough space available on the + destination datastore. + * RuntimeFault: Thrown if any type of runtime fault is thrown that + is not covered by the other faults; for example, + a communication error. + + """ + LOG.debug("Moving virtual disk from %(src)s to %(dst)s.", + {'src': src_file, 'dst': dst_file}) + move_task = session._call_method( + session.vim, + "MoveVirtualDisk_Task", + session.vim.service_content.virtualDiskManager, + sourceName=str(src_file), + sourceDatacenter=dc_ref, + destName=str(dst_file), + destDatacenter=dc_ref, + force=False) + session._wait_for_task(move_task) + LOG.info(_LI("Moved virtual disk from %(src)s to %(dst)s."), + {'src': src_file, 'dst': dst_file}) + + def file_move(session, dc_ref, src_file, dst_file): """Moves the source file or folder to the destination. |