+class InstanceConsole(ConfigObject):
+ """Object describing how to access the console of an instance.
+
+ """
+ __slots__ = [
+ "instance",
+ "kind",
+ "message",
+ "host",
+ "port",
+ "user",
+ "command",
+ "display",
+ ]
+
+ def Validate(self):
+ """Validates contents of this object.
+
+ """
+ assert self.kind in constants.CONS_ALL, "Unknown console type"
+ assert self.instance, "Missing instance name"
+ assert self.message or self.kind in [constants.CONS_SSH, constants.CONS_VNC]
+ assert self.host or self.kind == constants.CONS_MESSAGE
+ assert self.port or self.kind in [constants.CONS_MESSAGE,
+ constants.CONS_SSH]
+ assert self.user or self.kind in [constants.CONS_MESSAGE,
+ constants.CONS_VNC]
+ assert self.command or self.kind in [constants.CONS_MESSAGE,
+ constants.CONS_VNC]
+ assert self.display or self.kind in [constants.CONS_MESSAGE,
+ constants.CONS_SSH]
+ return True
+
+