Revision 03dfa658

b/lib/backend.py
768 768
  """Remove the block device symlinks belonging to the given instance.
769 769

  
770 770
  """
771
  for i in os.listdir(constants.DISK_LINKS_DIR):
772
    if os.path.islink(i) and i.startswith('%s-' % instance_name):
771
  for short_name in os.listdir(constants.DISK_LINKS_DIR):
772
    link_name = os.path.join(constants.DISK_LINKS_DIR, short_name)
773
    if (os.path.islink(link_name) and
774
        short_name.startswith('%s-' % instance_name)):
773 775
      try:
774
        os.remove(link)
775
      except OSError, e:
776
        pass # Ignore errors when removing the symlinks
776
        os.remove(link_name)
777
      except OSError:
778
        logging.exception("Can't remove symlink '%s'", link_name)
777 779

  
778 780

  
779 781
def _GatherAndLinkBlockDevs(instance):

Also available in: Unified diff