Revision 1c3231aa lib/cmdlib/test.py
b/lib/cmdlib/test.py | ||
---|---|---|
57 | 57 |
# _GetWantedNodes can be used here, but is not always appropriate to use |
58 | 58 |
# this way in ExpandNames. Check LogicalUnit.ExpandNames docstring for |
59 | 59 |
# more information. |
60 |
self.op.on_nodes = GetWantedNodes(self, self.op.on_nodes) |
|
61 |
self.needed_locks[locking.LEVEL_NODE] = self.op.on_nodes |
|
60 |
(self.op.on_node_uuids, self.op.on_nodes) = \ |
|
61 |
GetWantedNodes(self, self.op.on_nodes) |
|
62 |
self.needed_locks[locking.LEVEL_NODE] = self.op.on_node_uuids |
|
62 | 63 |
|
63 | 64 |
def _TestDelay(self): |
64 | 65 |
"""Do the actual sleep. |
... | ... | |
67 | 68 |
if self.op.on_master: |
68 | 69 |
if not utils.TestDelay(self.op.duration): |
69 | 70 |
raise errors.OpExecError("Error during master delay test") |
70 |
if self.op.on_nodes: |
|
71 |
result = self.rpc.call_test_delay(self.op.on_nodes, self.op.duration) |
|
72 |
for node, node_result in result.items(): |
|
73 |
node_result.Raise("Failure during rpc call to node %s" % node) |
|
71 |
if self.op.on_node_uuids: |
|
72 |
result = self.rpc.call_test_delay(self.op.on_node_uuids, self.op.duration) |
|
73 |
for node_uuid, node_result in result.items(): |
|
74 |
node_result.Raise("Failure during rpc call to node %s" % |
|
75 |
self.cfg.GetNodeName(node_uuid)) |
|
74 | 76 |
|
75 | 77 |
def Exec(self, feedback_fn): |
76 | 78 |
"""Execute the test delay opcode, with the wanted repetitions. |
... | ... | |
263 | 265 |
elif self.op.mode == constants.IALLOCATOR_MODE_RELOC: |
264 | 266 |
fname = ExpandInstanceName(self.cfg, self.op.name) |
265 | 267 |
self.op.name = fname |
266 |
self.relocate_from = \ |
|
268 |
self.relocate_from_node_uuids = \
|
|
267 | 269 |
list(self.cfg.GetInstanceInfo(fname).secondary_nodes) |
268 | 270 |
elif self.op.mode in (constants.IALLOCATOR_MODE_CHG_GROUP, |
269 | 271 |
constants.IALLOCATOR_MODE_NODE_EVAC): |
... | ... | |
299 | 301 |
hypervisor=self.op.hypervisor, |
300 | 302 |
node_whitelist=None) |
301 | 303 |
elif self.op.mode == constants.IALLOCATOR_MODE_RELOC: |
302 |
req = iallocator.IAReqRelocate(name=self.op.name, |
|
303 |
relocate_from=list(self.relocate_from)) |
|
304 |
req = iallocator.IAReqRelocate( |
|
305 |
name=self.op.name, |
|
306 |
relocate_from_node_uuids=list(self.relocate_from_node_uuids)) |
|
304 | 307 |
elif self.op.mode == constants.IALLOCATOR_MODE_CHG_GROUP: |
305 | 308 |
req = iallocator.IAReqGroupChange(instances=self.op.instances, |
306 | 309 |
target_groups=self.op.target_groups) |
Also available in: Unified diff