Revision fc01b92b
b/lib/cli.py | ||
---|---|---|
96 | 96 |
"HID_OS_OPT", |
97 | 97 |
"GLOBAL_SHARED_FILEDIR_OPT", |
98 | 98 |
"HOTPLUG_OPT", |
99 |
"HOTPLUG_IF_POSSIBLE_OPT", |
|
99 | 100 |
"HVLIST_OPT", |
100 | 101 |
"HVOPTS_OPT", |
101 | 102 |
"HYPERVISOR_OPT", |
... | ... | |
1643 | 1644 |
action="store_true", default=False, |
1644 | 1645 |
help="Hotplug supported devices (NICs and Disks)") |
1645 | 1646 |
|
1647 |
HOTPLUG_IF_POSSIBLE_OPT = cli_option("--hotplug-if-possible", |
|
1648 |
dest="hotplug_if_possible", |
|
1649 |
action="store_true", default=False, |
|
1650 |
help="Hotplug devices in case" |
|
1651 |
" hotplug is supported") |
|
1652 |
|
|
1646 | 1653 |
#: Options provided by all commands |
1647 | 1654 |
COMMON_OPTS = [DEBUG_OPT, REASON_OPT] |
1648 | 1655 |
|
b/lib/client/gnt_instance.py | ||
---|---|---|
1341 | 1341 |
nics=nics, |
1342 | 1342 |
disks=disks, |
1343 | 1343 |
hotplug=opts.hotplug, |
1344 |
hotplug_if_possible=opts.hotplug_if_possible, |
|
1344 | 1345 |
disk_template=opts.disk_template, |
1345 | 1346 |
remote_node=opts.node, |
1346 | 1347 |
pnode=opts.new_primary_node, |
... | ... | |
1544 | 1545 |
DISK_TEMPLATE_OPT, SINGLE_NODE_OPT, OS_OPT, FORCE_VARIANT_OPT, |
1545 | 1546 |
OSPARAMS_OPT, DRY_RUN_OPT, PRIORITY_OPT, NWSYNC_OPT, OFFLINE_INST_OPT, |
1546 | 1547 |
ONLINE_INST_OPT, IGNORE_IPOLICY_OPT, RUNTIME_MEM_OPT, |
1547 |
NOCONFLICTSCHECK_OPT, NEW_PRIMARY_OPT, HOTPLUG_OPT], |
|
1548 |
NOCONFLICTSCHECK_OPT, NEW_PRIMARY_OPT, HOTPLUG_OPT, |
|
1549 |
HOTPLUG_IF_POSSIBLE_OPT], |
|
1548 | 1550 |
"<instance>", "Alters the parameters of an instance"), |
1549 | 1551 |
"shutdown": ( |
1550 | 1552 |
GenericManyOps("shutdown", _ShutdownInstance), [ArgInstance()], |
b/lib/cmdlib/instance.py | ||
---|---|---|
2675 | 2675 |
self.op.disk_template)) |
2676 | 2676 |
raise errors.OpPrereqError(errmsg, errors.ECODE_STATE) |
2677 | 2677 |
|
2678 |
# too many local variables |
|
2679 |
# pylint: disable=R0914 |
|
2678 | 2680 |
def CheckPrereq(self): |
2679 | 2681 |
"""Check prerequisites. |
2680 | 2682 |
|
... | ... | |
2756 | 2758 |
constants.DT_EXT), |
2757 | 2759 |
errors.ECODE_INVAL) |
2758 | 2760 |
|
2759 |
if self.op.hotplug: |
|
2761 |
if self.op.hotplug or self.op.hotplug_if_possible:
|
|
2760 | 2762 |
result = self.rpc.call_hotplug_supported(self.instance.primary_node, |
2761 | 2763 |
self.instance) |
2762 |
result.Raise("Hotplug is not supported.") |
|
2764 |
if result.fail_msg: |
|
2765 |
if self.op.hotplug: |
|
2766 |
result.Raise("Hotplug is not possible: %s" % result.fail_msg, |
|
2767 |
prereq=True) |
|
2768 |
else: |
|
2769 |
self.LogWarning(result.fail_msg) |
|
2770 |
self.op.hotplug = False |
|
2771 |
self.LogInfo("Modification will take place without hotplugging.") |
|
2772 |
else: |
|
2773 |
self.op.hotplug = True |
|
2763 | 2774 |
|
2764 | 2775 |
# OS change |
2765 | 2776 |
if self.op.os_name and not self.op.force: |
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
2002 | 2002 |
@raise errors.HypervisorError: in one of the previous cases |
2003 | 2003 |
|
2004 | 2004 |
""" |
2005 |
output = self._CallMonitorCommand(instance.name, self._INFO_VERSION_CMD) |
|
2005 |
try: |
|
2006 |
output = self._CallMonitorCommand(instance.name, self._INFO_VERSION_CMD) |
|
2007 |
except errors.HypervisorError: |
|
2008 |
raise errors.HotplugError("Instance is probably down") |
|
2009 |
|
|
2006 | 2010 |
# TODO: search for netdev_add, drive_add, device_add..... |
2007 | 2011 |
match = self._INFO_VERSION_RE.search(output.stdout) |
2008 | 2012 |
if not match: |
2009 |
raise errors.HotplugError("Try hotplug only in running instances.") |
|
2013 |
raise errors.HotplugError("Cannot parse qemu version via monitor") |
|
2014 |
|
|
2010 | 2015 |
v_major, v_min, _, _ = match.groups() |
2011 | 2016 |
if (int(v_major), int(v_min)) < (1, 0): |
2012 | 2017 |
raise errors.HotplugError("Hotplug not supported for qemu versions < 1.0") |
b/man/gnt-instance.rst | ||
---|---|---|
1109 | 1109 |
| [\--submit] |
1110 | 1110 |
| [\--ignore-ipolicy] |
1111 | 1111 |
| [\--hotplug] |
1112 |
| [\--hotplug-if-possible] |
|
1112 | 1113 |
| {*instance*} |
1113 | 1114 |
|
1114 | 1115 |
Modifies the memory size, number of vcpus, ip address, MAC address |
... | ... | |
1194 | 1195 |
for existing NIC modification interactive verification is needed unless |
1195 | 1196 |
``--force`` option is passed. |
1196 | 1197 |
|
1198 |
If ``--hotplug-if-possible`` is given then ganeti won't abort in case |
|
1199 |
hotplug is not supported. It will continue execution and modification |
|
1200 |
will take place after reboot. This covers use cases where instances are |
|
1201 |
not running or hypervisor is not KVM. |
|
1202 |
|
|
1197 | 1203 |
See **ganeti**\(7) for a description of ``--submit`` and other common |
1198 | 1204 |
options. |
1199 | 1205 |
|
b/src/Ganeti/OpCodes.hs | ||
---|---|---|
398 | 398 |
, pOffline |
399 | 399 |
, pIpConflictsCheck |
400 | 400 |
, pHotplug |
401 |
, pHotplugIfPossible |
|
401 | 402 |
]) |
402 | 403 |
, ("OpInstanceGrowDisk", |
403 | 404 |
[ pInstanceName |
b/src/Ganeti/OpParams.hs | ||
---|---|---|
95 | 95 |
, pDiskState |
96 | 96 |
, pIgnoreIpolicy |
97 | 97 |
, pHotplug |
98 |
, pHotplugIfPossible |
|
98 | 99 |
, pAllowRuntimeChgs |
99 | 100 |
, pInstDisks |
100 | 101 |
, pDiskTemplate |
... | ... | |
707 | 708 |
pHotplug :: Field |
708 | 709 |
pHotplug = defaultFalse "hotplug" |
709 | 710 |
|
711 |
pHotplugIfPossible :: Field |
|
712 |
pHotplugIfPossible = defaultFalse "hotplug_if_possible" |
|
713 |
|
|
710 | 714 |
-- * Parameters for node resource model |
711 | 715 |
|
712 | 716 |
-- | Set hypervisor states. |
b/test/hs/Test/Ganeti/OpCodes.hs | ||
---|---|---|
264 | 264 |
pure emptyJSObject <*> arbitrary <*> pure emptyJSObject <*> |
265 | 265 |
arbitrary <*> genMaybe genNodeNameNE <*> genMaybe genNodeNameNE <*> |
266 | 266 |
genMaybe genNameNE <*> pure emptyJSObject <*> arbitrary <*> |
267 |
arbitrary <*> arbitrary <*> arbitrary |
|
267 |
arbitrary <*> arbitrary <*> arbitrary <*> arbitrary
|
|
268 | 268 |
"OP_INSTANCE_GROW_DISK" -> |
269 | 269 |
OpCodes.OpInstanceGrowDisk <$> genFQDN <*> arbitrary <*> |
270 | 270 |
arbitrary <*> arbitrary <*> arbitrary |
Also available in: Unified diff