Commit 9569d877 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis Committed by Thomas Thrainer
Browse files

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.
Signed-off-by: default avatarDimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: default avatarThomas Thrainer <thomasth@google.com>
Reviewed-by: default avatarThomas Thrainer <thomasth@google.com>
parent b72af2b3
......@@ -393,6 +393,7 @@ DDM_REMOVE = _constants.DDM_REMOVE
DDMS_VALUES = _constants.DDMS_VALUES
DDMS_VALUES_WITH_MODIFY = _constants.DDMS_VALUES_WITH_MODIFY
# common exit codes
EXIT_SUCCESS = _constants.EXIT_SUCCESS
EXIT_FAILURE = _constants.EXIT_FAILURE
EXIT_NOTCLUSTER = _constants.EXIT_NOTCLUSTER
......@@ -1576,6 +1577,17 @@ MOND_LATEST_API_VERSION = 1
UPGRADE_QUEUE_DRAIN_TIMEOUT = _constants.UPGRADE_QUEUE_DRAIN_TIMEOUT
UPGRADE_QUEUE_POLL_INTERVAL = _constants.UPGRADE_QUEUE_POLL_INTERVAL
# device types to hotplug
HOTPLUG_TARGET_DISK = _constants.HOTPLUG_TARGET_DISK
HOTPLUG_TARGET_NIC = _constants.HOTPLUG_TARGET_NIC
HOTPLUG_ALL_TARGETS = _constants.HOTPLUG_ALL_TARGETS
# hotplug actions
HOTPLUG_ACTION_ADD = _constants.HOTPLUG_ACTION_ADD
HOTPLUG_ACTION_REMOVE = _constants.HOTPLUG_ACTION_REMOVE
HOTPLUG_ACTION_MODIFY = _constants.HOTPLUG_ACTION_MODIFY
HOTPLUG_ALL_ACTIONS = _constants.HOTPLUG_ALL_ACTIONS
# other constants
HAS_GNU_LN = _constants.HAS_GNU_LN
......
......@@ -485,7 +485,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):
......@@ -509,7 +510,7 @@ class NIC(ConfigObject):
class Disk(ConfigObject):
"""Config object representing a block device."""
__slots__ = (["name", "dev_type", "logical_id", "children", "iv_name",
"size", "mode", "params", "spindles"] + _UUID +
"size", "mode", "params", "spindles", "pci"] + _UUID +
# dynamic_params is special. It depends on the node this instance
# is sent to, and should not be persisted.
["dynamic_params"])
......
......@@ -3877,3 +3877,30 @@ upgradeQueueDrainTimeout = 36 * 60 * 60 -- 1.5 days
-- | Intervall at which the queue is polled during upgrades
upgradeQueuePollInterval :: Int
upgradeQueuePollInterval = 10
-- * Hotplug Actions
hotplugActionAdd :: String
hotplugActionAdd = Types.hotplugActionToRaw HAAdd
hotplugActionRemove :: String
hotplugActionRemove = Types.hotplugActionToRaw HARemove
hotplugActionModify :: String
hotplugActionModify = Types.hotplugActionToRaw HAMod
hotplugAllActions :: FrozenSet String
hotplugAllActions =
ConstantUtils.mkSet $ map Types.hotplugActionToRaw [minBound..]
-- * Hotplug Device Targets
hotplugTargetNic :: String
hotplugTargetNic = Types.hotplugTargetToRaw HTNic
hotplugTargetDisk :: String
hotplugTargetDisk = Types.hotplugTargetToRaw HTDisk
hotplugAllTargets :: FrozenSet String
hotplugAllTargets =
ConstantUtils.mkSet $ map Types.hotplugTargetToRaw [minBound..]
......@@ -152,6 +152,10 @@ module Ganeti.Types
, RpcTimeout(..)
, rpcTimeoutFromRaw -- FIXME: no used anywhere
, rpcTimeoutToRaw
, HotplugTarget(..)
, hotplugTargetToRaw
, HotplugAction(..)
, hotplugActionToRaw
) where
import Control.Monad (liftM)
......@@ -830,3 +834,20 @@ $(THH.declareILADT "RpcTimeout"
, ("FourHours", 4 * 3600) -- 4 hours
, ("OneDay", 86400) -- 1 day
])
-- | Hotplug action.
$(THH.declareLADT ''String "HotplugAction"
[ ("HAAdd", "hotadd")
, ("HARemove", "hotremove")
, ("HAMod", "hotmod")
])
$(THH.makeJSONInstance ''HotplugAction)
-- | Hotplug Device Target.
$(THH.declareLADT ''String "HotplugTarget"
[ ("HTDisk", "hotdisk")
, ("HTNic", "hotnic")
])
$(THH.makeJSONInstance ''HotplugTarget)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment