Revision 65a15336 lib/objects.py
b/lib/objects.py | ||
---|---|---|
412 | 412 |
obj.physical_id = tuple(obj.physical_id) |
413 | 413 |
return obj |
414 | 414 |
|
415 |
def __str__(self): |
|
416 |
"""Custom str() formatter for disks. |
|
417 |
|
|
418 |
""" |
|
419 |
if self.dev_type == constants.LD_LV: |
|
420 |
val = "<LogicalVolume(/dev/%s/%s" % self.logical_id |
|
421 |
elif self.dev_type in constants.LDS_DRBD: |
|
422 |
if self.dev_type == constants.LD_DRBD7: |
|
423 |
val = "<DRBD7(" |
|
424 |
else: |
|
425 |
val = "<DRBD8(" |
|
426 |
val += ("hosts=%s-%s, port=%s, configured as %s:%s %s:%s, " % |
|
427 |
(self.logical_id[0], self.logical_id[1], self.logical_id[2], |
|
428 |
self.physical_id[0], self.physical_id[1], |
|
429 |
self.physical_id[2], self.physical_id[3])) |
|
430 |
if self.children and self.children.count(None) == 0: |
|
431 |
val += "backend=%s, metadev=%s" % (self.children[0], self.children[1]) |
|
432 |
else: |
|
433 |
val += "no local storage" |
|
434 |
elif self.dev_type == constants.LD_MD_R1: |
|
435 |
val = "<MD_R1(uuid=%s, children=%s" % (self.physical_id, self.children) |
|
436 |
else: |
|
437 |
val = ("<Disk(type=%s, logical_id=%s, physical_id=%s, children=%s" % |
|
438 |
(self.dev_type, self.logical_id, self.physical_id, self.children)) |
|
439 |
if self.iv_name is None: |
|
440 |
val += ", not visible" |
|
441 |
else: |
|
442 |
val += ", visible as /dev/%s" % self.iv_name |
|
443 |
val += ", size=%dm)>" % self.size |
|
444 |
return val |
|
445 |
|
|
415 | 446 |
|
416 | 447 |
class Instance(TaggableObject): |
417 | 448 |
"""Config object representing an instance.""" |
Also available in: Unified diff