Commit 4922cd73 authored by Jose A. Lopes's avatar Jose A. Lopes
Browse files

'Raise' called inside 'CheckPrereq' needs the prereq kw



This patch fixes the missing 'prereq' keyword in calls to 'Raise' in
the control flow of 'CheckPrereq', and updates the tests.
Signed-off-by: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent b3aa93a2
...@@ -1163,11 +1163,13 @@ class LUInstanceCreate(LogicalUnit): ...@@ -1163,11 +1163,13 @@ class LUInstanceCreate(LogicalUnit):
lv_name, errors.ECODE_NOTUNIQUE) lv_name, errors.ECODE_NOTUNIQUE)
vg_names = self.rpc.call_vg_list([pnode.uuid])[pnode.uuid] vg_names = self.rpc.call_vg_list([pnode.uuid])[pnode.uuid]
vg_names.Raise("Cannot get VG information from node %s" % pnode.name) vg_names.Raise("Cannot get VG information from node %s" % pnode.name,
prereq=True)
node_lvs = self.rpc.call_lv_list([pnode.uuid], node_lvs = self.rpc.call_lv_list([pnode.uuid],
vg_names.payload.keys())[pnode.uuid] vg_names.payload.keys())[pnode.uuid]
node_lvs.Raise("Cannot get LV information from node %s" % pnode.name) node_lvs.Raise("Cannot get LV information from node %s" % pnode.name,
prereq=True)
node_lvs = node_lvs.payload node_lvs = node_lvs.payload
delta = all_lvs.difference(node_lvs.keys()) delta = all_lvs.difference(node_lvs.keys())
...@@ -1205,7 +1207,7 @@ class LUInstanceCreate(LogicalUnit): ...@@ -1205,7 +1207,7 @@ class LUInstanceCreate(LogicalUnit):
node_disks = self.rpc.call_bdev_sizes([pnode.uuid], node_disks = self.rpc.call_bdev_sizes([pnode.uuid],
list(all_disks))[pnode.uuid] list(all_disks))[pnode.uuid]
node_disks.Raise("Cannot get block device information from node %s" % node_disks.Raise("Cannot get block device information from node %s" %
pnode.name) pnode.name, prereq=True)
node_disks = node_disks.payload node_disks = node_disks.payload
delta = all_disks.difference(node_disks.keys()) delta = all_disks.difference(node_disks.keys())
if delta: if delta:
...@@ -3072,7 +3074,8 @@ class LUInstanceSetParams(LogicalUnit): ...@@ -3072,7 +3074,8 @@ class LUInstanceSetParams(LogicalUnit):
self.instance.hypervisor, self.instance.hypervisor,
cluster_hvparams) cluster_hvparams)
remote_info.Raise("Error checking node %s" % remote_info.Raise("Error checking node %s" %
self.cfg.GetNodeName(self.instance.primary_node)) self.cfg.GetNodeName(self.instance.primary_node),
prereq=True)
if not remote_info.payload: # not running already if not remote_info.payload: # not running already
raise errors.OpPrereqError("Instance %s is not running" % raise errors.OpPrereqError("Instance %s is not running" %
self.instance.name, errors.ECODE_STATE) self.instance.name, errors.ECODE_STATE)
......
...@@ -444,7 +444,8 @@ class TLMigrateInstance(Tasklet): ...@@ -444,7 +444,8 @@ class TLMigrateInstance(Tasklet):
self.instance.primary_node, self.instance.name, self.instance.primary_node, self.instance.name,
self.instance.hypervisor, cluster.hvparams[self.instance.hypervisor]) self.instance.hypervisor, cluster.hvparams[self.instance.hypervisor])
remote_info.Raise("Error checking instance on node %s" % remote_info.Raise("Error checking instance on node %s" %
self.cfg.GetNodeName(self.instance.primary_node)) self.cfg.GetNodeName(self.instance.primary_node),
prereq=True)
instance_running = bool(remote_info.payload) instance_running = bool(remote_info.payload)
if instance_running: if instance_running:
self.current_mem = int(remote_info.payload["memory"]) self.current_mem = int(remote_info.payload["memory"])
......
...@@ -282,7 +282,8 @@ class LUNodeAdd(LogicalUnit): ...@@ -282,7 +282,8 @@ class LUNodeAdd(LogicalUnit):
# it a property on the base class. # it a property on the base class.
rpcrunner = rpc.DnsOnlyRunner() rpcrunner = rpc.DnsOnlyRunner()
result = rpcrunner.call_version([node_name])[node_name] result = rpcrunner.call_version([node_name])[node_name]
result.Raise("Can't get version information from node %s" % node_name) result.Raise("Can't get version information from node %s" % node_name,
prereq=True)
if constants.PROTOCOL_VERSION == result.payload: if constants.PROTOCOL_VERSION == result.payload:
logging.info("Communication to node %s fine, sw version %s match", logging.info("Communication to node %s fine, sw version %s match",
node_name, result.payload) node_name, result.payload)
......
...@@ -242,7 +242,7 @@ class TestLUNodeAdd(CmdlibTestCase): ...@@ -242,7 +242,7 @@ class TestLUNodeAdd(CmdlibTestCase):
.Build() .Build()
op = self.CopyOpCode(self.op_add) op = self.CopyOpCode(self.op_add)
self.ExecOpCodeExpectOpExecError(op, "Can't get version information from" self.ExecOpCodeExpectOpPrereqError(op, "Can't get version information from"
" node %s" % self.node_add.name) " node %s" % self.node_add.name)
if __name__ == "__main__": if __name__ == "__main__":
......
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