self.op.disk_template = None
if not hasattr(self.op, "remote_node"):
self.op.remote_node = None
+ if not hasattr(self.op, "os_name"):
+ self.op.os_name = None
+ if not hasattr(self.op, "force_variant"):
+ self.op.force_variant = False
self.op.force = getattr(self.op, "force", False)
if not (self.op.nics or self.op.disks or self.op.disk_template or
- self.op.hvparams or self.op.beparams):
+ self.op.hvparams or self.op.beparams or self.op.os_name):
raise errors.OpPrereqError("No changes submitted", errors.ECODE_INVAL)
if self.op.hvparams:
(disk_op, len(instance.disks)),
errors.ECODE_INVAL)
+ # OS change
+ if self.op.os_name and not self.op.force:
+ _CheckNodeHasOS(self, instance.primary_node, self.op.os_name,
+ self.op.force_variant)
+
return
def _ConvertPlainToDrbd(self, feedback_fn):
for key, val in self.op.beparams.iteritems():
result.append(("be/%s" % key, val))
+ # OS change
+ if self.op.os_name:
+ instance.os = self.op.os_name
+
self.cfg.Update(instance, feedback_fn)
return result
"instance_name",
"hvparams", "beparams", "force",
"nics", "disks", "disk_template",
- "remote_node",
+ "remote_node", "os_name", "force_variant",
]
<arg>drbd</arg>
</group></arg>
+ <sbr>
+ <arg>--os-name=<replaceable>OS</replaceable> <arg>--force-variant</arg></arg>
<sbr>
<arg>--submit</arg>
</para>
<para>
+ The option <option>--os-name</option> will change the OS
+ name for the instance (without reinstallation). In case an
+ OS variant is specified that is not found, then by default
+ the modification is refused,
+ unless <option>--force-variant</option> is passed. An
+ invalid OS will also be refused, unless
+ the <option>--force</option> option is given.
+ </para>
+
+ <para>
The <option>--submit</option> 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
"""
if not (opts.nics or opts.disks or opts.disk_template or
- opts.hvparams or opts.beparams):
+ opts.hvparams or opts.beparams or opts.os):
ToStderr("Please give at least one of the parameters.")
return 1
remote_node=opts.node,
hvparams=opts.hvparams,
beparams=opts.beparams,
+ os_name=opts.os,
+ force_variant=opts.force_variant,
force=opts.force)
# even if here we process the result, we allow submit only
'modify': (
SetInstanceParams, ARGS_ONE_INSTANCE,
[BACKEND_OPT, DISK_OPT, FORCE_OPT, HVOPTS_OPT, NET_OPT, SUBMIT_OPT,
- DISK_TEMPLATE_OPT, SINGLE_NODE_OPT],
+ DISK_TEMPLATE_OPT, SINGLE_NODE_OPT, OS_OPT, FORCE_VARIANT_OPT],
"<instance>", "Alters the parameters of an instance"),
'shutdown': (
GenericManyOps("shutdown", _ShutdownInstance), [ArgInstance()],