Add --hotplug option.
Only used by OpInstanceCreate()/OpInstanceSetParams.
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
"GLOBAL_FILEDIR_OPT",
"HID_OS_OPT",
"GLOBAL_SHARED_FILEDIR_OPT",
+ "HOTPLUG_OPT",
"HVLIST_OPT",
"HVOPTS_OPT",
"HYPERVISOR_OPT",
help="Marks the grow as absolute instead of the"
" (default) relative mode")
+HOTPLUG_OPT = cli_option("--hotplug", dest="hotplug",
+ action="store_true", default=False,
+ help="Enable disk/nic hotplug")
+
#: Options provided by all commands
COMMON_OPTS = [DEBUG_OPT]
else:
raise errors.ProgrammerError("Invalid creation mode %s" % mode)
+ if opts.hotplug:
+ hotplug = True
+ else:
+ hotplug = False
+
op = opcodes.OpInstanceCreate(instance_name=instance,
disks=disks,
disk_template=opts.disk_template,
src_node=src_node,
src_path=src_path,
tags=tags,
+ hotplug=hotplug,
no_install=no_install,
identify_defaults=identify_defaults,
ignore_ipolicy=opts.ignore_ipolicy)
else:
offline = None
+ if opts.hotplug:
+ hotplug = True
+ else:
+ hotplug = False
+
op = opcodes.OpInstanceSetParams(instance_name=args[0],
nics=nics,
disks=disks,
+ hotplug=hotplug,
disk_template=opts.disk_template,
remote_node=opts.node,
hvparams=opts.hvparams,
FORCE_VARIANT_OPT,
NO_INSTALL_OPT,
IGNORE_IPOLICY_OPT,
+ HOTPLUG_OPT,
]
commands = {
[BACKEND_OPT, DISK_OPT, FORCE_OPT, HVOPTS_OPT, NET_OPT, SUBMIT_OPT,
DISK_TEMPLATE_OPT, SINGLE_NODE_OPT, OS_OPT, FORCE_VARIANT_OPT,
OSPARAMS_OPT, DRY_RUN_OPT, PRIORITY_OPT, NWSYNC_OPT, OFFLINE_INST_OPT,
- ONLINE_INST_OPT, IGNORE_IPOLICY_OPT, RUNTIME_MEM_OPT],
+ ONLINE_INST_OPT, IGNORE_IPOLICY_OPT, RUNTIME_MEM_OPT, HOTPLUG_OPT],
"<instance>", "Alters the parameters of an instance"),
"shutdown": (
GenericManyOps("shutdown", _ShutdownInstance), [ArgInstance()],
("src_path", None, ht.TMaybeString, "Source directory for import"),
("start", True, ht.TBool, "Whether to start instance after creation"),
("tags", ht.EmptyList, ht.TListOf(ht.TNonEmptyString), "Instance tags"),
+ ("hotplug", None, ht.TMaybeBool, "Whether to hotplug devices"),
]
OP_RESULT = ht.Comment("instance nodes")(ht.TListOf(ht.TNonEmptyString))
("wait_for_sync", True, ht.TBool,
"Whether to wait for the disk to synchronize, when changing template"),
("offline", None, ht.TMaybeBool, "Whether to mark instance as offline"),
+ ("hotplug", None, ht.TMaybeBool, "Whether to hotplug devices"),
]
OP_RESULT = _TSetParamsResult