diff --git a/drivers/lvhdutil.py b/drivers/lvhdutil.py index 3186b291f..ac49256e8 100755 --- a/drivers/lvhdutil.py +++ b/drivers/lvhdutil.py @@ -246,7 +246,7 @@ def attachThin(journaler, srUuid, vdiUuid): lock.release() -def detachThin(session, lvmCache, srUuid, vdiUuid): +def detachThin_impl(session, lvmCache, srUuid, vdiUuid): """Shrink the VDI to the minimal size if no one is using it""" lvName = LV_PREFIX[vhdutil.VDI_TYPE_VHD] + vdiUuid path = os.path.join(VG_LOCATION, VG_PREFIX + srUuid, lvName) @@ -273,6 +273,13 @@ def detachThin(session, lvmCache, srUuid, vdiUuid): lock.release() +def detachThin(session, lvmCache, srUuid, vdiUuid): + try: + detachThin(session, lvmCache, srUuid, vdiUuid) + except Exception as e: + util.SMlog('Failed to detach properly VDI {}: {}'.format(vdiUuid, e)) + + def createVHDJournalLV(lvmCache, jName, size): """Create a LV to hold a VHD journal""" lvName = "%s_%s" % (JVHD_TAG, jName)