diff --git a/lib/cmdlib.py b/lib/cmdlib.py index ee0e3b4565041ebafa11d27ec3734c20e706165f..e921553e583fb32f5a09074e5df32868776e37f6 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -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, diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster index bf160cdb0f0fd1c940be489c6bc8eb3591f16fcb..da982ceb73edc85604745a9568ebb50c1cbf96d0 100755 --- a/scripts/gnt-cluster +++ b/scripts/gnt-cluster @@ -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"], diff --git a/scripts/gnt-instance b/scripts/gnt-instance index 710fb4dab635fcd304214134a720302b8c293e9a..2b68d10a543a5b42414fc034cc2d8b72ff6b996b 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -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],