The nova.virt.vmwareapi.vmops Module

Class for VM tasks like spawn, snapshot, suspend, resume etc.

class VMWareVMOps(session)

Bases: object

Management class for VM-related tasks.

destroy(instance, network_info)

Destroy a VM instance. Steps followed are: 1. Power off the VM, if it is in poweredOn state. 2. Un-register a VM. 3. Delete the contents of the folder holding the VM related data.

get_console_output(instance)

Return snapshot of console.

get_diagnostics(instance)

Return data about VM diagnostics.

get_info(instance)

Return data about the VM instance.

list_instances()

Lists the VM instances that are registered with the ESX host.

pause(instance)
plug_vifs(instance, network_info)

Plug VIFs into networks.

reboot(instance, network_info)

Reboot a VM instance.

resume(instance)

Resume the specified instance.

snapshot(context, instance, snapshot_name)

Create snapshot from a running VM instance.

Steps followed are:

  1. Get the name of the vmdk file which the VM points to right now. Can be a chain of snapshots, so we need to know the last in the chain.
  2. Create the snapshot. A new vmdk is created which the VM points to now. The earlier vmdk becomes read-only.
  3. Call CopyVirtualDisk which coalesces the disk chain to form a single vmdk, rather a .vmdk metadata file and a -flat.vmdk disk data file.
  4. Now upload the -flat.vmdk file to the image store.
  5. Delete the coalesced .vmdk and -flat.vmdk created.
spawn(context, instance, image_meta, network_info)

Creates a VM instance.

Steps followed are:

  1. Create a VM with no disk and the specifics in the instance object like RAM size.
  2. Create a dummy vmdk of the size of the disk file that is to be uploaded. This is required just to create the metadata file.
  3. Delete the -flat.vmdk file created in the above step and retain the metadata .vmdk file.
  4. Upload the disk file.
  5. Attach the disk to the VM by reconfiguring the same.
  6. Power on the VM.
suspend(instance)

Suspend the specified instance.

unpause(instance)
unplug_vifs(instance, network_info)

Unplug VIFs from networks.

Previous topic

The nova.virt.vmwareapi.vm_util Module

Next topic

The nova.virt.vmwareapi.vmware_images Module

This Page