Revision aca13712

b/daemons/ganeti-noded
476 476
    """Query the list of running instances.
477 477

  
478 478
    """
479
    return backend.GetInstanceList(params[0])
479
    return True, backend.GetInstanceList(params[0])
480 480

  
481 481
  # node --------------------------
482 482

  
b/lib/backend.py
603 603
      names = hypervisor.GetHypervisor(hname).ListInstances()
604 604
      results.extend(names)
605 605
    except errors.HypervisorError, err:
606
      logging.exception("Error enumerating instances for hypevisor %s", hname)
607
      raise
606
      _Fail("Error enumerating instances (hypervisor %s): %s",
607
            hname, err, exc=True)
608 608

  
609 609
  return results
610 610

  
b/lib/cmdlib.py
2769 2769
  _ShutdownInstanceDisks.
2770 2770

  
2771 2771
  """
2772
  ins_l = lu.rpc.call_instance_list([instance.primary_node],
2773
                                      [instance.hypervisor])
2774
  ins_l = ins_l[instance.primary_node]
2775
  if ins_l.failed or not isinstance(ins_l.data, list):
2776
    raise errors.OpExecError("Can't contact node '%s'" %
2777
                             instance.primary_node)
2778

  
2779
  if instance.name in ins_l.data:
2772
  pnode = instance.primary_node
2773
  ins_l = lu.rpc.call_instance_list([pnode], [instance.hypervisor])
2774
  ins_l = ins_l[pnode]
2775
  msg = ins_l.RemoteFailMsg()
2776
  if msg:
2777
    raise errors.OpExecError("Can't contact node %s: %s" % (pnode, msg))
2778

  
2779
  if instance.name in ins_l.payload:
2780 2780
    raise errors.OpExecError("Instance is running, can't shutdown"
2781 2781
                             " block devices.")
2782 2782

  
......
3890 3890
                     " a bad state)")
3891 3891
    ins_l = self.rpc.call_instance_list(self.all_nodes, [instance.hypervisor])
3892 3892
    for node, result in ins_l.items():
3893
      result.Raise()
3894
      if not isinstance(result.data, list):
3895
        raise errors.OpExecError("Can't contact node '%s'" % node)
3893
      msg = result.RemoteFailMsg()
3894
      if msg:
3895
        raise errors.OpExecError("Can't contact node %s: %s" % (node, msg))
3896 3896

  
3897
    runningon_source = instance.name in ins_l[source_node].data
3898
    runningon_target = instance.name in ins_l[target_node].data
3897
    runningon_source = instance.name in ins_l[source_node].payload
3898
    runningon_target = instance.name in ins_l[target_node].payload
3899 3899

  
3900 3900
    if runningon_source and runningon_target:
3901 3901
      raise errors.OpExecError("Instance seems to be running on two nodes,"
......
5010 5010

  
5011 5011
    node_insts = self.rpc.call_instance_list([node],
5012 5012
                                             [instance.hypervisor])[node]
5013
    node_insts.Raise()
5013
    msg = node_insts.RemoteFailMsg()
5014
    if msg:
5015
      raise errors.OpExecError("Can't get node information from %s: %s" %
5016
                               (node, msg))
5014 5017

  
5015
    if instance.name not in node_insts.data:
5018
    if instance.name not in node_insts.payload:
5016 5019
      raise errors.OpExecError("Instance %s is not running." % instance.name)
5017 5020

  
5018 5021
    logging.debug("Connecting to console of %s on %s", instance.name, node)
......
6217 6220
                                     " an instance")
6218 6221
        ins_l = self.rpc.call_instance_list([pnode], [instance.hypervisor])
6219 6222
        ins_l = ins_l[pnode]
6220
        if ins_l.failed or not isinstance(ins_l.data, list):
6221
          raise errors.OpPrereqError("Can't contact node '%s'" % pnode)
6222
        if instance.name in ins_l.data:
6223
        msg = ins_l.RemoteFailMsg()
6224
        if msg:
6225
          raise errors.OpPrereqError("Can't contact node %s: %s" %
6226
                                     (pnode, msg))
6227
        if instance.name in ins_l.payload:
6223 6228
          raise errors.OpPrereqError("Instance is running, can't remove"
6224 6229
                                     " disks.")
6225 6230

  

Also available in: Unified diff