Revision d04aaa2f
b/lib/cmdlib.py | ||
---|---|---|
2761 | 2761 |
assert self.instance is not None, \ |
2762 | 2762 |
"Cannot retrieve locked instance %s" % self.op.instance_name |
2763 | 2763 |
|
2764 |
# extra beparams |
|
2765 |
self.beparams = getattr(self.op, "beparams", {}) |
|
2766 |
if self.beparams: |
|
2767 |
if not isinstance(self.beparams, dict): |
|
2768 |
raise errors.OpPrereqError("Invalid beparams passed: %s, expected" |
|
2769 |
" dict" % (type(self.beparams), )) |
|
2770 |
# fill the beparams dict |
|
2771 |
utils.ForceDictType(self.beparams, constants.BES_PARAMETER_TYPES) |
|
2772 |
self.op.beparams = self.beparams |
|
2773 |
|
|
2774 |
# extra hvparams |
|
2775 |
self.hvparams = getattr(self.op, "hvparams", {}) |
|
2776 |
if self.hvparams: |
|
2777 |
if not isinstance(self.hvparams, dict): |
|
2778 |
raise errors.OpPrereqError("Invalid hvparams passed: %s, expected" |
|
2779 |
" dict" % (type(self.hvparams), )) |
|
2780 |
|
|
2781 |
# check hypervisor parameter syntax (locally) |
|
2782 |
cluster = self.cfg.GetClusterInfo() |
|
2783 |
utils.ForceDictType(self.hvparams, constants.HVS_PARAMETER_TYPES) |
|
2784 |
filled_hvp = cluster.FillDict(cluster.hvparams[instance.hypervisor], |
|
2785 |
instance.hvparams) |
|
2786 |
filled_hvp.update(self.hvparams) |
|
2787 |
hv_type = hypervisor.GetHypervisor(instance.hypervisor) |
|
2788 |
hv_type.CheckParameterSyntax(filled_hvp) |
|
2789 |
_CheckHVParams(self, instance.all_nodes, instance.hypervisor, filled_hvp) |
|
2790 |
self.op.hvparams = self.hvparams |
|
2791 |
|
|
2764 | 2792 |
_CheckNodeOnline(self, instance.primary_node) |
2765 | 2793 |
|
2766 | 2794 |
bep = self.cfg.GetClusterInfo().FillBE(instance) |
... | ... | |
2789 | 2817 |
|
2790 | 2818 |
_StartInstanceDisks(self, instance, force) |
2791 | 2819 |
|
2792 |
result = self.rpc.call_instance_start(node_current, instance, None, None) |
|
2820 |
result = self.rpc.call_instance_start(node_current, instance, |
|
2821 |
self.hvparams, self.beparams) |
|
2793 | 2822 |
msg = result.RemoteFailMsg() |
2794 | 2823 |
if msg: |
2795 | 2824 |
_ShutdownInstanceDisks(self, instance) |
b/lib/opcodes.py | ||
---|---|---|
382 | 382 |
"""Startup an instance.""" |
383 | 383 |
OP_ID = "OP_INSTANCE_STARTUP" |
384 | 384 |
OP_DSC_FIELD = "instance_name" |
385 |
__slots__ = ["instance_name", "force"] |
|
385 |
__slots__ = ["instance_name", "force", "hvparams", "beparams"]
|
|
386 | 386 |
|
387 | 387 |
|
388 | 388 |
class OpShutdownInstance(OpCode): |
b/man/gnt-instance.sgml | ||
---|---|---|
1127 | 1127 |
<para> |
1128 | 1128 |
Show detailed information about the given instance(s). This is |
1129 | 1129 |
different from <command>list</command> as it shows detailed data |
1130 |
about the instance's disks (especially useful for the drbd disk
|
|
1130 |
about the instance's disks (especially useful for the drbd disk |
|
1131 | 1131 |
template). |
1132 | 1132 |
</para> |
1133 | 1133 |
|
... | ... | |
1314 | 1314 |
<arg>--all</arg> |
1315 | 1315 |
</group> |
1316 | 1316 |
<sbr> |
1317 |
<arg>-H <option>key=value...</option></arg> |
|
1318 |
<arg>-B <option>key=value...</option></arg> |
|
1319 |
<sbr> |
|
1317 | 1320 |
<arg>--submit</arg> |
1318 | 1321 |
<sbr> |
1319 | 1322 |
<arg choice="opt" |
... | ... | |
1383 | 1386 |
</para> |
1384 | 1387 |
|
1385 | 1388 |
<para> |
1389 |
The <option>-H</option> and <option>-B</option> options |
|
1390 |
specify extra, temporary hypervisor and backend parameters |
|
1391 |
that can be used to start an instance with modified |
|
1392 |
parameters. They can be useful for quick testing without |
|
1393 |
having to modify an instance back and forth, e.g.: |
|
1394 |
<screen> |
|
1395 |
# gnt-instance start -H root_args="single" instance1 |
|
1396 |
# gnt-instance start -B memory=2048 instance2 |
|
1397 |
</screen> |
|
1398 |
The first form will start the instance |
|
1399 |
<userinput>instance1</userinput> in single-user mode, and |
|
1400 |
the instance <userinput>instance2</userinput> with 2GB of |
|
1401 |
RAM (this time only, unless that is the actual instance |
|
1402 |
memory size already). |
|
1403 |
</para> |
|
1404 |
|
|
1405 |
<para> |
|
1386 | 1406 |
The <option>--submit</option> option is used to send the job to |
1387 | 1407 |
the master daemon but not wait for its completion. The job |
1388 | 1408 |
ID will be shown so that it can be examined via |
b/scripts/gnt-instance | ||
---|---|---|
710 | 710 |
for name in inames: |
711 | 711 |
op = opcodes.OpStartupInstance(instance_name=name, |
712 | 712 |
force=opts.force) |
713 |
# do not add these parameters to the opcode unless they're defined |
|
714 |
if opts.hvparams: |
|
715 |
op.hvparams = opts.hvparams |
|
716 |
if opts.beparams: |
|
717 |
op.beparams = opts.beparams |
|
713 | 718 |
jex.QueueJob(name, op) |
714 | 719 |
jex.WaitOrShow(not opts.submit_only) |
715 | 720 |
return 0 |
... | ... | |
1472 | 1477 |
m_node_opt, m_pri_node_opt, m_sec_node_opt, |
1473 | 1478 |
m_clust_opt, m_inst_opt, |
1474 | 1479 |
SUBMIT_OPT, |
1480 |
keyval_option("-H", "--hypervisor", type="keyval", |
|
1481 |
default={}, dest="hvparams", |
|
1482 |
help="Temporary hypervisor parameters"), |
|
1483 |
keyval_option("-B", "--backend", type="keyval", |
|
1484 |
default={}, dest="beparams", |
|
1485 |
help="Temporary backend parameters"), |
|
1475 | 1486 |
], |
1476 |
"<instance>", "Starts an instance"), |
|
1487 |
"<instance>", "Starts an instance"),
|
|
1477 | 1488 |
|
1478 | 1489 |
'reboot': (RebootInstance, ARGS_ANY, |
1479 | 1490 |
[DEBUG_OPT, m_force_multi, |
Also available in: Unified diff