Revision db8e5f1c lib/cmdlib.py

b/lib/cmdlib.py
8422 8422
                                 (node_name, self.instance.name))
8423 8423

  
8424 8424
  def _CreateNewStorage(self, node_name):
8425
    """Create new storage on the primary or secondary node.
8426

  
8427
    This is only used for same-node replaces, not for changing the
8428
    secondary node, hence we don't want to modify the existing disk.
8429

  
8430
    """
8425 8431
    iv_names = {}
8426 8432

  
8427 8433
    for idx, dev in enumerate(self.instance.disks):
......
8443 8449
                             logical_id=(vg_meta, names[1]))
8444 8450

  
8445 8451
      new_lvs = [lv_data, lv_meta]
8446
      old_lvs = dev.children
8452
      old_lvs = [child.Copy() for child in dev.children]
8447 8453
      iv_names[dev.iv_name] = (dev, old_lvs, new_lvs)
8448 8454

  
8449 8455
      # we pass force_create=True to force the LVM creation
......
8568 8574
                                             rename_new_to_old)
8569 8575
      result.Raise("Can't rename new LVs on node %s" % self.target_node)
8570 8576

  
8577
      # Intermediate steps of in memory modifications
8571 8578
      for old, new in zip(old_lvs, new_lvs):
8572 8579
        new.logical_id = old.logical_id
8573 8580
        self.cfg.SetDiskID(new, self.target_node)
8574 8581

  
8582
      # We need to modify old_lvs so that removal later removes the
8583
      # right LVs, not the newly added ones; note that old_lvs is a
8584
      # copy here
8575 8585
      for disk in old_lvs:
8576 8586
        disk.logical_id = ren_fn(disk, temp_suffix)
8577 8587
        self.cfg.SetDiskID(disk, self.target_node)
......
8591 8601
                                     "volumes"))
8592 8602
        raise errors.OpExecError("Can't add local storage to drbd: %s" % msg)
8593 8603

  
8594
      dev.children = new_lvs
8595

  
8596
      self.cfg.Update(self.instance, feedback_fn)
8597

  
8598 8604
    cstep = 5
8599 8605
    if self.early_release:
8600 8606
      self.lu.LogStep(cstep, steps_total, "Removing old storage")

Also available in: Unified diff