Revision ec223efb scripts/gnt-node
b/scripts/gnt-node | ||
---|---|---|
41 | 41 |
if opts.output is None: |
42 | 42 |
selected_fields = ["name", "dtotal", "dfree", |
43 | 43 |
"mtotal", "mnode", "mfree", |
44 |
"pinst", "sinst"]
|
|
44 |
"pinst_cnt", "sinst_cnt"]
|
|
45 | 45 |
else: |
46 | 46 |
selected_fields = opts.output.split(",") |
47 | 47 |
|
48 |
op = opcodes.OpQueryNodes(output_fields=selected_fields) |
|
48 |
op = opcodes.OpQueryNodes(output_fields=selected_fields, nodes=[])
|
|
49 | 49 |
output = SubmitOpCode(op) |
50 | 50 |
|
51 | 51 |
if not opts.no_headers: |
52 |
headers = {"name": "Node", "pinst": "Pinst", "sinst": "Sinst", |
|
52 |
headers = {"name": "Node", "pinst_cnt": "Pinst", "sinst_cnt": "Sinst", |
|
53 |
"pinst_list": "PriInstances", "sinst_list": "SecInstances", |
|
53 | 54 |
"pip": "PrimaryIP", "sip": "SecondaryIP", |
54 | 55 |
"dtotal": "DTotal", "dfree": "DFree", |
55 | 56 |
"mtotal": "MTotal", "mnode": "MNode", "mfree": "MFree"} |
... | ... | |
61 | 62 |
else: |
62 | 63 |
unitfields = None |
63 | 64 |
|
64 |
numfields = ["dtotal", "dfree", "mtotal", "mnode", "mfree", "pinst", "sinst"] |
|
65 |
numfields = ["dtotal", "dfree", |
|
66 |
"mtotal", "mnode", "mfree", |
|
67 |
"pinst_cnt", "sinst_cnt"] |
|
68 |
|
|
69 |
# change raw values to nicer strings |
|
70 |
for row in output: |
|
71 |
for idx, field in enumerate(selected_fields): |
|
72 |
val = row[idx] |
|
73 |
if field == "pinst_list": |
|
74 |
val = ",".join(val) |
|
75 |
elif field == "sinst_list": |
|
76 |
val = ",".join(val) |
|
77 |
elif val is None: |
|
78 |
val = "?" |
|
79 |
row[idx] = str(val) |
|
65 | 80 |
|
66 | 81 |
data = GenerateTable(separator=opts.separator, headers=headers, |
67 | 82 |
fields=selected_fields, unitfields=unitfields, |
Also available in: Unified diff