Skip to content

Commit f3c4bfd

Browse files
committed
Ensure we can detach when deflate call is not possible
Raising during detach call can leak a tapdisk process that will cause trouble later. Signed-off-by: BenjiReis <[email protected]>
1 parent 7e2a342 commit f3c4bfd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/lvhdutil.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def attachThin(journaler, srUuid, vdiUuid):
246246
lock.release()
247247

248248

249-
def detachThin(session, lvmCache, srUuid, vdiUuid):
249+
def detachThinImpl(session, lvmCache, srUuid, vdiUuid):
250250
"""Shrink the VDI to the minimal size if no one is using it"""
251251
lvName = LV_PREFIX[vhdutil.VDI_TYPE_VHD] + vdiUuid
252252
path = os.path.join(VG_LOCATION, VG_PREFIX + srUuid, lvName)
@@ -273,6 +273,13 @@ def detachThin(session, lvmCache, srUuid, vdiUuid):
273273
lock.release()
274274

275275

276+
def detachThin(session, lvmCache, srUuid, vdiUuid):
277+
try:
278+
detachThinImpl(session, lvmCache, srUuid, vdiUuid)
279+
except Exception as e:
280+
util.SMlog(f'Failed to detach properly VDI {vdiUuid}: {e}')
281+
282+
276283
def createVHDJournalLV(lvmCache, jName, size):
277284
"""Create a LV to hold a VHD journal"""
278285
lvName = "%s_%s" % (JVHD_TAG, jName)

0 commit comments

Comments
 (0)