Helper methods for operations related to the management of VM records and their attributes like VDIs, VIFs, as well as their lookup functions.
0 - kernel/ramdisk image (goes on dom0’s filesystem) 1 - disk image (local SR, partitioned by objectstore plugin) 2 - raw disk image (local SR, NOT partitioned by plugin) 3 - vhd disk image (local SR, NOT inspected by XS, PV assumed for
linux, HVM assumed for Windows)
Bases: nova.virt.xenapi.HelperBase
The class that wraps the helper methods together.
Compile VM diagnostics data
Fill record with VM status information
Creates Snapshot (Template) VM, Snapshot VBD, Snapshot VDI, Snapshot VHD
Create a VBD record. Returns a Deferred that gives the new VBD reference.
Create a VDI record and returns its reference.
Create a VIF record. Returns a Deferred that gives the new VIF reference.
Create a VM record. Returns a Deferred that gives the new VM reference. the use_pv_kernel flag indicates whether the guest is HVM or PV
There are 3 scenarios:
- Using paravirtualization, kernel passed in
- Using paravirtualization, kernel within the image
- Using hardware virtualization
Destroy VBD from host database
Disk Image Types are used to determine where the kernel will reside within an image. To figure out which type we’re dealing with, we use the following rules:
Determine whether the VM will use a paravirtualized kernel or if it will use hardware virtualization.
- Objectstore (any image type): We use plugin to figure out whether the VDI uses PV
- Glance (VHD): then we use os_type, raise if not set
- Glance (DISK_RAW): use Pygrub to figure out if pv kernel is available
- Glance (DISK): pv is assumed
image_type is interpreted as an ImageType instance Related flags:
xenapi_image_service = [‘glance’, ‘objectstore’] glance_address = ‘address for glance services’ glance_port = ‘port for glance services’
Get the VBD reference from the device number
Finds the SR named by the given name label and returns the UUID
Return the path to our storage repository
This is used when we’re dealing with VHDs directly, either by taking snapshots or by restoring an image in the DISK_VHD format.
Look the instance i up, and returns it if available
Look for the VDIs that are attached to the VM
Makes alterations to the image before launching as part of spawn.
Looks for the system default SR and triggers a re-scan
Scans the SR specified by sr_ref
Unplug VBD from VM
Requests that the Glance plugin bundle the specified VDIs and push them into Glance using the specified human-friendly name.
Return the storage repository to hold VM images
Return the VM RRD XML as a string
Returns the VHD parent of the given VDI record, as a (ref, rec) pair. Returns None if we’re at the root of the tree.
Return the appropriate location for a plugged-in VBD device
Ubuntu Maverick moved xvd? -> sd?. This is considered a bug and will be fixed in future versions:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/684875
For now, we work around it by just doing a string replace.
Same as find_sr except raises a NotFound exception if SR cannot be determined
Call VBD.unplug on the given VBD, with a retry if we get DEVICE_DETACH_REJECTED. For reasons which I don’t understand, we’re seeing the device still in use, even when all processes using the device should be dead.
Spin until the parent VHD is coalesced into its parent VHD
snapshot
snapshot