Revision c4de9b7a
b/lib/build/rpc_definitions.py | ||
---|---|---|
142 | 142 |
("success", None, "Whether the migration succeeded or not"), |
143 | 143 |
("live", None, "Whether the user requested a live migration or not"), |
144 | 144 |
], None, "Finalize the instance migration on the source node"), |
145 |
("instance_start", SINGLE, TMO_NORMAL, [ |
|
146 |
("instance_hvp_bep", "self._InstDictHvpBep(%s)", None), |
|
147 |
("startup_paused", None, None), |
|
148 |
], None, "Starts an instance"), |
|
149 |
("instance_os_add", SINGLE, TMO_1DAY, [ |
|
150 |
("instance_osp", "self._InstDictOsp(%s)", None), |
|
151 |
("reinstall", None, None), |
|
152 |
("debug", None, None), |
|
153 |
], None, "Starts an instance"), |
|
145 | 154 |
] |
146 | 155 |
|
147 | 156 |
_IMPEXP_CALLS = [ |
b/lib/cmdlib.py | ||
---|---|---|
6080 | 6080 |
|
6081 | 6081 |
_StartInstanceDisks(self, instance, force) |
6082 | 6082 |
|
6083 |
result = self.rpc.call_instance_start(node_current, instance, |
|
6084 |
self.op.hvparams, self.op.beparams, |
|
6085 |
self.op.startup_paused) |
|
6083 |
result = \ |
|
6084 |
self.rpc.call_instance_start(node_current, |
|
6085 |
(instance, self.op.hvparams, |
|
6086 |
self.op.beparams), |
|
6087 |
self.op.startup_paused) |
|
6086 | 6088 |
msg = result.fail_msg |
6087 | 6089 |
if msg: |
6088 | 6090 |
_ShutdownInstanceDisks(self, instance) |
... | ... | |
6172 | 6174 |
self.LogInfo("Instance %s was already stopped, starting now", |
6173 | 6175 |
instance.name) |
6174 | 6176 |
_StartInstanceDisks(self, instance, ignore_secondaries) |
6175 |
result = self.rpc.call_instance_start(node_current, instance,
|
|
6176 |
None, None, False)
|
|
6177 |
result = self.rpc.call_instance_start(node_current, |
|
6178 |
(instance, None, None), False)
|
|
6177 | 6179 |
msg = result.fail_msg |
6178 | 6180 |
if msg: |
6179 | 6181 |
_ShutdownInstanceDisks(self, instance) |
... | ... | |
6334 | 6336 |
try: |
6335 | 6337 |
feedback_fn("Running the instance OS create scripts...") |
6336 | 6338 |
# FIXME: pass debug option from opcode to backend |
6337 |
result = self.rpc.call_instance_os_add(inst.primary_node, inst, True,
|
|
6338 |
self.op.debug_level,
|
|
6339 |
osparams=self.os_inst)
|
|
6339 |
result = self.rpc.call_instance_os_add(inst.primary_node, |
|
6340 |
(inst, self.os_inst), True,
|
|
6341 |
self.op.debug_level)
|
|
6340 | 6342 |
result.Raise("Could not install OS for instance %s on node %s" % |
6341 | 6343 |
(inst.name, inst.primary_node)) |
6342 | 6344 |
finally: |
... | ... | |
7037 | 7039 |
_ShutdownInstanceDisks(self, instance) |
7038 | 7040 |
raise errors.OpExecError("Can't activate the instance's disks") |
7039 | 7041 |
|
7040 |
result = self.rpc.call_instance_start(target_node, instance,
|
|
7041 |
None, None, False)
|
|
7042 |
result = self.rpc.call_instance_start(target_node, |
|
7043 |
(instance, None, None), False)
|
|
7042 | 7044 |
msg = result.fail_msg |
7043 | 7045 |
if msg: |
7044 | 7046 |
_ShutdownInstanceDisks(self, instance) |
... | ... | |
7701 | 7703 |
|
7702 | 7704 |
self.feedback_fn("* starting the instance on the target node %s" % |
7703 | 7705 |
target_node) |
7704 |
result = self.rpc.call_instance_start(target_node, instance, None, None,
|
|
7706 |
result = self.rpc.call_instance_start(target_node, (instance, None, None),
|
|
7705 | 7707 |
False) |
7706 | 7708 |
msg = result.fail_msg |
7707 | 7709 |
if msg: |
... | ... | |
9175 | 9177 |
feedback_fn("* running the instance OS create scripts...") |
9176 | 9178 |
# FIXME: pass debug option from opcode to backend |
9177 | 9179 |
os_add_result = \ |
9178 |
self.rpc.call_instance_os_add(pnode_name, iobj, False,
|
|
9180 |
self.rpc.call_instance_os_add(pnode_name, (iobj, None), False,
|
|
9179 | 9181 |
self.op.debug_level) |
9180 | 9182 |
if pause_sync: |
9181 | 9183 |
feedback_fn("* resuming disk sync") |
... | ... | |
9255 | 9257 |
self.cfg.Update(iobj, feedback_fn) |
9256 | 9258 |
logging.info("Starting instance %s on node %s", instance, pnode_name) |
9257 | 9259 |
feedback_fn("* starting instance...") |
9258 |
result = self.rpc.call_instance_start(pnode_name, iobj,
|
|
9259 |
None, None, False)
|
|
9260 |
result = self.rpc.call_instance_start(pnode_name, (iobj, None, None),
|
|
9261 |
False) |
|
9260 | 9262 |
result.Raise("Could not start instance") |
9261 | 9263 |
|
9262 | 9264 |
return list(iobj.all_nodes) |
... | ... | |
11901 | 11903 |
not self.op.remove_instance): |
11902 | 11904 |
assert not activate_disks |
11903 | 11905 |
feedback_fn("Starting instance %s" % instance.name) |
11904 |
result = self.rpc.call_instance_start(src_node, instance,
|
|
11905 |
None, None, False)
|
|
11906 |
result = self.rpc.call_instance_start(src_node, |
|
11907 |
(instance, None, None), False)
|
|
11906 | 11908 |
msg = result.fail_msg |
11907 | 11909 |
if msg: |
11908 | 11910 |
feedback_fn("Failed to start instance: %s" % msg) |
b/lib/rpc.py | ||
---|---|---|
499 | 499 |
nic['nicparams']) |
500 | 500 |
return idict |
501 | 501 |
|
502 |
def _InstDictHvpBep(self, (instance, hvp, bep)): |
|
503 |
"""Wrapper for L{_InstDict}. |
|
504 |
|
|
505 |
""" |
|
506 |
return self._InstDict(instance, hvp=hvp, bep=bep) |
|
507 |
|
|
508 |
def _InstDictOsp(self, (instance, osparams)): |
|
509 |
"""Wrapper for L{_InstDict}. |
|
510 |
|
|
511 |
""" |
|
512 |
return self._InstDict(instance, osp=osparams) |
|
513 |
|
|
502 | 514 |
def _MultiNodeCall(self, node_list, procedure, args, read_timeout=None): |
503 | 515 |
"""Helper for making a multi-node call |
504 | 516 |
|
... | ... | |
631 | 643 |
# Begin RPC calls |
632 | 644 |
# |
633 | 645 |
|
634 |
@_RpcTimeout(_TMO_NORMAL) |
|
635 |
def call_instance_start(self, node, instance, hvp, bep, startup_paused): |
|
636 |
"""Starts an instance. |
|
637 |
|
|
638 |
This is a single-node call. |
|
639 |
|
|
640 |
""" |
|
641 |
idict = self._InstDict(instance, hvp=hvp, bep=bep) |
|
642 |
return self._SingleNodeCall(node, "instance_start", [idict, startup_paused]) |
|
643 |
|
|
644 |
@_RpcTimeout(_TMO_1DAY) |
|
645 |
def call_instance_os_add(self, node, inst, reinstall, debug, osparams=None): |
|
646 |
"""Installs an OS on the given instance. |
|
647 |
|
|
648 |
This is a single-node call. |
|
649 |
|
|
650 |
""" |
|
651 |
return self._SingleNodeCall(node, "instance_os_add", |
|
652 |
[self._InstDict(inst, osp=osparams), |
|
653 |
reinstall, debug]) |
|
654 |
|
|
655 | 646 |
@classmethod |
656 | 647 |
@_RpcTimeout(_TMO_NORMAL) |
657 | 648 |
def call_upload_file(cls, node_list, file_name, address_list=None): |
Also available in: Unified diff