1120 |
1120 |
_FormatList(buf, elem, indent_level+1)
|
1121 |
1121 |
|
1122 |
1122 |
|
1123 |
|
def _FormatParameterDict(buf, per_inst, actual):
|
1124 |
|
"""Formats a parameter dictionary.
|
1125 |
|
|
1126 |
|
@type buf: L{StringIO}
|
1127 |
|
@param buf: the buffer into which to write
|
1128 |
|
@type per_inst: dict
|
1129 |
|
@param per_inst: the instance's own parameters
|
1130 |
|
@type actual: dict
|
1131 |
|
@param actual: the current parameter set (including defaults)
|
1132 |
|
|
1133 |
|
"""
|
1134 |
|
for key in sorted(actual):
|
1135 |
|
val = per_inst.get(key, "default (%s)" % actual[key])
|
1136 |
|
buf.write(" - %s: %s\n" % (key, val))
|
1137 |
|
|
1138 |
1123 |
def ShowInstanceConfig(opts, args):
|
1139 |
1124 |
"""Compute instance run-time status.
|
1140 |
1125 |
|
... | ... | |
1183 |
1168 |
buf.write(" - primary: %s\n" % instance["pnode"])
|
1184 |
1169 |
buf.write(" - secondaries: %s\n" % utils.CommaJoin(instance["snodes"]))
|
1185 |
1170 |
buf.write(" Operating system: %s\n" % instance["os"])
|
1186 |
|
_FormatParameterDict(buf, instance["os_instance"], instance["os_actual"])
|
|
1171 |
FormatParameterDict(buf, instance["os_instance"], instance["os_actual"],
|
|
1172 |
level=2)
|
1187 |
1173 |
if instance.has_key("network_port"):
|
1188 |
1174 |
buf.write(" Allocated network port: %s\n" %
|
1189 |
1175 |
compat.TryToRoman(instance["network_port"],
|
... | ... | |
1210 |
1196 |
vnc_bind_address)
|
1211 |
1197 |
buf.write(" - console connection: vnc to %s\n" % vnc_console_port)
|
1212 |
1198 |
|
1213 |
|
_FormatParameterDict(buf, instance["hv_instance"], instance["hv_actual"])
|
|
1199 |
FormatParameterDict(buf, instance["hv_instance"], instance["hv_actual"],
|
|
1200 |
level=2)
|
1214 |
1201 |
buf.write(" Hardware:\n")
|
1215 |
1202 |
buf.write(" - VCPUs: %s\n" %
|
1216 |
1203 |
compat.TryToRoman(instance["be_actual"][constants.BE_VCPUS],
|