Commit 4cfb9426 authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix some errors in instance modify --disk remove

The RpcResult introduction still left some bugs (after multiple patches):
  - we don't correctly check the result type
  - rename a variable to prevent a conflict

Reviewed-by: imsnah
parent f57c76e4
......@@ -5326,9 +5326,9 @@ class LUSetInstanceParams(LogicalUnit):
" an instance")
ins_l = self.rpc.call_instance_list([pnode], [instance.hypervisor])
ins_l = ins_l[pnode]
if not type(ins_l) is list:
if ins_l.failed or not isinstance(, list):
raise errors.OpPrereqError("Can't contact node '%s'" % pnode)
if in ins_l:
if in
raise errors.OpPrereqError("Instance is running, can't remove"
" disks.")
......@@ -5366,8 +5366,8 @@ class LUSetInstanceParams(LogicalUnit):
device_idx = len(instance.disks)
for node, disk in device.ComputeNodeTree(instance.primary_node):
self.cfg.SetDiskID(disk, node)
result = self.rpc.call_blockdev_remove(node, disk)
if result.failed or not
rpc_result = self.rpc.call_blockdev_remove(node, disk)
if rpc_result.failed or not
self.proc.LogWarning("Could not remove disk/%d on node %s,"
" continuing anyway", device_idx, node)
result.append(("disk/%d" % device_idx, "remove"))
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