Skip to content

Commit 521a57c

Browse files
committed
Add missing permissions to the linstor plunger.
1 parent 0e10f95 commit 521a57c

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

‎packages/system/linstor/hack/plunger/plunger-satellite.sh‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ while true; do
2121
# Detect orphaned loop devices and detach them
2222
# the `/` path could not be a backing file for a loop device, so it's a good indicator of a stuck loop device
2323
# TODO describe the issue in more detail
24-
losetup --json \
25-
| jq -r '.[][]
26-
| select(."back-file" == "/ (deleted)")
27-
| "echo Detaching stuck loop device \(.name);
28-
set -x;
29-
losetup --detach \(.name)"' \
30-
| sh
24+
# Using the direct /usr/sbin/losetup as the linstor-satellite image has own wrapper in /usr/local
25+
stale_loopbacks=$(/usr/sbin/losetup --json | jq -r '.[][] | select(."back-file" == "/ (deleted)").name')
26+
for stale_device in $stale_loopbacks; do (
27+
echo "Detaching stuck loop device ${stale_device}"
28+
set -x
29+
/usr/sbin/losetup --detach "${stale_device}"
30+
); done
3131

3232
# Detect secondary volumes that lost connection and can be simply reconnected
33-
disconnected_secondaries=$(drbdadm status | awk '/pvc-.*role:Secondary.*force-io-failures:yes/ {print $1}')
33+
disconnected_secondaries=$(drbdadm status 2>/dev/null | awk '/pvc-.*role:Secondary.*force-io-failures:yes/ {print $1}')
3434
for secondary in $disconnected_secondaries; do (
3535
echo "Trying to reconnect secondary volume ${secondary}"
3636
set -x

‎packages/system/linstor/templates/satellites-plunger.yaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ spec:
1616
- "/scripts/plunger-satellite.sh"
1717
securityContext:
1818
capabilities:
19+
add:
20+
- NET_ADMIN
21+
- SYS_ADMIN
1922
drop:
2023
- ALL
24+
privileged: true
2125
# make some room for live debugging
2226
readOnlyRootFilesystem: false
2327
volumeMounts:

0 commit comments

Comments
 (0)