« Previous | Next » 

Revision d2db2790


Added by Dimitris Aragiorgis about 11 years ago

Hotplug: KVM support

KVM >= 1.0 is needed.

Introduce new methods: HotAddNic/HotDelNic, HotAddDisk/HotDelDisk. All
of them use QEMU monitor interface for hotpluging.

If a device is hotplug-able it should have an uuid after which it gets
named from the hypervisor perspective (e.g. %s % dev.uuid ).

Hypervisor parses existing PCI allocations (via info pci monitor command) and
decides the PCI slot to plug in the device. For this reason _GetFreePCISlot()
is used. Note that this is used during instance startup as well but
reservations derive from KVM default setup, that allocates 4 slots for
devices other than disks and NICs.

If no hotplug takes place (old KVM, device has no idx existing devices
after cfgupgrade
) modifications will take place after reboot.

NIC hotplug:
- open a tap and get its file descriptor.
- pass fd with SCM rights (using python-fdsend) via monitor socket
- create netdev and device with proper qemu interface

Disk hotplug:
- create drive with %s % uuid name
- create device %s % uuid

In order to migrate a VM an identical VM should be booted with -incoming.
Instance info is passed via runtime file. To this end every time a hotplug
takes place runtime file must be updated.

Introduce _GenerateKVMBlockDevicesOptions()

The runtime file contains one more field: block_devices. kvm_cmd is extended
with block device options during _ExecuteKVMRuntime().

Signed-off-by: Dimitris Aragiorgis <>


  • added
  • modified
  • copied
  • renamed
  • deleted

View differences