From: Dimitris Aragiorgis Date: Thu, 9 Aug 2012 10:54:18 +0000 (+0300) Subject: (2.10) Hotplug: objects and constants additions X-Git-Url: https://code.grnet.gr/git/ganeti-local/commitdiff_plain/bd7fed672527a9ab9950b52382e2c3b1590076be (2.10) Hotplug: objects and constants additions Add pci slot in NIC/Disk objects. This slot will be used only by hypervisor code. Currently only KVM will use it and store it temporarily in runtime files. Add HOTPLUG_* constants to define device types an hotplug actions. (fix) Add missing opcode parameter In stable-2.10 opcodes.py is auto-generated from haskell ones. Add hotplug* params to OpInstanceSetParams. Signed-off-by: Dimitris Aragiorgis --- diff --git a/lib/constants.py b/lib/constants.py index 2966efe..64d9836 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -694,6 +694,24 @@ DDMS_VALUES_WITH_MODIFY = (DDMS_VALUES | frozenset([ ])) # TODO: DDM_SWAP, DDM_MOVE? +# device types to hotplug +HOTPLUG_TARGET_DISK = "hotdisk" +HOTPLUG_TARGET_NIC = "hotnic" +HOTPLUG_ALL_TARGETS = frozenset([ + HOTPLUG_TARGET_DISK, + HOTPLUG_TARGET_NIC + ]) + +# hotplug actions +HOTPLUG_ACTION_ADD = "hotadd" +HOTPLUG_ACTION_REMOVE = "hotremove" +HOTPLUG_ACTION_MODIFY = "hotmod" +HOTPLUG_ALL_ACTIONS = frozenset([ + HOTPLUG_ACTION_ADD, + HOTPLUG_ACTION_REMOVE, + HOTPLUG_ACTION_MODIFY + ]) + # common exit codes EXIT_SUCCESS = 0 EXIT_FAILURE = 1 diff --git a/lib/objects.py b/lib/objects.py index 396f6a2..c8d66aa 100644 --- a/lib/objects.py +++ b/lib/objects.py @@ -489,7 +489,8 @@ class ConfigData(ConfigObject): class NIC(ConfigObject): """Config object representing a network card.""" - __slots__ = ["name", "mac", "ip", "network", "nicparams", "netinfo"] + _UUID + __slots__ = ["name", "mac", "ip", "network", + "nicparams", "netinfo", "pci"] + _UUID @classmethod def CheckParameterSyntax(cls, nicparams): @@ -513,7 +514,7 @@ class NIC(ConfigObject): class Disk(ConfigObject): """Config object representing a block device.""" __slots__ = ["name", "dev_type", "logical_id", "physical_id", - "children", "iv_name", "size", "mode", "params"] + _UUID + "children", "iv_name", "size", "mode", "params", "pci"] + _UUID def CreateOnSecondary(self): """Test if this device needs to be created on a secondary node.""" diff --git a/lib/opcodes.py b/lib/opcodes.py index d7e90ba..7b4a05d 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -1720,6 +1720,8 @@ class OpInstanceSetParams(OpCode): "Whether to wait for the disk to synchronize, when changing template"), ("offline", None, ht.TMaybeBool, "Whether to mark instance as offline"), ("conflicts_check", True, ht.TBool, "Check for conflicting IPs"), + ("hotplug", False, ht.TBool, "Whether to hotplug device"), + ("hotplug_if_possible", False, ht.TBool, "If possible then hotplug device"), ] OP_RESULT = _TSetParamsResult