Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lvutil: Ensure we can detach when deflate call is not possible #649

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion drivers/lvhdutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def attachThin(journaler, srUuid, vdiUuid):
lock.release()


def detachThin(session, lvmCache, srUuid, vdiUuid):
def detachThinImpl(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)
Expand All @@ -273,6 +273,13 @@ def detachThin(session, lvmCache, srUuid, vdiUuid):
lock.release()


def detachThin(session, lvmCache, srUuid, vdiUuid):
try:
detachThinImpl(session, lvmCache, srUuid, vdiUuid)
except Exception as e:
util.SMlog(f'Failed to detach properly VDI {vdiUuid}: {e}')


def createVHDJournalLV(lvmCache, jName, size):
"""Create a LV to hold a VHD journal"""
lvName = "%s_%s" % (JVHD_TAG, jName)
Expand Down