Revision ad00ee21 lib/backend.py
b/lib/backend.py | ||
---|---|---|
1646 | 1646 |
|
1647 | 1647 |
""" |
1648 | 1648 |
hyper = hypervisor.GetHypervisor(instance.hypervisor) |
1649 |
try: |
|
1650 |
hyper.VerifyHotplugSupport(instance, action, dev_type) |
|
1651 |
except errors.HotplugError, err: |
|
1652 |
_Fail("Hotplug is not supported: %s", err) |
|
1653 |
|
|
1649 | 1654 |
if action == constants.HOTPLUG_ACTION_ADD: |
1650 | 1655 |
fn = hyper.HotAddDevice |
1651 | 1656 |
elif action == constants.HOTPLUG_ACTION_REMOVE: |
... | ... | |
1655 | 1660 |
else: |
1656 | 1661 |
assert action in constants.HOTPLUG_ALL_ACTIONS |
1657 | 1662 |
# This will raise an exception if hotplug is no supported for this case |
1658 |
hyper.HotplugSupported(instance, action, dev_type) |
|
1659 | 1663 |
return fn(instance, dev_type, device, extra, seq) |
1660 | 1664 |
|
1661 | 1665 |
|
1666 |
def HotplugSupported(instance): |
|
1667 |
"""Checks if hotplug is generally supported. |
|
1668 |
|
|
1669 |
""" |
|
1670 |
hyper = hypervisor.GetHypervisor(instance.hypervisor) |
|
1671 |
try: |
|
1672 |
hyper.HotplugSupported(instance) |
|
1673 |
except errors.HotplugError, err: |
|
1674 |
_Fail("Hotplug is not supported: %s", err) |
|
1675 |
|
|
1676 |
|
|
1662 | 1677 |
def BlockdevCreate(disk, size, owner, on_primary, info, excl_stor): |
1663 | 1678 |
"""Creates a block device for an instance. |
1664 | 1679 |
|
Also available in: Unified diff