Revision d8052456
b/lib/cmdlib.py | ||
---|---|---|
2418 | 2418 |
This checks that the fields required are valid output fields. |
2419 | 2419 |
|
2420 | 2420 |
""" |
2421 |
self.dynamic_fields = frozenset(["oper_state", "oper_ram"]) |
|
2421 |
self.dynamic_fields = frozenset(["oper_state", "oper_ram", "status"])
|
|
2422 | 2422 |
_CheckOutputFields(static=["name", "os", "pnode", "snodes", |
2423 | 2423 |
"admin_state", "admin_ram", |
2424 | 2424 |
"disk_template", "ip", "mac", "bridge", |
... | ... | |
2475 | 2475 |
val = None |
2476 | 2476 |
else: |
2477 | 2477 |
val = bool(live_data.get(instance.name)) |
2478 |
elif field == "status": |
|
2479 |
if instance.primary_node in bad_nodes: |
|
2480 |
val = "ERROR_nodedown" |
|
2481 |
else: |
|
2482 |
running = bool(live_data.get(instance.name)) |
|
2483 |
if running: |
|
2484 |
if instance.status != "down": |
|
2485 |
val = "running" |
|
2486 |
else: |
|
2487 |
val = "ERROR_up" |
|
2488 |
else: |
|
2489 |
if instance.status != "down": |
|
2490 |
val = "ERROR_down" |
|
2491 |
else: |
|
2492 |
val = "ADMIN_down" |
|
2478 | 2493 |
elif field == "admin_ram": |
2479 | 2494 |
val = instance.memory |
2480 | 2495 |
elif field == "oper_ram": |
b/man/gnt-instance.sgml | ||
---|---|---|
405 | 405 |
<varlistentry> |
406 | 406 |
<term>oper_state</term> |
407 | 407 |
<listitem> |
408 |
<simpara>the actual state of the instance; can take of |
|
409 |
the values "running", "stopped", "(node down)"</simpara> |
|
408 |
<simpara>the actual state of the instance; can be |
|
409 |
one of the values "running", "stopped", "(node |
|
410 |
down)"</simpara> |
|
411 |
</listitem> |
|
412 |
</varlistentry> |
|
413 |
<varlistentry> |
|
414 |
<term>status</term> |
|
415 |
<listitem> |
|
416 |
<simpara>combined form of admin_state and oper_stat; |
|
417 |
this can be one of: |
|
418 |
<computeroutput>ERROR_nodedown</computeroutput> if the |
|
419 |
node of the instance is down, |
|
420 |
<computeroutput>ERROR_down</computeroutput> if the |
|
421 |
instance should run but is down, |
|
422 |
<computeroutput>ERROR_up</computeroutput> if the |
|
423 |
instance should be stopped but is actually running, |
|
424 |
<computeroutput>ADMIN_down</computeroutput> if the |
|
425 |
instance has been stopped (and is stopped) and |
|
426 |
<computeroutput>running</computeroutput> if the |
|
427 |
instance is set to be running (and is |
|
428 |
running)</simpara> |
|
410 | 429 |
</listitem> |
411 | 430 |
</varlistentry> |
412 | 431 |
<varlistentry> |
b/scripts/gnt-instance | ||
---|---|---|
162 | 162 |
|
163 | 163 |
""" |
164 | 164 |
if opts.output is None: |
165 |
selected_fields = ["name", "os", "pnode", "admin_state", |
|
166 |
"oper_state", "oper_ram"] |
|
165 |
selected_fields = ["name", "os", "pnode", "status", "oper_ram"] |
|
167 | 166 |
else: |
168 | 167 |
selected_fields = opts.output.split(",") |
169 | 168 |
|
... | ... | |
171 | 170 |
output = SubmitOpCode(op) |
172 | 171 |
|
173 | 172 |
if not opts.no_headers: |
174 |
headers = {"name": "Instance", "os": "OS", "pnode": "Primary_node", |
|
175 |
"snodes": "Secondary_Nodes", "admin_state": "Autostart", |
|
176 |
"oper_state": "Status", "admin_ram": "Configured_memory", |
|
177 |
"oper_ram": "Memory", "disk_template": "Disk_template", |
|
178 |
"ip": "IP Address", "mac": "MAC Address", |
|
179 |
"bridge": "Bridge", "vcpus": "VCPUs", |
|
180 |
"sda_size": "Disk/0", "sdb_size": "Disk/1"} |
|
173 |
headers = { |
|
174 |
"name": "Instance", "os": "OS", "pnode": "Primary_node", |
|
175 |
"snodes": "Secondary_Nodes", "admin_state": "Autostart", |
|
176 |
"oper_state": "Running", "admin_ram": "Configured_memory", |
|
177 |
"oper_ram": "Memory", "disk_template": "Disk_template", |
|
178 |
"ip": "IP Address", "mac": "MAC Address", |
|
179 |
"bridge": "Bridge", "vcpus": "VCPUs", |
|
180 |
"sda_size": "Disk/0", "sdb_size": "Disk/1", |
|
181 |
"status": "Status", |
|
182 |
} |
|
181 | 183 |
else: |
182 | 184 |
headers = None |
183 | 185 |
|
... | ... | |
810 | 812 |
'info': (ShowInstanceConfig, ARGS_ANY, [DEBUG_OPT], "[<instance>...]", |
811 | 813 |
"Show information on the specified instance"), |
812 | 814 |
'list': (ListInstances, ARGS_NONE, |
813 |
[DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT], |
|
814 |
"", "Lists the instances and their status. The available fields"
|
|
815 |
" are (see the man page for details): oper_state, oper_ram,"
|
|
815 |
[DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT], "",
|
|
816 |
"Lists the instances and their status. The available fields are"
|
|
817 |
" (see the man page for details): status, oper_state, oper_ram,"
|
|
816 | 818 |
" name, os, pnode, snodes, admin_state, admin_ram, disk_template," |
817 | 819 |
" ip, mac, bridge, sda_size, sdb_size, vcpus. The default field" |
818 |
" list is (in order): name, os, pnode, admin_state, oper_state,"
|
|
820 |
" list is (in order): name, os, pnode, status,"
|
|
819 | 821 |
" oper_ram."), |
820 | 822 |
'reinstall': (ReinstallInstance, ARGS_ONE, [DEBUG_OPT, FORCE_OPT, os_opt], |
821 | 823 |
"[-f] <instance>", "Reinstall the instance"), |
Also available in: Unified diff