Commit 98825740 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

objects.BlockDevStatus: Remove ToLegacyStatus

Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarGuido Trotter <>
Reviewed-by: default avatarIustin Pop <>
parent 8113a52e
......@@ -6293,22 +6293,31 @@ class LUQueryInstanceData(NoHooksLU):
in self.wanted_names]
def _ComputeBlockdevStatus(self, node, instance_name, dev):
"""Returns the status of a block device
if self.op.static:
return None
self.cfg.SetDiskID(dev, node)
result = self.rpc.call_blockdev_find(node, dev)
if result.offline:
return None
result.Raise("Can't compute disk status for %s" % instance_name)
status = result.payload
return (status.dev_path, status.major, status.minor,
status.sync_percent, status.estimated_time,
status.is_degraded, status.ldisk_degraded)
def _ComputeDiskStatus(self, instance, snode, dev):
"""Compute block device status.
static = self.op.static
if not static:
self.cfg.SetDiskID(dev, instance.primary_node)
dev_pstatus = self.rpc.call_blockdev_find(instance.primary_node, dev)
if dev_pstatus.offline:
dev_pstatus = None
dev_pstatus.Raise("Can't compute disk status for %s" %
dev_pstatus = dev_pstatus.payload.ToLegacyStatus()
dev_pstatus = None
if dev.dev_type in constants.LDS_DRBD:
# we change the snode then (otherwise we use the one passed in)
if dev.logical_id[0] == instance.primary_node:
......@@ -6316,16 +6325,9 @@ class LUQueryInstanceData(NoHooksLU):
snode = dev.logical_id[0]
if snode and not static:
self.cfg.SetDiskID(dev, snode)
dev_sstatus = self.rpc.call_blockdev_find(snode, dev)
if dev_sstatus.offline:
dev_sstatus = None
dev_sstatus.Raise("Can't compute disk status for %s" %
dev_sstatus = dev_sstatus.payload.ToLegacyStatus()
dev_sstatus = None
dev_pstatus = self._ComputeBlockdevStatus(instance.primary_node,, dev)
dev_sstatus = self._ComputeBlockdevStatus(snode,, dev)
if dev.children:
dev_children = [self._ComputeDiskStatus(instance, snode, child)
......@@ -877,14 +877,6 @@ class BlockDevStatus(ConfigObject):
def ToLegacyStatus(self):
"""Converts the device status to a legacy tuple.
return (self.dev_path, self.major, self.minor,
self.sync_percent, self.estimated_time,
self.is_degraded, self.ldisk_degraded)
class SerializableConfigParser(ConfigParser.SafeConfigParser):
"""Simple wrapper over ConfigParse that allows serialization.
......@@ -1102,6 +1102,7 @@ def _FormatList(buf, data, indent_level):
elif isinstance(elem, list):
_FormatList(buf, elem, indent_level+1)
def ShowInstanceConfig(opts, args):
"""Compute instance run-time status.
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