Revision 94a1b377 lib/cmdlib.py

b/lib/cmdlib.py
6360 6360

  
6361 6361
    self.replacer = TLReplaceDisks(self, self.op.instance_name, self.op.mode,
6362 6362
                                   self.op.iallocator, self.op.remote_node,
6363
                                   self.op.disks)
6363
                                   self.op.disks, False)
6364 6364

  
6365 6365
    self.tasklets = [self.replacer]
6366 6366

  
......
6452 6452
      names.append(inst.name)
6453 6453

  
6454 6454
      replacer = TLReplaceDisks(self, inst.name, constants.REPLACE_DISK_CHG,
6455
                                self.op.iallocator, self.op.remote_node, [])
6455
                                self.op.iallocator, self.op.remote_node, [],
6456
                                True)
6456 6457
      tasklets.append(replacer)
6457 6458

  
6458 6459
    self.tasklets = tasklets
......
6494 6495

  
6495 6496
  """
6496 6497
  def __init__(self, lu, instance_name, mode, iallocator_name, remote_node,
6497
               disks):
6498
               disks, delay_iallocator):
6498 6499
    """Initializes this class.
6499 6500

  
6500 6501
    """
......
6506 6507
    self.iallocator_name = iallocator_name
6507 6508
    self.remote_node = remote_node
6508 6509
    self.disks = disks
6510
    self.delay_iallocator = delay_iallocator
6509 6511

  
6510 6512
    # Runtime data
6511 6513
    self.instance = None
......
6592 6594
                                 len(instance.secondary_nodes),
6593 6595
                                 errors.ECODE_FAULT)
6594 6596

  
6597
    if not self.delay_iallocator:
6598
      self._CheckPrereq2()
6599

  
6600
  def _CheckPrereq2(self):
6601
    """Check prerequisites, second part.
6602

  
6603
    This function should always be part of CheckPrereq. It was separated and is
6604
    now called from Exec because during node evacuation iallocator was only
6605
    called with an unmodified cluster model, not taking planned changes into
6606
    account.
6607

  
6608
    """
6609
    instance = self.instance
6595 6610
    secondary_node = instance.secondary_nodes[0]
6596 6611

  
6597 6612
    if self.iallocator_name is None:
......
6695 6710
    This dispatches the disk replacement to the appropriate handler.
6696 6711

  
6697 6712
    """
6713
    if self.delay_iallocator:
6714
      self._CheckPrereq2()
6715

  
6698 6716
    if not self.disks:
6699 6717
      feedback_fn("No disks need replacement")
6700 6718
      return

Also available in: Unified diff