Hotplug: cmdlib support
Hotplugging is done by functions invoked by ApplyContainerMods(). In
order hotplugging to take place a --hotplug option must be passed.
Hotplug can enabled for a VM if --hotplug is passed during
gnt-instance add (hotplug_info will be added).
In order initial devices of a VM to be hotpluggable hotplug_info must be
early available. So _GetPCIInfo() gets either lu.hotplug_info in case of
LUInstanceCreate() or invokes lu.cfg.GetPCIInfo() in case of
LUInstanceSetParams(). To return a pci slot into the pool
lu.cfg.UpdatePCIInfo() must be invoked.
If no --hotplug is passed during gnt-instance modify --net add the nic
won't get a pci value and will be placed automaticaly in a free pci slot
after reboot. This means that is not going to be hotpluggable for the
rest of the instance's life.
To keep pci pool consistent we do not let a device that has been
hotplugged (i.e. has pci value) to be removed without --hotplug.
Before hotplugging a Disk it must be assembled. During
LuInstanceSetParams() newly created disks are not added to the instance
so _ExpandCheckDisks() in _AssembleInstanceDisks() will fail. So we make
this check optional only for this case.
In order to remove a disk (with blockdev_remove) it must be shutdown. So
after unplugging the disk _ShutdownDiskInstanceDisks() must be invoked.
Everything else is just like nic hotplugging.
Signed-off-by:
Dimitris Aragiorgis <dimara@grnet.gr>
Loading
Please register or sign in to comment