Commit 9ddb5e45 authored by Iustin Pop's avatar Iustin Pop
Browse files

node list: add the offline field

Reviewed-by: ultrotter
parent fc0fe88c
...@@ -1661,6 +1661,7 @@ class LUQueryNodes(NoHooksLU): ...@@ -1661,6 +1661,7 @@ class LUQueryNodes(NoHooksLU):
"serial_no", "serial_no",
"master_candidate", "master_candidate",
"master", "master",
"offline",
) )
def ExpandNames(self): def ExpandNames(self):
...@@ -1780,6 +1781,8 @@ class LUQueryNodes(NoHooksLU): ...@@ -1780,6 +1781,8 @@ class LUQueryNodes(NoHooksLU):
val = node.master_candidate val = node.master_candidate
elif field == "master": elif field == "master":
val = node.name == master_node val = node.name == master_node
elif field == "offline":
val = node.offline
elif self._FIELDS_DYNAMIC.Matches(field): elif self._FIELDS_DYNAMIC.Matches(field):
val = live_data[node.name].get(field, None) val = live_data[node.name].get(field, None)
else: else:
......
...@@ -54,6 +54,7 @@ _LIST_HEADERS = { ...@@ -54,6 +54,7 @@ _LIST_HEADERS = {
"serial_no": "SerialNo", "serial_no": "SerialNo",
"master_candidate": "MasterC", "master_candidate": "MasterC",
"master": "IsMaster", "master": "IsMaster",
"offline": "Offline",
} }
...@@ -138,7 +139,7 @@ def ListNodes(opts, args): ...@@ -138,7 +139,7 @@ def ListNodes(opts, args):
val = row[idx] val = row[idx]
if field in list_type_fields: if field in list_type_fields:
val = ",".join(val) val = ",".join(val)
elif field in ('master', 'master_candidate'): elif field in ('master', 'master_candidate', 'offline'):
if val: if val:
val = 'Y' val = 'Y'
else: else:
......
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