The nova.virt.vmwareapi.vmops Module

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

class VMwareVMOps(session, virtapi, volumeops, cluster=None, datastore_regex=None)

Bases: object

Management class for VM-related tasks.

attach_interface(instance, image_meta, vif)

Attach an interface to the instance.

build_virtual_machine(instance, image_info, dc_info, datastore, network_info, extra_specs, metadata)
check_cache_folder(ds_name, ds_ref)

Check that the cache folder exists.

check_temp_folder(ds_name, ds_ref)

Check that the temp folder exists.

confirm_migration(migration, instance, network_info)

Confirms a resize, destroying the source VM.

destroy(instance, destroy_disks=True)

Destroy a VM instance.

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

detach_interface(instance, vif)

Detach an interface from the instance.

finish_migration(context, migration, instance, disk_info, network_info, image_meta, resize_instance=False, block_device_info=None, power_on=True)

Completes a resize, turning on the migrated instance.

finish_revert_migration(context, instance, network_info, block_device_info, power_on=True)

Finish reverting a resize.


Get the datacenter name and the reference.


Return data about VM diagnostics.


Return data about the VM instance.


Return data about VM diagnostics.


Return connection info for a vnc console using vCenter logic.

inject_network_info(instance, network_info)

inject network info for specified instance.


Lists the VM instances that are registered with vCenter cluster.

manage_image_cache(context, instances)
migrate_disk_and_power_off(context, instance, dest, flavor)

Transfers the disk of a running instance in multiple phases, turning off the instance before the end.

poll_rebooting_instances(timeout, instances)

Poll for rebooting instances.


Power off the specified instance.

Parameters:instance – nova.objects.instance.Instance
reboot(instance, network_info, reboot_type='SOFT')

Reboot a VM instance.

rescue(context, instance, network_info, image_meta)

Rescue the specified instance.

Attach the image that the instance was created from and boot from it.


Resume the specified instance.

snapshot(context, instance, image_id, update_task_state)

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. Creates a linked clone VM from the snapshot
  4. Exports the disk in the link clone VM as a streamOptimized disk.
  5. Delete the linked clone VM
  6. Deletes the snapshot in original instance.
spawn(context, instance, image_meta, injected_files, admin_password, network_info, block_device_info=None)

Suspend the specified instance.

unrescue(instance, power_on=True)

Unrescue the specified instance.

class VirtualMachineInstanceConfigInfo(instance, image_info, datastore, dc_info, image_cache, extra_specs=None)

Bases: object

Parameters needed to create and configure a new instance.


Previous topic

The nova.virt.vmwareapi.vm_util Module

Next topic

The nova.virt.vmwareapi.volumeops Module

Project Source

This Page