Revision bc8e4a1a

b/lib/cmdlib.py
1753 1753
  """Logical unit for querying nodes.
1754 1754

  
1755 1755
  """
1756
  _OP_REQP = ["output_fields", "names"]
1756
  _OP_REQP = ["output_fields", "names", "use_locking"]
1757 1757
  REQ_BGL = False
1758 1758
  _FIELDS_DYNAMIC = utils.FieldSet(
1759 1759
    "dtotal", "dfree",
......
1785 1785
    else:
1786 1786
      self.wanted = locking.ALL_SET
1787 1787

  
1788
    self.do_locking = self._FIELDS_STATIC.NonMatching(self.op.output_fields)
1788
    self.do_node_query = self._FIELDS_STATIC.NonMatching(self.op.output_fields)
1789
    self.do_locking = self.do_node_query and self.op.use_locking
1789 1790
    if self.do_locking:
1790 1791
      # if we don't request only static fields, we need to lock the nodes
1791 1792
      self.needed_locks[locking.LEVEL_NODE] = self.wanted
......
1820 1821

  
1821 1822
    # begin data gathering
1822 1823

  
1823
    if self.do_locking:
1824
    if self.do_node_query:
1824 1825
      live_data = {}
1825 1826
      node_data = self.rpc.call_node_info(nodenames, self.cfg.GetVGName(),
1826 1827
                                          self.cfg.GetHypervisorType())
b/scripts/gnt-node
119 119
  else:
120 120
    selected_fields = opts.output.split(",")
121 121

  
122
  output = GetClient().QueryNodes([], selected_fields, True)
122
  output = GetClient().QueryNodes([], selected_fields, opts.do_locking)
123 123

  
124 124
  if not opts.no_headers:
125 125
    headers = _LIST_HEADERS
......
495 495
           "[<node_name>...]", "Show information about the node(s)"),
496 496
  'list': (ListNodes, ARGS_NONE,
497 497
           [DEBUG_OPT, NOHDR_OPT, SEP_OPT, USEUNITS_OPT, FIELDS_OPT,
498
            SUBMIT_OPT],
498
            SUBMIT_OPT, SYNC_OPT],
499 499
           "", "Lists the nodes in the cluster. The available fields"
500 500
           " are (see the man page for details): %s"
501 501
           " The default field list is (in order): %s." %

Also available in: Unified diff