Commit 36145b12 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Use objects for blockdev_getmirrorstatus RPC call result



This patch changes the return type for backend.BlockdevGetmirrorstatus from
a list of tuples to a list of objects.BlockDevStatus instances.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 96acbc09
......@@ -202,8 +202,9 @@ class NodeHttpServer(http.server.HttpServer):
"""
disks = [objects.Disk.FromDict(dsk_s)
for dsk_s in params]
return backend.BlockdevGetmirrorstatus(disks)
for dsk_s in params]
return [status.ToDict()
for status in backend.BlockdevGetmirrorstatus(disks)]
@staticmethod
def perspective_blockdev_find(params):
......
......@@ -1385,10 +1385,7 @@ def BlockdevGetmirrorstatus(disks):
if rbd is None:
_Fail("Can't find device %s", dsk)
dstatus = rbd.CombinedSyncStatus()
stats.append((dstatus.sync_percent, dstatus.estimated_time,
dstatus.is_degraded, dstatus.ldisk_degraded))
stats.append(rbd.CombinedSyncStatus())
return stats
......
......@@ -1833,18 +1833,18 @@ def _WaitForSync(lu, instance, oneshot=False, unlock=False):
lu.LogWarning("Can't compute data for node %s/%s",
node, instance.disks[i].iv_name)
continue
# we ignore the ldisk parameter
perc_done, est_time, is_degraded, _ = mstat
cumul_degraded = cumul_degraded or (is_degraded and perc_done is None)
if perc_done is not None:
cumul_degraded = (cumul_degraded or
(mstat.is_degraded and mstat.sync_percent is None))
if mstat.sync_percent is not None:
done = False
if est_time is not None:
rem_time = "%d estimated seconds remaining" % est_time
max_time = est_time
if mstat.estimated_time is not None:
rem_time = "%d estimated seconds remaining" % mstat.estimated_time
max_time = mstat.estimated_time
else:
rem_time = "no time estimate"
lu.proc.LogInfo("- device %s: %5.2f%% done, %s" %
(instance.disks[i].iv_name, perc_done, rem_time))
(instance.disks[i].iv_name, mstat.sync_percent, rem_time))
# if we're done but degraded, let's do a few small retries, to
# make sure we see a stable and not transient situation; therefore
......
......@@ -799,8 +799,12 @@ class RpcRunner(object):
This is a single-node call.
"""
return self._SingleNodeCall(node, "blockdev_getmirrorstatus",
[dsk.ToDict() for dsk in disks])
result = self._SingleNodeCall(node, "blockdev_getmirrorstatus",
[dsk.ToDict() for dsk in disks])
if not result.failed:
result.payload = [objects.BlockDevStatus.FromDict(i)
for i in result.payload]
return result
def call_blockdev_find(self, node, disk):
"""Request identification of a given block device.
......
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