KVM hypervisor
Module | monitor |
Qemu monitor control classes |
Module | netdev |
KVM hypervisor tap device helpers |
Module | validation |
KVM hypervisor parameter/syntax validation helpers |
From __init__.py
:
Class |
|
Undocumented |
Class |
|
KVM hypervisor interface |
Variable | psutil |
Undocumented |
Variable | psutil |
Undocumented |
Function | _ |
Return runtime entries for a serialized runtime file |
Function | _ |
Check if a given URL exists on the server |
Function | _ |
Helper function to generate hvinfo of a device (disk, NIC) |
Function | _ |
Construct the -device option string for hvinfo dict |
Function | _ |
Helper function to generate a unique device name used by KVM |
Function | _ |
Helper function to get the drive uri to be used in --drive kvm option |
Function | _ |
Helper function to get an existing device inside the runtime file |
Function | _ |
Upgrade runtime data |
Function | _with |
Wrapper used on hotplug related methods |
Constant | _DEVICE |
Undocumented |
Constant | _DEVICE |
Undocumented |
Constant | _DEVICE |
Undocumented |
Constant | _DEVICE |
Undocumented |
Constant | _FIND |
Undocumented |
Constant | _HOTPLUGGABLE |
Undocumented |
Constant | _KVM |
Undocumented |
Constant | _KVM |
Undocumented |
Constant | _KVM |
Undocumented |
Constant | _KVM |
Undocumented |
Constant | _MIGRATION |
Undocumented |
Constant | _PCI |
Undocumented |
Constant | _POSTCOPY |
Undocumented |
Constant | _RUNTIME |
Undocumented |
Constant | _RUNTIME |
Undocumented |
Constant | _SCSI |
Undocumented |
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|
Undocumented
Value |
|
Helper function to get the drive uri to be used in --drive kvm option
Invoked during startup and disk hot-add. In latter case and if no userspace access mode is used it will be overriden with /dev/fdset/<fdset-id> (see HotAddDisk() and AddFd() of QmpConnection).
Parameters | |
disk:objects.Disk | A disk configuration object |
link:string | The device link as returned by _SymlinkBlockDev() |
uri:string | The drive uri as returned by _CalculateDeviceURI() |
Returns | |
The drive uri to use in kvm option |
Helper function to generate a unique device name used by KVM
QEMU monitor commands use names to identify devices. Since the UUID is too long for a device ID (36 chars vs. 30), we choose to use only the part until the third '-' with a disk/nic prefix. For example if a disk has UUID '932df160-7a22-4067-a566-7e0ca8386133' the resulting device ID would be 'disk-932df160-7a22-4067'.
Parameters | |
dev | device type of param dev (HOTPLUG_TARGET_DISK|NIC) |
dev:objects.Disk or objects.NIC | the device object for which we generate a kvm name |
Construct the -device option string for hvinfo dict
PV disk: virtio-blk-pci,id=disk-1234,bus=pci.0,addr=0x9 PV NIC: virtio-net-pci,id=nic-1234,bus=pci.0,addr=0x9 SG disk: scsi-generic,id=disk-1234,bus=scsi.0,channel=0,scsi-id=1,lun=0
Parameters | |
hvinfo:dict | dictionary created by _GenerateDeviceHVInfo() |
Returns | |
string | The constructed string to be passed along with a -device option |
Helper function to generate hvinfo of a device (disk, NIC)
hvinfo will hold all necessary info for generating the -device QEMU option. We have two main buses: a PCI bus and a SCSI bus (created by a SCSI controller on the PCI bus).
In case of PCI devices we add them on a free PCI slot (addr) on the first PCI bus (pci.0), and in case of SCSI devices we decide to put each disk on a different SCSI target (scsi-id) on the first SCSI bus (scsi.0).
Parameters | |
dev | either HOTPLUG_TARGET_DISK or HOTPLUG_TARGET_NIC |
kvm | the id of the device |
hv | either disk_type or nic_type hvparam |
bus | the current slots of the first PCI and SCSI buses |
Returns | |
dict | dict including all necessary info (driver, id, bus and bus location) for generating a -device QEMU option for either a disk or a NIC |
Helper function to get an existing device inside the runtime file
Used when an instance is running. Load kvm runtime file and search for a device based on its type and uuid.
Parameters | |
dev | device type of param dev |
device:objects.Disk or objects.NIC | the device object for which we generate a kvm name |
runtime:tuple (cmd, nics, hvparams, disks) | the runtime data to search for the device |
Raises | |
errors.HotplugError | in case the requested device does not exist (e.g. device has been added without --hotplug option) |
Upgrade runtime data
Remove any deprecated fields or change the format of the data. The runtime files are not upgraded when Ganeti is upgraded, so the required modification have to be performed here.
Parameters | |
serialized | raw text data read from actual runtime file |
Returns | |
tuple | (cmd, nic dicts, hvparams, bdev dicts) |