Revision 7d3484b8 lib/cmdlib.py

b/lib/cmdlib.py
9699 9699
    result.Raise("Failed to create directory '%s' on"
9700 9700
                 " node %s" % (file_storage_dir, pnode))
9701 9701

  
9702
  disks_created = []
9702 9703
  # Note: this needs to be kept in sync with adding of disks in
9703 9704
  # LUInstanceSetParams
9704 9705
  for idx, device in enumerate(instance.disks):
......
9708 9709
    #HARDCODE
9709 9710
    for node in all_nodes:
9710 9711
      f_create = node == pnode
9711
      _CreateBlockDev(lu, node, instance, device, f_create, info, f_create)
9712
      try:
9713
        _CreateBlockDev(lu, node, instance, device, f_create, info, f_create)
9714
        disks_created.append((node, device))
9715
      except errors.OpExecError:
9716
        logging.warning("Creating disk %s for instance '%s' failed",
9717
                        idx, instance.name)
9718
        for (node, disk) in disks_created:
9719
          lu.cfg.SetDiskID(disk, node)
9720
          result = lu.rpc.call_blockdev_remove(node, disk)
9721
          if result.fail_msg:
9722
            logging.warning("Failed to remove newly-created disk %s on node %s:"
9723
                            " %s", device, node, result.fail_msg)
9724
        raise
9712 9725

  
9713 9726

  
9714 9727
def _RemoveDisks(lu, instance, target_node=None, ignore_failures=False):
......
9716 9729

  
9717 9730
  This abstracts away some work from `AddInstance()` and
9718 9731
  `RemoveInstance()`. Note that in case some of the devices couldn't
9719
  be removed, the removal will continue with the other ones (compare
9720
  with `_CreateDisks()`).
9732
  be removed, the removal will continue with the other ones.
9721 9733

  
9722 9734
  @type lu: L{LogicalUnit}
9723 9735
  @param lu: the logical unit on whose behalf we execute

Also available in: Unified diff