[NEW PATCH] BZ#713823 - We should not fail if deactivateLV failed during block volume creation (via gerrit-bot)

Igor Lvovsky ilvovsky at redhat.com
Tue Jun 28 15:14:56 UTC 2011


New patch submitted by Igor Lvovsky (ilvovsky at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/627

commit 20424a9fe70dc46effc0fa9d7223d61b7437fbc1
Author: Igor Lvovsky <ilvovsky at redhat.com>
Date:   Tue Jun 28 11:11:17 2011 +0300

    BZ#713823 - We should not fail if deactivateLV failed during block volume creation
    
    Change-Id: I096a82449d5f48800ac7ba2fa73ea51119acbcd1

diff --git a/vdsm/storage/blockVolume.py b/vdsm/storage/blockVolume.py
index ae411be..40fe7cf 100644
--- a/vdsm/storage/blockVolume.py
+++ b/vdsm/storage/blockVolume.py
@@ -158,7 +158,7 @@ class BlockVolume(volume.Volume):
 
                 # override size param by parent's size
                 size = pvol.getSize()
-        except se.StorageException, e:
+        except se.StorageException:
             cls.log.error("Unexpected error", exc_info=True)
             raise
         except Exception, e:
@@ -178,7 +178,7 @@ class BlockVolume(volume.Volume):
             if os.path.exists(vol_path):
                 os.unlink(vol_path)
             os.symlink(lvm.lvPath(sdUUID, volUUID), vol_path)
-        except se.StorageException, e:
+        except se.StorageException:
             cls.log.error("Unexpected error", exc_info=True)
             raise
         except Exception, e:
@@ -199,7 +199,7 @@ class BlockVolume(volume.Volume):
                 ## Create hardlink to template and its meta file
                 cls.log.info("Request to create snapshot %s/%s of volume %s/%s", imgUUID, volUUID, srcImgUUID, srcVolUUID)
                 pvol.clone(imageDir, volUUID, volFormat, preallocate)
-        except Exception, e:
+        except Exception:
             cls.log.error("Unexpected error", exc_info=True)
             raise
 
@@ -209,7 +209,8 @@ class BlockVolume(volume.Volume):
                 lvm.addLVTags(sdUUID, volUUID, ("%s%s" % (TAG_PREFIX_MD, offs),
                                                 "%s%s" % (TAG_PREFIX_PARENT, srcVolUUID,),
                                                 "%s%s" % (TAG_PREFIX_IMAGE, imgUUID,)))
-            lvm.deactivateLVs(sdUUID, volUUID)
+
+
             vars.task.pushRecovery(task.Recovery("create block volume metadata rollback", "blockVolume", "BlockVolume", "createVolumeMetadataRollback",
                                                  [sdUUID, str(offs)]))
             # Set metadata and mark volume as legal.
@@ -218,17 +219,21 @@ class BlockVolume(volume.Volume):
                             size, volume.type2name(volFormat),
                             volume.type2name(preallocate), voltype,
                             diskType, desc, volume.LEGAL_VOL)
-        except se.StorageException, e:
+        except se.StorageException:
             cls.log.error("Unexpected error", exc_info=True)
             raise
         except Exception, e:
             cls.log.error("Unexpected error", exc_info=True)
             raise se.VolumeMetadataWriteError("tag target volume %s failed: %s" % (volUUID, str(e)))
 
+        try:
+            lvm.deactivateLVs(sdUUID, volUUID)
+        except Exception, e:
+            cls.log.warn("Cannot deactivate new created volume %s/%s %s", sdUUID, volUUID, str(e), exc_info=True)
+
         # Remove all previous rollbacks for 'halfbaked' volume and add rollback for 'real' volume creation
         vars.task.replaceRecoveries(task.Recovery("create block volume rollback", "blockVolume", "BlockVolume", "createVolumeRollback",
                                              [repoPath, sdUUID, imgUUID, volUUID, imageDir]))
-
         return volUUID
 
 




More information about the vdsm-patches mailing list