Revision 468b46f9

b/lib/cmdlib.py
4011 4011
                                 pri_node)
4012 4012

  
4013 4013
    # Step: create new storage
4014

  
4015
    minors = [None for dev in instance.disks]
4016
    logging.debug("Allocated minors %s" % (minors,))
4017 4014
    self.proc.LogStep(3, steps_total, "allocate new storage")
4018
    for idx, dev in enumerate(instance.disks):
4015
    for dev in instance.disks:
4019 4016
      size = dev.size
4020 4017
      info("adding new local storage on %s for %s" % (new_node, dev.iv_name))
4021 4018
      # since we *always* want to create this LV, we use the
......
4028 4025
                                   " node '%s'" %
4029 4026
                                   (new_lv.logical_id[1], new_node))
4030 4027

  
4031
      iv_names[dev.iv_name] = (dev, dev.children, minors[idx])
4032 4028

  
4029
    # Step 4: dbrd minors and drbd setups changes
4030
    minors = [None for dev in instance.disks]
4031
    logging.debug("Allocated minors %s" % (minors,))
4033 4032
    self.proc.LogStep(4, steps_total, "changing drbd configuration")
4034
    for dev in instance.disks:
4033
    for dev, new_minor in zip(instance.disks, minors):
4035 4034
      size = dev.size
4036 4035
      info("activating a new drbd on %s for %s" % (new_node, dev.iv_name))
4037 4036
      # create new devices on new_node
4038
      new_minor = iv_names[dev.iv_name][2]
4039 4037
      if pri_node == dev.logical_id[0]:
4040 4038
        new_logical_id = (pri_node, new_node,
4041 4039
                          dev.logical_id[2], dev.logical_id[3], new_minor)
4042 4040
      else:
4043 4041
        new_logical_id = (new_node, pri_node,
4044 4042
                          dev.logical_id[2], new_minor, dev.logical_id[4])
4043
      iv_names[dev.iv_name] = (dev, dev.children, new_logical_id)
4045 4044
      new_drbd = objects.Disk(dev_type=constants.LD_DRBD8,
4046 4045
                              logical_id=new_logical_id,
4047 4046
                              children=dev.children)
......
4081 4080
    # if we managed to detach at least one, we update all the disks of
4082 4081
    # the instance to point to the new secondary
4083 4082
    info("updating instance configuration")
4084
    for dev in instance.disks:
4085
      dev.logical_id = (pri_node, new_node) + dev.logical_id[2:]
4083
    for dev, _, new_logical_id in iv_names.itervalues():
4084
      dev.logical_id = new_logical_id
4086 4085
      cfg.SetDiskID(dev, pri_node)
4087 4086
    cfg.Update(instance)
4088 4087

  

Also available in: Unified diff