fix: remove encrypted dm device with linear dm if existing#282
fix: remove encrypted dm device with linear dm if existing#282mantissahz wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses an issue in v2 volumes where an encrypted device-mapper (DM) mapping can prevent the linear DM mapping from being removed/reloaded, which can then block initiator recreation after unexpected engine crashes.
Changes:
- Extend
util.DmsetupRemoveto accept multiple DM devices in one call. - Update initiator teardown logic to attempt removing a
-encryptedDM device alongside the linear DM device. - Update the
dmsetupCLI wrapper to use the newDmsetupRemove([]string, ...)signature.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| pkg/util/dmsetup.go | Changes DmsetupRemove to accept a list of device identifiers. |
| pkg/initiator/initiator.go | Adds logic to detect and remove an -encrypted DM device along with the linear DM device; adds not-found error detection. |
| app/cmd/dmsetup/dmsetup.go | Updates CLI remove command to pass a slice to DmsetupRemove. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
611dfb0 to
454408a
Compare
ref: longhorn/longhorn 12842 Signed-off-by: James Lu <james.lu@suse.com>
Wrong ticket number?
|
Yes, it should be longhorn/longhorn@11510 |
| ShallowCopyStateError = "error" | ||
|
|
||
| ExecuteTimeout = 180 * time.Second | ||
| ExecuteShortTimeout = 5 * time.Second |
There was a problem hiding this comment.
Is it enough? Why not use ExecuteTimeout?
| i.logger.WithError(err).Debugf("Failed to remove linear dm device: %v", dmDevPath) | ||
| if isRemoveDmDevNotFoundError(err) { | ||
| return nil | ||
| } | ||
| return err |
There was a problem hiding this comment.
| i.logger.WithError(err).Debugf("Failed to remove linear dm device: %v", dmDevPath) | |
| if isRemoveDmDevNotFoundError(err) { | |
| return nil | |
| } | |
| return err | |
| if isRemoveDmDevNotFoundError(err) { | |
| return nil | |
| } | |
| i.logger.WithError(err).Errorf("Failed to remove linear dm device %v", dmDevPath) | |
| return err |
|
Try to fix this issue at the volume controller by this PR longhorn/longhorn-manager#4736 |
Which issue(s) this PR fixes:
Issue # longhorn/longhorn#11510
What this PR does / why we need it:
The linear dm created with the initiator will block the encrypted dm device each other in v2 volumes.
Then the linear dm device can not be reloaded, removed, and block the initiator to be re-created when the engine crashes unexpectedly.
Special notes for your reviewer:
Additional documentation or context
https://ci.longhorn.io/job/private/job/longhorn-e2e-test/7870/https://ci.longhorn.io/job/private/job/longhorn-e2e-test/7872/https://ci.longhorn.io/job/private/job/longhorn-e2e-test/7873/