Revision 50e0f1d9
b/lib/backend.py | ||
---|---|---|
1987 | 1987 |
""" |
1988 | 1988 |
hyper = hypervisor.GetHypervisor(instance.hypervisor) |
1989 | 1989 |
try: |
1990 |
hyper.HotplugSupported(instance, action, dev_type)
|
|
1991 |
except (errors.HotplugError, errors.HypervisorError), err:
|
|
1990 |
hyper.VerifyHotplugSupport(instance, action, dev_type)
|
|
1991 |
except errors.HotplugError, err:
|
|
1992 | 1992 |
_Fail("Hotplug is not supported: %s", err) |
1993 | 1993 |
|
1994 | 1994 |
if action == constants.HOTPLUG_ACTION_ADD: |
b/lib/hypervisor/hv_base.py | ||
---|---|---|
564 | 564 |
else: |
565 | 565 |
return None |
566 | 566 |
|
567 |
# pylint: disable=R0201,W0613 |
|
567 | 568 |
def HotAddDevice(self, instance, dev_type, device, extra, seq): |
568 | 569 |
"""Hot-add a device. |
569 | 570 |
|
570 | 571 |
""" |
571 |
pass
|
|
572 |
raise errors.HotplugError("Hotplug is not supported by this hypervisor")
|
|
572 | 573 |
|
574 |
# pylint: disable=R0201,W0613 |
|
573 | 575 |
def HotDelDevice(self, instance, dev_type, device, extra, seq): |
574 | 576 |
"""Hot-del a device. |
575 | 577 |
|
576 | 578 |
""" |
577 |
pass
|
|
579 |
raise errors.HotplugError("Hotplug is not supported by this hypervisor")
|
|
578 | 580 |
|
581 |
# pylint: disable=R0201,W0613 |
|
579 | 582 |
def HotModDevice(self, instance, dev_type, device, extra, seq): |
580 | 583 |
"""Hot-mod a device. |
581 | 584 |
|
582 | 585 |
""" |
583 |
pass |
|
586 |
raise errors.HotplugError("Hotplug is not supported by this hypervisor") |
|
587 |
|
|
588 |
# pylint: disable=R0201,W0613 |
|
589 |
def VerifyHotplugSupport(self, instance, action, dev_type): |
|
590 |
"""Verifies that hotplug is supported. |
|
584 | 591 |
|
585 |
def HotplugSupported(self, instance, action, dev_type): |
|
586 |
"""Whether hotplug is supported. |
|
592 |
Hotplug is not supported by default. If a hypervisor wants to support |
|
593 |
it it should override this method. |
|
594 |
|
|
595 |
@type instance: L{objects.Instance} |
|
596 |
@param instance: the instance object |
|
597 |
@type action: string |
|
598 |
@param action: one of the supported hotplug commands |
|
599 |
@type dev_type: string |
|
600 |
@param dev_type: one of the supported device types to hotplug |
|
601 |
@raise errors.HotplugError: if hotplugging is not supported |
|
587 | 602 |
|
588 |
Depends on instance's hvparam, the action. and the dev_type |
|
589 | 603 |
""" |
590 |
raise NotImplementedError |
|
604 |
raise errors.HotplugError("Hotplug is not supported by this hypervisor") |
b/lib/hypervisor/hv_chroot.py | ||
---|---|---|
329 | 329 |
|
330 | 330 |
""" |
331 | 331 |
raise HypervisorError("Migration not supported by the chroot hypervisor") |
332 |
|
|
333 |
def HotplugSupported(self, instance, action, dev_type): |
|
334 |
"""Whether hotplug is supported. |
|
335 |
|
|
336 |
""" |
|
337 |
raise HypervisorError("Hotplug not supported by the chroot hypervisor") |
b/lib/hypervisor/hv_fake.py | ||
---|---|---|
354 | 354 |
|
355 | 355 |
""" |
356 | 356 |
return objects.MigrationStatus(status=constants.HV_MIGRATION_COMPLETED) |
357 |
|
|
358 |
def HotplugSupported(self, instance, action, dev_type): |
|
359 |
"""Whether hotplug is supported. |
|
360 |
|
|
361 |
""" |
|
362 |
raise errors.HypervisorError("Hotplug not supported by the fake hypervisor") |
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
1999 | 1999 |
|
2000 | 2000 |
dev.pci = int(free) |
2001 | 2001 |
|
2002 |
def HotplugSupported(self, instance, action, dev_type):
|
|
2003 |
"""Check if hotplug is supported.
|
|
2002 |
def VerifyHotplugSupport(self, instance, action, dev_type):
|
|
2003 |
"""Verifies that hotplug is supported.
|
|
2004 | 2004 |
|
2005 | 2005 |
Hotplug is *not* supported in case of: |
2006 | 2006 |
- qemu versions < 1.0 |
2007 | 2007 |
- security models and chroot (disk hotplug) |
2008 | 2008 |
- fdsend module is missing (nic hot-add) |
2009 | 2009 |
|
2010 |
@raise errors.HypervisorError: in previous cases |
|
2010 |
@raise errors.HypervisorError: in one of the previous cases
|
|
2011 | 2011 |
|
2012 | 2012 |
""" |
2013 | 2013 |
output = self._CallMonitorCommand(instance.name, self._INFO_VERSION_CMD) |
... | ... | |
2034 | 2034 |
action == constants.HOTPLUG_ACTION_ADD and not fdsend): |
2035 | 2035 |
raise errors.HotplugError("Cannot hot-add NIC." |
2036 | 2036 |
" fdsend python module is missing.") |
2037 |
return True |
|
2038 | 2037 |
|
2039 | 2038 |
def _CallHotplugCommand(self, name, cmd): |
2040 | 2039 |
output = self._CallMonitorCommand(name, cmd) |
b/lib/hypervisor/hv_lxc.py | ||
---|---|---|
477 | 477 |
|
478 | 478 |
""" |
479 | 479 |
raise HypervisorError("Migration is not supported by the LXC hypervisor") |
480 |
|
|
481 |
def HotplugSupported(self, instance, action, dev_type): |
|
482 |
"""Whether hotplug is supported. |
|
483 |
|
|
484 |
""" |
|
485 |
raise HypervisorError("Hotplug not supported by the LXC hypervisor") |
b/lib/hypervisor/hv_xen.py | ||
---|---|---|
948 | 948 |
raise errors.HypervisorError("Cannot run xen ('%s'). Error: %s." |
949 | 949 |
% (constants.XEN_CMD_XL, result.stderr)) |
950 | 950 |
|
951 |
def HotplugSupported(self, instance, action, dev_type): |
|
952 |
"""Whether hotplug is supported. |
|
953 |
|
|
954 |
""" |
|
955 |
raise errors.HypervisorError("Hotplug not supported by the xen hypervisor") |
|
956 |
|
|
957 | 951 |
|
958 | 952 |
class XenPvmHypervisor(XenHypervisor): |
959 | 953 |
"""Xen PVM hypervisor interface""" |
Also available in: Unified diff