BmapCopy: restore the block device settings
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Mon, 14 Jan 2013 14:46:42 +0000 (16:46 +0200)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Mon, 14 Jan 2013 14:46:42 +0000 (16:46 +0200)
Always restore the block device settings at the end.

Change-Id: I04ba70598b2e9616d22790248795a460ec710400
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
bmaptools/BmapCopy.py

index dbd2a07..7082287 100644 (file)
@@ -574,12 +574,14 @@ class BmapBdevCopy(BmapCopy):
         very bad user experience, and we work around this effect by
         synchronizing from time to time. """
 
+        self._tune_block_device()
+
         try:
-            self._tune_block_device()
             BmapCopy.copy(self, sync, verify)
         except:
-            self._restore_bdev_settings()
             raise
+        finally:
+            self._restore_bdev_settings()
 
     def __init__(self, image, dest, bmap = None, image_size = None):
         """ The same as the constructor of the 'BmapCopy' base class, but adds