Revision bc57fa8d

b/lib/cli.py
2872 2872

  
2873 2873
  # This ensures we're running on the master daemon
2874 2874
  cl = GetClient()
2875
  # Query client
2876
  qcl = GetClient(query=True)
2875 2877

  
2876 2878
  (cluster_name, master_node) = \
2877 2879
    cl.QueryConfigValues(["cluster_name", "master_node"])
2878 2880

  
2879
  online_nodes = GetOnlineNodes([], cl=cl)
2880
  ssh_ports = GetNodesSshPorts(online_nodes, cl)
2881
  online_nodes = GetOnlineNodes([], cl=qcl)
2882
  ssh_ports = GetNodesSshPorts(online_nodes, qcl)
2881 2883

  
2882 2884
  # Don't keep a reference to the client. The master daemon will go away.
2883 2885
  del cl
2886
  del qcl
2884 2887

  
2885 2888
  assert master_node in online_nodes
2886 2889

  
......
3491 3494

  
3492 3495
  """
3493 3496
  if cl is None:
3494
    cl = GetClient()
3497
    cl = GetClient(query=True)
3495 3498

  
3496 3499
  qfilter = []
3497 3500

  
b/lib/client/gnt_cluster.py
570 570
                               errors.ECODE_INVAL)
571 571

  
572 572
  cl = GetClient()
573
  qcl = GetClient(query=True)
573 574
  try:
574 575
    cluster_name = cl.QueryConfigValues(["cluster_name"])[0]
575 576

  
576
    results = GetOnlineNodes(nodes=opts.nodes, cl=cl, filter_master=True,
577
    results = GetOnlineNodes(nodes=opts.nodes, cl=qcl, filter_master=True,
577 578
                             secondary_ips=opts.use_replication_network,
578 579
                             nodegroup=opts.nodegroup)
579
    ports = GetNodesSshPorts(opts.nodes, cl)
580
    ports = GetNodesSshPorts(opts.nodes, qcl)
580 581
  finally:
581 582
    cl.Close()
583
    qcl.Close()
582 584

  
583 585
  srun = ssh.SshRunner(cluster_name)
584 586
  for (node, port) in zip(results, ports):
......
599 601

  
600 602
  """
601 603
  cl = GetClient()
604
  qcl = GetClient(query=True)
602 605

  
603 606
  command = " ".join(args)
604 607

  
605
  nodes = GetOnlineNodes(nodes=opts.nodes, cl=cl, nodegroup=opts.nodegroup)
606
  ports = GetNodesSshPorts(nodes, cl)
608
  nodes = GetOnlineNodes(nodes=opts.nodes, cl=qcl, nodegroup=opts.nodegroup)
609
  ports = GetNodesSshPorts(nodes, qcl)
607 610

  
608 611
  cluster_name, master_node = cl.QueryConfigValues(["cluster_name",
609 612
                                                    "master_node"])
......
1520 1523
    return constants.EXIT_FAILURE
1521 1524

  
1522 1525

  
1523
def Epo(opts, args, cl=None, _on_fn=_EpoOn, _off_fn=_EpoOff,
1526
def Epo(opts, args, cl=None, qcl=None, _on_fn=_EpoOn, _off_fn=_EpoOff,
1524 1527
        _confirm_fn=ConfirmOperation,
1525 1528
        _stdout_fn=ToStdout, _stderr_fn=ToStderr):
1526 1529
  """EPO operations.
......
1541 1544

  
1542 1545
  if cl is None:
1543 1546
    cl = GetClient()
1547
  if qcl is None:
1548
    # Query client
1549
    qcl = GetClient(query=True)
1544 1550

  
1545 1551
  if opts.groups:
1546 1552
    node_query_list = \
......
1548 1554
  else:
1549 1555
    node_query_list = args
1550 1556

  
1551
  result = cl.QueryNodes(node_query_list, ["name", "master", "pinst_list",
1552
                                           "sinst_list", "powered", "offline"],
1553
                         False)
1557
  result = qcl.QueryNodes(node_query_list, ["name", "master", "pinst_list",
1558
                                            "sinst_list", "powered", "offline"],
1559
                          False)
1554 1560

  
1555 1561
  all_nodes = map(compat.fst, result)
1556 1562
  node_list = []
b/lib/client/gnt_node.py
232 232

  
233 233
  """
234 234
  cl = GetClient()
235
  query_cl = GetClient(query=True)
235 236
  node = netutils.GetHostname(name=args[0]).name
236 237
  readd = opts.readd
237 238

  
......
247 248
    pass
248 249

  
249 250
  try:
250
    output = cl.QueryNodes(names=[node],
251
                           fields=["name", "sip", "master", "ndp/ssh_port"],
252
                           use_locking=False)
251
    output = query_cl.QueryNodes(names=[node],
252
                                 fields=["name", "sip", "master",
253
                                         "ndp/ssh_port"],
254
                                 use_locking=False)
253 255
    node_exists, sip, is_master, ssh_port = output[0]
254 256
  except (errors.OpPrereqError, errors.OpExecError):
255 257
    node_exists = ""
......
438 440
  # these fields are static data anyway, so it doesn't matter, but
439 441
  # locking=True should be safer
440 442
  qcl = GetClient(query=True)
441
  result = cl.QueryNodes(names=args, fields=selected_fields,
442
                         use_locking=False)
443
  result = qcl.QueryNodes(names=args, fields=selected_fields,
444
                          use_locking=False)
443 445
  qcl.Close()
444 446
  node, pinst = result[0]
445 447

  
......
480 482
  selected_fields = ["name", "pinst_list"]
481 483

  
482 484
  qcl = GetClient(query=True)
483
  result = cl.QueryNodes(names=args, fields=selected_fields, use_locking=False)
485
  result = qcl.QueryNodes(names=args, fields=selected_fields, use_locking=False)
484 486
  qcl.Close()
485 487
  ((node, pinst), ) = result
486 488

  
b/lib/rapi/rlib2.py
901 901
    """Returns a list of all available instances.
902 902

  
903 903
    """
904
    client = self.GetClient()
904
    client = self.GetClient(query=True)
905 905

  
906 906
    use_locking = self.useLocking()
907 907
    if self.useBulk():
......
981 981
    """Send information about an instance.
982 982

  
983 983
    """
984
    client = self.GetClient()
984
    client = self.GetClient(query=True)
985 985
    instance_name = self.items[0]
986 986

  
987 987
    result = baserlib.HandleItemQueryErrors(client.QueryInstances,
......
1411 1411
  PUT_OPCODE = opcodes.OpQuery
1412 1412

  
1413 1413
  def _Query(self, fields, qfilter):
1414
    return self.GetClient().Query(self.items[0], fields, qfilter).ToDict()
1414
    client = self.GetClient()
1415
    return client.Query(self.items[0], fields, qfilter).ToDict()
1415 1416

  
1416 1417
  def GET(self):
1417 1418
    """Returns resource information.
b/test/py/ganeti.client.gnt_cluster_unittest.py
216 216

  
217 217
      off_fn = compat.partial(self._Off, ["node1.example.com"])
218 218

  
219
      result = self._Test(opts, [], cl=client, _off_fn=off_fn,
219
      result = self._Test(opts, [], cl=client, qcl=client, _off_fn=off_fn,
220 220
                          _confirm_fn=confirm_fn)
221 221
      if force or confirm_result:
222 222
        self.assertEqual(result, self._OFF_EXITCODE)
......
246 246
        self.assertFalse(inst_map)
247 247
        return self._ON_EXITCODE
248 248

  
249
      result = self._Test(opts, [], cl=client, _on_fn=_On,
249
      result = self._Test(opts, [], cl=client, qcl=client, _on_fn=_On,
250 250
                          _confirm_fn=self._ConfirmForce)
251 251
      self.assertEqual(result, self._ON_EXITCODE)
252 252

  
......
256 256
    client = _ClientForEpo(NotImplemented, [
257 257
      ("node1.example.com", True, [], [], True, False),
258 258
      ])
259
    result = self._Test(opts, [], cl=client, _confirm_fn=self._ConfirmForce)
259
    result = self._Test(opts, [], cl=client, qcl=client,
260
                        _confirm_fn=self._ConfirmForce)
260 261
    self.assertEqual(result, constants.EXIT_FAILURE)
261 262

  
262 263

  

Also available in: Unified diff