Commit 073ca59e authored by Iustin Pop's avatar Iustin Pop
Browse files

Fix printing of unconfigured DRBD devices

If the device is unconfigured (not yet did SetDiskID for it ever), it
might have a physical_id of None. This patch fixes that case.

Reviewed-by: ultrotter
parent d06565e0
......@@ -423,10 +423,16 @@ class Disk(ConfigObject):
val = "<DRBD7("
else:
val = "<DRBD8("
val += ("hosts=%s-%s, port=%s, configured as %s:%s %s:%s, " %
(self.logical_id[0], self.logical_id[1], self.logical_id[2],
if self.physical_id is None:
phy = "unconfigured"
else:
phy = ("configured as %s:%s %s:%s" %
self.physical_id[0], self.physical_id[1],
self.physical_id[2], self.physical_id[3]))
self.physical_id[2], self.physical_id[3])
val += ("hosts=%s-%s, port=%s, %s, " %
(self.logical_id[0], self.logical_id[1], self.logical_id[2],
phy))
if self.children and self.children.count(None) == 0:
val += "backend=%s, metadev=%s" % (self.children[0], self.children[1])
else:
......
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