Skip to content

Commit bec37fb

Browse files
derekbitmergify[bot]
authored andcommitted
fix: prestop should not delete device mapper devices
prestop should not delete device mapper devices. The cleanup lead to the teardown of the endpoints of existing v1 volumes. Longhorn 13194 Signed-off-by: Derek Su <derek.su@suse.com> (cherry picked from commit a862cfb)
1 parent 7226abb commit bec37fb

1 file changed

Lines changed: 0 additions & 35 deletions

File tree

package/instance-manager-v2-prestop

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,6 @@ log() {
77
function cleanup_spdk_resources() {
88
log "Caught termination signal. Cleaning up SPDK resources..."
99

10-
local v2_devices=($(get_v2_devices))
11-
for device in "${v2_devices[@]}"; do
12-
dmsetup remove "$device"
13-
log "Removed device-mapper device: $device"
14-
15-
device_file="/host/dev/longhorn/$device"
16-
rm "$device_file"
17-
log "Removed device file: $device_file"
18-
done
19-
2010
log "Sending SIGTERM to go-spdk-helper to stop spdk_tgt..."
2111
go-spdk-helper kill-instance --sig-name SIGTERM
2212
if [[ $? -ne 0 ]]; then
@@ -26,29 +16,4 @@ function cleanup_spdk_resources() {
2616
fi
2717
}
2818

29-
function get_v2_devices() {
30-
local dm_devices
31-
dm_devices=$(dmsetup ls 2>/dev/null | awk '{print $1}')
32-
local v2_devices=()
33-
34-
if [[ ! -d /host/dev/longhorn/ ]]; then
35-
echo "${v2_devices[@]}"
36-
return
37-
fi
38-
39-
local device_files
40-
device_files=$(ls /host/dev/longhorn/)
41-
42-
for dm_device in $dm_devices; do
43-
for device_file in $device_files; do
44-
if [[ "$dm_device" == "$device_file" ]]; then
45-
v2_devices+=("$dm_device")
46-
break
47-
fi
48-
done
49-
done
50-
51-
echo "${v2_devices[@]}"
52-
}
53-
5419
cleanup_spdk_resources

0 commit comments

Comments
 (0)