Commit 1559e1e7 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

gnt-instance: Adding verification of instance policy to modify


Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 92cf62e3
......@@ -1322,7 +1322,8 @@ def SetInstanceParams(opts, args):
force=opts.force,
wait_for_sync=opts.wait_for_sync,
offline_inst=opts.offline_inst,
online_inst=opts.online_inst)
online_inst=opts.online_inst,
ignore_ipolicy=opts.ignore_ipolicy)
# even if here we process the result, we allow submit only
result = SubmitOrSend(op, opts)
......@@ -1507,7 +1508,7 @@ 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],
ONLINE_INST_OPT, IGNORE_IPOLICY_OPT],
"<instance>", "Alters the parameters of an instance"),
"shutdown": (
GenericManyOps("shutdown", _ShutdownInstance), [ArgInstance()],
......
......@@ -11788,6 +11788,9 @@ class LUInstanceSetParams(LogicalUnit):
_CheckNodesFreeDiskPerVG(self, [self.op.remote_node], required)
 
snode_info = self.cfg.GetNodeInfo(self.op.remote_node)
ipolicy = _CalculateGroupIPolicy(cluster, snode_info.group)
_CheckTargetNodeIPolicy(self, ipolicy, instance, snode_info,
ignore=self.op.ignore_ipolicy)
if pnode_info.group != snode_info.group:
self.LogWarning("The primary and secondary nodes are in two"
" different node groups; the disk parameters"
......
......@@ -1359,6 +1359,7 @@ class OpInstanceSetParams(OpCode):
_PInstanceName,
_PForce,
_PForceVariant,
_PIgnoreIpolicy,
# TODO: Use _TestNicDef
("nics", ht.EmptyList, ht.TList,
"List of NIC changes. Each item is of the form ``(op, settings)``."
......
......@@ -861,6 +861,7 @@ MODIFY
| [{-O|--os-parameters} *param*=*value*... ]
| [--offline \| --online]
| [--submit]
| [--ignore-ipolicy]
| {*instance*}
Modifies the memory size, number of vcpus, ip address, MAC address
......@@ -914,6 +915,9 @@ The ``--submit`` option is used to send the job to the master daemon
but not wait for its completion. The job ID will be shown so that it
can be examined via **gnt-job info**.
If ``--ignore-ipolicy`` is given any instance policy violations occuring
during this operation are ignored.
Most of the changes take effect at the next restart. If the instance is
running, there is no effect on the instance.
......
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