"HID_OS_OPT",
"GLOBAL_SHARED_FILEDIR_OPT",
"HOTPLUG_OPT",
+ "HOTPLUG_IF_POSSIBLE_OPT",
"KEEPDISKS_OPT",
"HVLIST_OPT",
"HVOPTS_OPT",
action="store_true", default=False,
help="Do not remove disks")
+HOTPLUG_IF_POSSIBLE_OPT = cli_option("--hotplug-if-possible",
+ dest="hotplug_if_possible",
+ action="store_true", default=False,
+ help="Hotplug devices in case"
+ " hotplug is supported")
+
#: Options provided by all commands
COMMON_OPTS = [DEBUG_OPT, REASON_OPT]
nics=nics,
disks=disks,
hotplug=opts.hotplug,
+ hotplug_if_possible=opts.hotplug_if_possible,
keep_disks=opts.keep_disks,
disk_template=opts.disk_template,
remote_node=opts.node,
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,
- NOCONFLICTSCHECK_OPT, NEW_PRIMARY_OPT, HOTPLUG_OPT, KEEPDISKS_OPT],
+ NOCONFLICTSCHECK_OPT, NEW_PRIMARY_OPT, HOTPLUG_OPT, KEEPDISKS_OPT,
+ HOTPLUG_IF_POSSIBLE_OPT],
"<instance>", "Alters the parameters of an instance"),
"shutdown": (
GenericManyOps("shutdown", _ShutdownInstance), [ArgInstance()],
# dictionary with instance information after the modification
ispec = {}
- if self.op.hotplug:
+ if self.op.hotplug or self.op.hotplug_if_possible:
result = self.rpc.call_hotplug_supported(self.instance.primary_node,
self.instance)
- # result.Raise("Hotplug is not supported.")
if result.fail_msg:
- self.LogWarning(result.fail_msg)
- self.op.hotplug = False
- self.LogInfo("Continuing execution..")
+ if self.op.hotplug:
+ result.Raise("Hotplug is not possible: %s" % result.fail_msg,
+ prereq=True)
+ else:
+ self.LogWarning(result.fail_msg)
+ self.op.hotplug = False
+ self.LogInfo("Modification will take place without hotplugging.")
+ else:
+ self.op.hotplug = True
# Check disk modifications. This is done here and not in CheckArguments
# (as with NICs), because we need to know the instance's disk template
"""
try:
output = self._CallMonitorCommand(instance.name, self._INFO_VERSION_CMD)
- except errors.HypervisorError, err:
- raise errors.HotplugError("Cannot hotplug on a stopped VM.")
+ except errors.HypervisorError:
+ raise errors.HotplugError("Instance is probably down")
# TODO: search for netdev_add, drive_add, device_add.....
match = self._INFO_VERSION_RE.search(output.stdout)
if not match:
- raise errors.HotplugError("Cannot parse qemu version via monitor.")
+ raise errors.HotplugError("Cannot parse qemu version via monitor")
+
v_major, v_min, _, _ = match.groups()
if (int(v_major), int(v_min)) < (1, 0):
raise errors.HotplugError("Hotplug not supported for qemu versions < 1.0")
| [\--submit]
| [\--ignore-ipolicy]
| [\--hotplug]
+| [\--hotplug-if-possible]
| {*instance*}
Modifies the memory size, number of vcpus, ip address, MAC address
is currently supported only for KVM hypervisor and for versions greater
than 1.0.
+If ``--hotplug-if-possible`` is given then ganeti won't abort in case
+hotplug is not supported. It will continue execution and modification
+will take place after reboot. This covers use cases where instances are
+not running or hypervisor is not KVM.
+
See **ganeti**\(7) for a description of ``--submit`` and other common
options.
, pOffline
, pIpConflictsCheck
, pHotplug
+ , pHotplugIfPossible
, pKeepDisks
])
, ("OpInstanceGrowDisk",
, pDiskState
, pIgnoreIpolicy
, pHotplug
+ , pHotplugIfPossible
, pKeepDisks
, pAllowRuntimeChgs
, pInstDisks
pHotplug :: Field
pHotplug = defaultFalse "hotplug"
+pHotplugIfPossible :: Field
+pHotplugIfPossible = defaultFalse "hotplug_if_possible"
+
-- | Whether to remove disks.
pKeepDisks :: Field
pKeepDisks = defaultFalse "keep_disks"