(IQ_CONFIG,
IQ_LIVE,
- IQ_DISKUSAGE) = range(100, 103)
+ IQ_DISKUSAGE,
+ IQ_CONSOLE) = range(100, 104)
(LQ_MODE,
LQ_OWNER,
"""
def __init__(self, instances, cluster, disk_usage, offline_nodes, bad_nodes,
- live_data, wrongnode_inst):
+ live_data, wrongnode_inst, console):
"""Initializes this class.
@param instances: List of instance objects
@param live_data: Per-instance live data
@type wrongnode_inst: set
@param wrongnode_inst: Set of instances running on wrong node(s)
+ @type console: dict; instance name as key
+ @param console: Per-instance console information
"""
assert len(set(bad_nodes) & set(offline_nodes)) == len(offline_nodes), \
self.bad_nodes = bad_nodes
self.live_data = live_data
self.wrongnode_inst = wrongnode_inst
+ self.console = console
# Used for individual rows
self.inst_hvparams = None
return usage
+def _GetInstanceConsole(ctx, inst):
+ """Get console information for instance.
+
+ @type ctx: L{InstanceQueryData}
+ @type inst: L{objects.Instance}
+ @param inst: Instance object
+
+ """
+ consinfo = ctx.console[inst.name]
+
+ if consinfo is None:
+ return _FS_UNAVAIL
+
+ return consinfo
+
+
def _GetInstanceDiskFields():
"""Get instance fields involving disks.
_GetItemAttr("admin_up")),
(_MakeField("tags", "Tags", QFT_OTHER), IQ_CONFIG,
lambda ctx, inst: list(inst.GetTags())),
+ (_MakeField("console", "Console", QFT_OTHER), IQ_CONSOLE,
+ _GetInstanceConsole),
]
# Add simple fields