Revision 6b12959c

b/lib/cmdlib.py
1687 1687

  
1688 1688
    for instance_name in instance_list:
1689 1689
      instance = self.cfg.GetInstanceInfo(instance_name)
1690
      if node.name == instance.primary_node:
1691
        raise errors.OpPrereqError("Instance %s still running on the node,"
1692
                                   " please remove first." % instance_name)
1693
      if node.name in instance.secondary_nodes:
1694
        raise errors.OpPrereqError("Instance %s has node as a secondary,"
1690
      if node.name in instance.all_nodes:
1691
        raise errors.OpPrereqError("Instance %s is still running on the node,"
1695 1692
                                   " please remove first." % instance_name)
1696 1693
    self.op.node_name = node.name
1697 1694
    self.node = node
......
2592 2589
      "FORCE": self.op.force,
2593 2590
      }
2594 2591
    env.update(_BuildInstanceHookEnvByObject(self, self.instance))
2595
    nl = ([self.cfg.GetMasterNode(), self.instance.primary_node] +
2596
          list(self.instance.secondary_nodes))
2592
    nl = [self.cfg.GetMasterNode()] + list(self.instance.all_nodes)
2597 2593
    return env, nl, nl
2598 2594

  
2599 2595
  def CheckPrereq(self):
......
2665 2661
      "IGNORE_SECONDARIES": self.op.ignore_secondaries,
2666 2662
      }
2667 2663
    env.update(_BuildInstanceHookEnvByObject(self, self.instance))
2668
    nl = ([self.cfg.GetMasterNode(), self.instance.primary_node] +
2669
          list(self.instance.secondary_nodes))
2664
    nl = [self.cfg.GetMasterNode()] + list(self.instance.all_nodes)
2670 2665
    return env, nl, nl
2671 2666

  
2672 2667
  def CheckPrereq(self):
......
2733 2728

  
2734 2729
    """
2735 2730
    env = _BuildInstanceHookEnvByObject(self, self.instance)
2736
    nl = ([self.cfg.GetMasterNode(), self.instance.primary_node] +
2737
          list(self.instance.secondary_nodes))
2731
    nl = [self.cfg.GetMasterNode()] + list(self.instance.all_nodes)
2738 2732
    return env, nl, nl
2739 2733

  
2740 2734
  def CheckPrereq(self):
......
2781 2775

  
2782 2776
    """
2783 2777
    env = _BuildInstanceHookEnvByObject(self, self.instance)
2784
    nl = ([self.cfg.GetMasterNode(), self.instance.primary_node] +
2785
          list(self.instance.secondary_nodes))
2778
    nl = [self.cfg.GetMasterNode()] + list(self.instance.all_nodes)
2786 2779
    return env, nl, nl
2787 2780

  
2788 2781
  def CheckPrereq(self):
......
2866 2859
    """
2867 2860
    env = _BuildInstanceHookEnvByObject(self, self.instance)
2868 2861
    env["INSTANCE_NEW_NAME"] = self.op.new_name
2869
    nl = ([self.cfg.GetMasterNode(), self.instance.primary_node] +
2870
          list(self.instance.secondary_nodes))
2862
    nl = [self.cfg.GetMasterNode()] + list(self.instance.all_nodes)
2871 2863
    return env, nl, nl
2872 2864

  
2873 2865
  def CheckPrereq(self):
......
5185 5177
    instance = self.cfg.GetInstanceInfo(self.op.instance_name)
5186 5178
    assert instance is not None, \
5187 5179
      "Cannot retrieve locked instance %s" % self.op.instance_name
5188
    _CheckNodeOnline(self, instance.primary_node)
5189
    for node in instance.secondary_nodes:
5180
    nodenames = list(instance.all_nodes)
5181
    for node in nodenames:
5190 5182
      _CheckNodeOnline(self, node)
5191 5183

  
5192 5184

  
......
5198 5190

  
5199 5191
    self.disk = instance.FindDisk(self.op.disk)
5200 5192

  
5201
    nodenames = [instance.primary_node] + list(instance.secondary_nodes)
5202 5193
    nodeinfo = self.rpc.call_node_info(nodenames, self.cfg.GetVGName(),
5203 5194
                                       instance.hypervisor)
5204 5195
    for node in nodenames:
......
5221 5212
    """
5222 5213
    instance = self.instance
5223 5214
    disk = self.disk
5224
    for node in (instance.secondary_nodes + (instance.primary_node,)):
5215
    for node in instance.all_nodes:
5225 5216
      self.cfg.SetDiskID(disk, node)
5226 5217
      result = self.rpc.call_blockdev_grow(node, disk, self.op.amount)
5227 5218
      result.Raise()
......
5500 5491
      args['vcpus'] = self.be_new[constants.BE_VCPUS]
5501 5492
    # FIXME: readd disk/nic changes
5502 5493
    env = _BuildInstanceHookEnvByObject(self, self.instance, override=args)
5503
    nl = [self.cfg.GetMasterNode(),
5504
          self.instance.primary_node] + list(self.instance.secondary_nodes)
5494
    nl = [self.cfg.GetMasterNode()] + list(self.instance.all_nodes)
5505 5495
    return env, nl, nl
5506 5496

  
5507 5497
  def CheckPrereq(self):
......
5517 5507
    instance = self.instance = self.cfg.GetInstanceInfo(self.op.instance_name)
5518 5508
    assert self.instance is not None, \
5519 5509
      "Cannot retrieve locked instance %s" % self.op.instance_name
5520
    pnode = self.instance.primary_node
5521
    nodelist = [pnode]
5522
    nodelist.extend(instance.secondary_nodes)
5510
    pnode = instance.primary_node
5511
    nodelist = list(instance.all_nodes)
5523 5512

  
5524 5513
    # hvparams processing
5525 5514
    if self.op.hvparams:
......
6367 6356
        "vcpus": beinfo[constants.BE_VCPUS],
6368 6357
        "memory": beinfo[constants.BE_MEMORY],
6369 6358
        "os": iinfo.os,
6370
        "nodes": [iinfo.primary_node] + list(iinfo.secondary_nodes),
6359
        "nodes": list(iinfo.all_nodes),
6371 6360
        "nics": nic_data,
6372 6361
        "disks": [{"size": dsk.size, "mode": "w"} for dsk in iinfo.disks],
6373 6362
        "disk_template": iinfo.disk_template,

Also available in: Unified diff