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",
]
def FillHV(self, instance):
"""Fill an instance's hvparams dict.
- @type instance: object
+ @type instance: L{objects.Instance}
@param instance: the instance parameter to fill
@rtype: dict
@return: a copy of the instance's hvparams with missing keys filled from
def FillBE(self, instance):
"""Fill an instance's beparams dict.
- @type instance: object
+ @type instance: L{objects.Instance}
@param instance: the instance parameter to fill
@rtype: dict
@return: a copy of the instance's beparams with missing keys filled from