Skip to content

kvm: extract RBD snapshot unprotect into a helper method - #6

Merged
calvix merged 1 commit into
fix/rbd-snapshot-exclusive-lock-leakfrom
fix/rbd-snapshot-unprotect-helper
Aug 11, 2026
Merged

kvm: extract RBD snapshot unprotect into a helper method#6
calvix merged 1 commit into
fix/rbd-snapshot-exclusive-lock-leakfrom
fix/rbd-snapshot-unprotect-helper

Conversation

@calvix

@calvix calvix commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Follow-up to the reviewer's "I would personally still give the snapprotect block a separate method as well":

The snapUnprotect block in the finally clause of createRBDvolumeFromRBDSnapshot moves into a never-throwing unprotectRbdSnapshot(image, snapshotName, snapProtected) helper next to closeRbdImage/destroyRadosIoCtx. The snapProtected guard moves inside the helper, mirroring how the other helpers guard on null — the finally clause is now four plain helper calls with no inline try-catch at all:

} finally {
    closeRbdImage(rbd, diskImage, newUuid);
    unprotectRbdSnapshot(srcImage, snapshotName, snapProtected);
    closeRbdImage(rbd, srcImage, volume.getName());
    destroyRadosIoCtx(r, io, snapshotName);
}

Keeps ERROR severity and the operator-facing message about the snapshot/volume being undeletable until resolved.

No behavior change. All 39 tests in KVMStorageProcessorTest pass.

Follow-up to the teardown helpers: the snapUnprotect block in the
finally clause of createRBDvolumeFromRBDSnapshot moves into a
never-throwing unprotectRbdSnapshot helper, so the finally clause is
now free of inline try-catch constructions entirely.

No behavior change.
@calvix
calvix merged commit ecb0c7a into fix/rbd-snapshot-exclusive-lock-leak Aug 11, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant