Commit fd38ef95 authored by Manuel Franceschini's avatar Manuel Franceschini
Browse files

Add check for major/minor in _FormatBlockDevInfo

bdev.FileStorage does not have major or minor fields, so gnt-instance
info for file backed instances fails with a TypeError. This patch
adds checks to prevent that and print 'N/A' instead.

Reviewed-by: imsnah
parent 01fd6005
......@@ -539,7 +539,17 @@ def _FormatBlockDevInfo(buf, dev, indent_level):
buf.write("not active\n")
(path, major, minor, syncp, estt, degr, ldisk) = status
buf.write("%s (%d:%d)" % (path, major, minor))
if major is None:
major_string = "N/A"
major_string = str(major)
if minor is None:
minor_string = "N/A"
minor_string = str(minor)
buf.write("%s (%s:%s)" % (path, major_string, minor_string))
if dtype in (constants.LD_MD_R1, constants.LD_DRBD7, constants.LD_DRBD8):
if syncp is not None:
sync_text = "*RECOVERING* %5.2f%%," % syncp
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