Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-131186 / 25.04 / Add stop-alua to scst_util.sh and call before stopping middlewared #14520

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions debian/debian/ix-reboot.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[Unit]
Description=Exec TrueNAS reboot tasks

After=network.target middlewared.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=true
ExecStop=/usr/local/bin/scst_util.sh stop-alua
StandardOutput=null
StandardError=null
TimeoutStopSec=0

[Install]
WantedBy=multi-user.target
1 change: 1 addition & 0 deletions debian/debian/ix-shutdown.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ After=network.target middlewared.service
Type=oneshot
RemainAfterExit=yes
ExecStart=true
ExecStop=/usr/local/bin/scst_util.sh stop-alua
ExecStop=midclt call core.event_send system.shutdown ADDED
ExecStop=midclt call --job initshutdownscript.execute_init_tasks SHUTDOWN
StandardOutput=null
Expand Down
1 change: 1 addition & 0 deletions debian/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ override_dh_installsystemd:
dh_installsystemd --no-start -r --no-restart-after-upgrade --name=ix-netif
dh_installsystemd --no-start -r --no-restart-after-upgrade --name=ix-postinit
dh_installsystemd --no-start -r --no-restart-after-upgrade --name=ix-preinit
dh_installsystemd --no-start -r --no-restart-after-upgrade --name=ix-reboot
dh_installsystemd --no-start -r --no-restart-after-upgrade --name=ix-reporting
dh_installsystemd --no-start -r --no-restart-after-upgrade --name=ix-shutdown
dh_installsystemd --no-start -r --no-restart-after-upgrade --name=ix-ssh-keys
Expand Down
21 changes: 20 additions & 1 deletion src/freenas/usr/local/bin/scst_util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,32 @@ force_close() {
wait
}

stop_alua() {
shopt -s nullglob

# Disable iSCSI
if [ -f /sys/kernel/scst_tgt/targets/iscsi/enabled ]; then
echo 0 > /sys/kernel/scst_tgt/targets/iscsi/enabled
fi

# Turn off any cluster_mode in parallel
for cm in /sys/kernel/scst_tgt/devices/*/cluster_mode ; do
echo 0 > "$cm" &
done
wait
}

case "$1" in
force-close)
force_close
rc=$?
;;
stop-alua)
stop_alua
rc=$?
;;
*)
echo "Usage: $0 {force-close}"
echo "Usage: $0 {force-close|stop-alua}"
exit 2
;;
esac
Expand Down
2 changes: 1 addition & 1 deletion src/middlewared/middlewared/plugins/failover_/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def _event(self, ifname, event):
elif event == 'BACKUP':
return self.run_call('failover.events.vrrp_backup', fobj, ifname, event)

def fenced_start_loop(self, max_retries=3):
def fenced_start_loop(self, max_retries=4):
# When active node is rebooted administratively from shell, the
# fenced process will continue running on the node until systemd
# finishes terminating services and actually reboots. Hence, we may
Expand Down
Loading