Repository navigation
Add missing permissions to the Linstor plunger. - #693
Conversation
WalkthroughThis pull request modifies two files. The first file updates the logic in a shell script to detect and detach orphaned loop devices by storing output in a variable and iterating over each device, with added echo feedback and suppressed error messages. The second file alters a container configuration by adding additional capabilities and enabling privileged mode. Changes
Sequence Diagram(s)sequenceDiagram
participant Script as plunger-satellite.sh
participant Losetup as losetup
participant Device as Loop Device
Script->>Losetup: Execute 'losetup' to list devices
Losetup-->>Script: Return list of loopback devices
Script->>Script: Store list in 'stale_loopbacks'
loop For each stale device
Script->>Losetup: Detach device (losetup -d)
Losetup-->>Script: Detachment confirmation (errors suppressed)
Script->>Script: Echo feedback message
end
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/system/linstor/hack/plunger/plunger-satellite.sh (2)
24-30: Direct usage of native losetup for loop device management.
The revised block leverages/usr/sbin/losetup --jsoncombined withjqto filter and identify stale loop devices, bypassing the redundant wrapper. This clarifies the logic and supports robust error handling. Consider adding safeguards or logging in case the JSON structure provided bylosetupchanges in the future.
28-28: Debug tracing enabled within loop.
Usingset -xhere aids in debugging by echoing the detachment command. If verbose output is a concern in a production environment, you might consider disabling the tracing withset +ximmediately after the command.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/system/linstor/hack/plunger/plunger-satellite.sh(1 hunks)packages/system/linstor/templates/satellites-plunger.yaml(1 hunks)
🔇 Additional comments (3)
packages/system/linstor/templates/satellites-plunger.yaml (2)
19-21: Enhanced container capabilities added.
The addition ofNET_ADMINandSYS_ADMINin the capabilities list directly addresses the permission issues described in the PR objectives. This change enables the plunger container to perform low-level network and system operations as required.
24-24: Privileged mode enabled.
Settingprivileged: trueensures the container gains the necessary elevated privileges to operate correctly alongside the satellite, which helps overcome the discrepancies in admin privileges.packages/system/linstor/hack/plunger/plunger-satellite.sh (1)
33-39: Robust reconnection logic for disconnected secondary volumes.
The modified block detects DRBD secondary volumes that have lost connection by parsingdrbdadm statuswithawkand re-establishes their connection. This approach enhances reliability, assuming the regex correctly identifies all relevant secondaries.
The Linstor satellite creates problems with admin privileges, so the plunger needs the same privileges to fix those problems.
Also, use the native
losetup. The Linstor image has a wrapper with an additional function that we do not need here.Summary by CodeRabbit
Refactor
New Features