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_datacenter_ref_and_name(ds_ref)
Get the datacenter name and the reference.
-
get_diagnostics(instance)
Return data about VM diagnostics.
-
get_info(instance)
Return data about the VM instance.
-
get_instance_diagnostics(instance)
Return data about VM diagnostics.
-
get_mks_console(instance)
-
get_vnc_console(instance)
Return connection info for a vnc console using vCenter logic.
-
inject_network_info(instance, network_info)
inject network info for specified instance.
-
instance_exists(instance)
-
list_instances()
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.
-
pause(instance)
-
poll_rebooting_instances(timeout, instances)
Poll for rebooting instances.
-
power_off(instance)
Power off the specified instance.
Parameters: | instance – nova.objects.instance.Instance |
-
power_on(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(instance)
Resume the specified instance.
-
snapshot(context, instance, image_id, update_task_state)
Create snapshot from a running VM instance.
Steps followed are:
- 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.
- Create the snapshot. A new vmdk is created which the VM points to
now. The earlier vmdk becomes read-only.
- Creates a linked clone VM from the snapshot
- Exports the disk in the link clone VM as a streamOptimized disk.
- Delete the linked clone VM
- Deletes the snapshot in original instance.
-
spawn(context, instance, image_meta, injected_files, admin_password, network_info, block_device_info=None)
-
suspend(instance)
Suspend the specified instance.
-
unpause(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.
-
cache_image_folder
-
cache_image_path
-
retry_if_task_in_progress(func)