Commit 6b5e3f70 authored by Iustin Pop's avatar Iustin Pop
Browse files

Convert rpc call_blockdev_rename to (status, data)



This small patch converts the call_blockdev_rename to the new result
type.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 13e720f1
......@@ -2013,10 +2013,12 @@ def BlockdevRename(devlist):
@return: True if all renames succeeded, False otherwise
"""
msgs = []
result = True
for disk, unique_id in devlist:
dev = _RecursiveFindBD(disk)
if dev is None:
msgs.append("Can't find device %s in rename" % str(disk))
result = False
continue
try:
......@@ -2031,9 +2033,11 @@ def BlockdevRename(devlist):
# cache? for now, we only lose lvm data when we rename, which
# is less critical than DRBD or MD
except errors.BlockDeviceError, err:
msgs.append("Can't rename device '%s' to '%s': %s" %
(dev, unique_id, err))
logging.exception("Can't rename device '%s' to '%s'", dev, unique_id)
result = False
return result
return (result, "; ".join(msgs))
def _TransformFileStorageDir(file_storage_dir):
......
......@@ -5251,16 +5251,18 @@ class LUReplaceDisks(LogicalUnit):
info("renaming the old LVs on the target node")
result = self.rpc.call_blockdev_rename(tgt_node, rlist)
result.Raise()
if not result.data:
raise errors.OpExecError("Can't rename old LVs on node %s" % tgt_node)
msg = result.RemoteFailMsg()
if msg:
raise errors.OpExecError("Can't rename old LVs on node %s: %s" %
(tgt_node, msg))
# now we rename the new LVs to the old LVs
info("renaming the new LVs on the target node")
rlist = [(new, old.physical_id) for old, new in zip(old_lvs, new_lvs)]
result = self.rpc.call_blockdev_rename(tgt_node, rlist)
result.Raise()
if not result.data:
raise errors.OpExecError("Can't rename new LVs on node %s" % tgt_node)
msg = result.RemoteFailMsg()
if msg:
raise errors.OpExecError("Can't rename new LVs on node %s: %s" %
(tgt_node, msg))
for old, new in zip(old_lvs, new_lvs):
new.logical_id = old.logical_id
......
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