Commit dbb24ec7 authored by Iustin Pop's avatar Iustin Pop
Browse files

Show OS parameters in cluster/instance info


Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 1bdcbbab
......@@ -3778,6 +3778,7 @@ class LUQueryClusterInfo(NoHooksLU):
for hypervisor_name in cluster.enabled_hypervisors]),
"os_hvp": os_hvp,
"beparams": cluster.beparams,
"osparams": cluster.osparams,
"nicparams": cluster.nicparams,
"candidate_pool_size": cluster.candidate_pool_size,
"master_netdev": cluster.master_netdev,
......@@ -8250,6 +8251,8 @@ class LUQueryInstanceData(NoHooksLU):
"hv_actual": cluster.FillHV(instance, skip_globals=True),
"be_instance": instance.beparams,
"be_actual": cluster.FillBE(instance),
"os_instance": instance.osparams,
"os_actual": cluster.SimpleFillOS(instance.os, instance.osparams),
"serial_no": instance.serial_no,
"mtime": instance.mtime,
"ctime": instance.ctime,
......
......@@ -274,9 +274,12 @@ def ShowClusterConfig(opts, args):
ToStdout("Hypervisor parameters:")
_PrintGroupedParams(result["hvparams"])
ToStdout("OS specific hypervisor parameters:")
ToStdout("OS-specific hypervisor parameters:")
_PrintGroupedParams(result["os_hvp"])
ToStdout("OS parameters:")
_PrintGroupedParams(result["osparams"])
ToStdout("Cluster parameters:")
ToStdout(" - candidate pool size: %s",
compat.TryToRoman(result["candidate_pool_size"],
......
......@@ -1111,6 +1111,21 @@ def _FormatList(buf, data, indent_level):
_FormatList(buf, elem, indent_level+1)
def _FormatParameterDict(buf, per_inst, actual):
"""Formats a parameter dictionary.
@type buf: L{StringIO}
@param buf: the buffer into which to write
@type per_inst: dict
@param per_inst: the instance's own parameters
@type actual: dict
@param actual: the current parameter set (including defaults)
"""
for key in sorted(actual):
val = per_inst.get(key, "default (%s)" % actual[key])
buf.write(" - %s: %s\n" % (key, val))
def ShowInstanceConfig(opts, args):
"""Compute instance run-time status.
......@@ -1159,6 +1174,7 @@ def ShowInstanceConfig(opts, args):
buf.write(" - primary: %s\n" % instance["pnode"])
buf.write(" - secondaries: %s\n" % utils.CommaJoin(instance["snodes"]))
buf.write(" Operating system: %s\n" % instance["os"])
_FormatParameterDict(buf, instance["os_instance"], instance["os_actual"])
if instance.has_key("network_port"):
buf.write(" Allocated network port: %s\n" %
compat.TryToRoman(instance["network_port"],
......@@ -1185,12 +1201,7 @@ def ShowInstanceConfig(opts, args):
vnc_bind_address)
buf.write(" - console connection: vnc to %s\n" % vnc_console_port)
for key in sorted(instance["hv_actual"]):
if key in instance["hv_instance"]:
val = instance["hv_instance"][key]
else:
val = "default (%s)" % instance["hv_actual"][key]
buf.write(" - %s: %s\n" % (key, val))
_FormatParameterDict(buf, instance["hv_instance"], instance["hv_actual"])
buf.write(" Hardware:\n")
buf.write(" - VCPUs: %s\n" %
compat.TryToRoman(instance["be_actual"][constants.BE_VCPUS],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment