constants.MAX_TAG_LEN)
if not tag:
raise errors.TagError("Tags cannot be empty")
- if not re.match("^[ \w.+*/:-]+$", tag):
+ if not re.match("^[\w.+*/:-]+$", tag):
raise errors.TagError("Tag contains invalid characters")
def GetTags(self):
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):
+ """Checks that this disk is correctly configured.
+
+ """
+ errors = []
+ if self.mode not in constants.DISK_ACCESS_SET:
+ errors.append("Disk access mode '%s' is invalid" % (self.mode, ))
+ return errors
+
class Instance(TaggableObject):
"""Config object representing an instance."""
"hypervisor",
"hvparams",
"beparams",
- "status",
+ "admin_up",
"nics",
"disks",
"disk_template",
"serial_no",
"master_candidate",
"offline",
+ "drained",
]