Revision b94590c6

b/lib/cmdlib.py
5670 5670
    """
5671 5671
    self.iallocator = getattr(self.op, "iallocator", None)
5672 5672
    self.target_node = getattr(self.op, "target_node", None)
5673
    _CheckIAllocatorOrNode(self, "iallocator", "target_node")
5674 5673

  
5675 5674
  def ExpandNames(self):
5676 5675
    self._ExpandAndLockInstance()
......
5738 5737
                                 errors.ECODE_STATE)
5739 5738

  
5740 5739
    if instance.disk_template in constants.DTS_EXT_MIRROR:
5740
      _CheckIAllocatorOrNode(self, "iallocator", "target_node")
5741 5741
      if self.op.iallocator:
5742 5742
        self._RunAllocator()
5743 5743
        # Release all unnecessary node locks
......
5759 5759
                                        instance.disk_template)
5760 5760
      target_node = secondary_nodes[0]
5761 5761

  
5762
      if self.op.iallocator or (self.op.target_node and
5763
                                self.op.target_node != target_node):
5764
        raise errors.OpPrereqError("Instances with disk template %s cannot"
5765
                                   " be failed over to arbitrary nodes"
5766
                                   " (neither an iallocator nor a target"
5767
                                   " node can be passed)" %
5768
                                   instance.disk_template, errors.ECODE_INVAL)
5762 5769
    _CheckNodeOnline(self, target_node)
5763 5770
    _CheckNodeNotDrained(self, target_node)
5764 5771

  
......
5888 5895
  HTYPE = constants.HTYPE_INSTANCE
5889 5896
  REQ_BGL = False
5890 5897

  
5891
  def CheckArguments(self):
5892
    _CheckIAllocatorOrNode(self, "iallocator", "target_node")
5893

  
5894 5898
  def ExpandNames(self):
5895 5899
    self._ExpandAndLockInstance()
5896 5900

  
......
6226 6230
                                 errors.ECODE_STATE)
6227 6231

  
6228 6232
    if instance.disk_template in constants.DTS_EXT_MIRROR:
6229
      if [self.iallocator, self.target_node].count(None) != 1:
6230
        raise errors.OpPrereqError("Do not specify both, iallocator and"
6231
                                   " target node", errors.ECODE_INVAL)
6233
      _CheckIAllocatorOrNode(self.lu, "iallocator", "target_node")
6232 6234

  
6233 6235
      if self.iallocator:
6234 6236
        self._RunAllocator()
......
6252 6254
                                        " %s disk template" %
6253 6255
                                        instance.disk_template)
6254 6256
      target_node = secondary_nodes[0]
6257
      if self.lu.op.iallocator or (self.lu.op.target_node and
6258
                                   self.lu.op.target_node != target_node):
6259
        raise errors.OpPrereqError("Instances with disk template %s cannot"
6260
                                   " be migrated over to arbitrary nodes"
6261
                                   " (neither an iallocator nor a target"
6262
                                   " node can be passed)" %
6263
                                   instance.disk_template, errors.ECODE_INVAL)
6255 6264

  
6256 6265
    i_be = self.cfg.GetClusterInfo().FillBE(instance)
6257 6266

  

Also available in: Unified diff