diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 9f3ab01425475bc3f2d8178974cf5573a0a04b79..98668b03a1ab8d325c55f742f032c4615f4a17cf 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -1753,7 +1753,7 @@ class LUQueryNodes(NoHooksLU): """Logical unit for querying nodes. """ - _OP_REQP = ["output_fields", "names"] + _OP_REQP = ["output_fields", "names", "use_locking"] REQ_BGL = False _FIELDS_DYNAMIC = utils.FieldSet( "dtotal", "dfree", @@ -1785,7 +1785,8 @@ class LUQueryNodes(NoHooksLU): else: self.wanted = locking.ALL_SET - self.do_locking = self._FIELDS_STATIC.NonMatching(self.op.output_fields) + self.do_node_query = self._FIELDS_STATIC.NonMatching(self.op.output_fields) + self.do_locking = self.do_node_query and self.op.use_locking if self.do_locking: # if we don't request only static fields, we need to lock the nodes self.needed_locks[locking.LEVEL_NODE] = self.wanted @@ -1820,7 +1821,7 @@ class LUQueryNodes(NoHooksLU): # begin data gathering - if self.do_locking: + if self.do_node_query: live_data = {} node_data = self.rpc.call_node_info(nodenames, self.cfg.GetVGName(), self.cfg.GetHypervisorType()) diff --git a/scripts/gnt-node b/scripts/gnt-node index e22592db6b667f795d92d29c998d6270f0db066b..8c5ad972331a45ce4d8775ad49ff6085c11f302a 100755 --- a/scripts/gnt-node +++ b/scripts/gnt-node @@ -119,7 +119,7 @@ def ListNodes(opts, args): else: selected_fields = opts.output.split(",") - output = GetClient().QueryNodes([], selected_fields, True) + output = GetClient().QueryNodes([], selected_fields, opts.do_locking) if not opts.no_headers: headers = _LIST_HEADERS @@ -495,7 +495,7 @@ commands = { "[<node_name>...]", "Show information about the node(s)"), 'list': (ListNodes, ARGS_NONE, [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT, - SUBMIT_OPT], + SUBMIT_OPT, SYNC_OPT], "", "Lists the nodes in the cluster. The available fields" " are (see the man page for details): %s" " The default field list is (in order): %s." %