Handle better broken disks
authorIustin Pop <iustin@google.com>
Thu, 12 Feb 2009 17:09:20 +0000 (17:09 +0000)
committerIustin Pop <iustin@google.com>
Thu, 12 Feb 2009 17:09:20 +0000 (17:09 +0000)
While running burnin:
  File "/usr/lib/python2.4/site-packages/ganeti/objects.py", line 497, in __str__
    val += ", size=%dm)>" % self.size
TypeError: int argument required

This happened while handling another error, so we lose the original
error information.

So we should try to handle this better.

Reviewed-by: ultrotter

lib/objects.py

index 596aab6..2fbdc58 100644 (file)
@@ -494,7 +494,10 @@ class Disk(ConfigObject):
       val += ", not visible"
     else:
       val += ", visible as /dev/%s" % self.iv_name
-    val += ", size=%dm)>" % self.size
+    if isinstance(self.size, int):
+      val += ", size=%dm)>" % self.size
+    else:
+      val += ", size='%s')>" % (self.size,)
     return val
 
   def Verify(self):