mirror of
https://github.com/TheGrandWazoo/freenas-proxmox.git
synced 2026-10-22 06:28:20 +02:00
fix: restart HA daemons on install/remove; add regression test (#179)
pvedaemon/pveproxy picked up the patched PVE::Storage state, but pve-ha-lrm/pve-ha-crm kept running against the pre-install state, so HA-managed VMs on TrueNAS storage failed to start. They don't support a `restart` subcommand (only start/stop/status), so they're restarted via systemctl instead. Also switched every restart from `cmd && log ...` to bare statements — set -e does not fire on the left side of &&, so a genuine restart failure was previously swallowed silently instead of aborting the script. Adds tests/test-restart-services.sh: sources the real postinst/postrm against stub PVE binaries in CI to catch both classes of regression (wrong subcommand, silently-swallowed failure) without needing a live PVE cluster. Real HA-cluster validation is documented as a manual runbook (RUNBOOK-001) since GitHub Actions can't run pve-ha-lrm/crm. Bumps $VERSION to 3.2.4. Fixes #179 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
55c2663163
commit
d60adfaaf7
+29
-19
@@ -39,27 +39,37 @@ install_ui() {
|
||||
}
|
||||
|
||||
restart_pve_services() {
|
||||
# Bare statements (not `cmd && log ...`) so `set -e` actually aborts on
|
||||
# failure instead of silently skipping past it — see tests/test-restart-services.sh.
|
||||
log "Restarting Proxmox VE services ..."
|
||||
pvedaemon restart && log "pvedaemon restarted"
|
||||
pveproxy restart && log "pveproxy restarted"
|
||||
pvestatd restart && log "pvestatd restarted"
|
||||
systemctl restart pve-ha-lrm pve-ha-crm && log "pve-ha-lrm, pve-ha-crm restarted"
|
||||
pvedaemon restart
|
||||
log "pvedaemon restarted"
|
||||
pveproxy restart
|
||||
log "pveproxy restarted"
|
||||
pvestatd restart
|
||||
log "pvestatd restarted"
|
||||
systemctl restart pve-ha-lrm pve-ha-crm
|
||||
log "pve-ha-lrm, pve-ha-crm restarted"
|
||||
log "Done. Refresh your Proxmox browser tab."
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
log "Configuring truenas-proxmox (previous version: ${2:-none})"
|
||||
install_plugin
|
||||
install_ui
|
||||
restart_pve_services
|
||||
;;
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
*)
|
||||
echo "$0: called with unknown argument '$1'" >&2
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
# Guard so tests can `source` this file (to exercise its functions) without
|
||||
# running dpkg's maintainer-script logic below.
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
case "$1" in
|
||||
configure)
|
||||
log "Configuring truenas-proxmox (previous version: ${2:-none})"
|
||||
install_plugin
|
||||
install_ui
|
||||
restart_pve_services
|
||||
;;
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
*)
|
||||
echo "$0: called with unknown argument '$1'" >&2
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
fi
|
||||
|
||||
+35
-25
@@ -23,32 +23,42 @@ remove_ui() {
|
||||
}
|
||||
|
||||
restart_pve_services() {
|
||||
# Bare statements (not `cmd && log ...`) so `set -e` actually aborts on
|
||||
# failure instead of silently skipping past it — see tests/test-restart-services.sh.
|
||||
log "Restarting Proxmox VE services ..."
|
||||
pvedaemon restart && log "pvedaemon restarted"
|
||||
pveproxy restart && log "pveproxy restarted"
|
||||
pvestatd restart && log "pvestatd restarted"
|
||||
systemctl restart pve-ha-lrm pve-ha-crm && log "pve-ha-lrm, pve-ha-crm restarted"
|
||||
pvedaemon restart
|
||||
log "pvedaemon restarted"
|
||||
pveproxy restart
|
||||
log "pveproxy restarted"
|
||||
pvestatd restart
|
||||
log "pvestatd restarted"
|
||||
systemctl restart pve-ha-lrm pve-ha-crm
|
||||
log "pve-ha-lrm, pve-ha-crm restarted"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
remove)
|
||||
log "Removing truenas-proxmox ..."
|
||||
rm -f "$PLUGIN_DST" && log "Removed ${PLUGIN_DST}"
|
||||
remove_ui
|
||||
restart_pve_services
|
||||
log "truenas-proxmox removed. Refresh your Proxmox browser tab."
|
||||
;;
|
||||
purge)
|
||||
log "Purging truenas-proxmox ..."
|
||||
rm -f "$PLUGIN_DST" "$JS_DST" "$HELP_DST" "$LOG_FILE"
|
||||
[ -f "$TPL" ] && sed -i '/truenas-storage\.js/d' "$TPL"
|
||||
;;
|
||||
upgrade|failed-upgrade|disappear|abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
*)
|
||||
echo "$0: called with unknown argument '$1'" >&2
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
# Guard so tests can `source` this file (to exercise its functions) without
|
||||
# running dpkg's maintainer-script logic below.
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
case "$1" in
|
||||
remove)
|
||||
log "Removing truenas-proxmox ..."
|
||||
rm -f "$PLUGIN_DST" && log "Removed ${PLUGIN_DST}"
|
||||
remove_ui
|
||||
restart_pve_services
|
||||
log "truenas-proxmox removed. Refresh your Proxmox browser tab."
|
||||
;;
|
||||
purge)
|
||||
log "Purging truenas-proxmox ..."
|
||||
rm -f "$PLUGIN_DST" "$JS_DST" "$HELP_DST" "$LOG_FILE"
|
||||
[ -f "$TPL" ] && sed -i '/truenas-storage\.js/d' "$TPL"
|
||||
;;
|
||||
upgrade|failed-upgrade|disappear|abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
*)
|
||||
echo "$0: called with unknown argument '$1'" >&2
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
truenas-proxmox (3.2.4-1) bookworm; urgency=medium
|
||||
|
||||
* Fix postinst/postrm to also restart pvestatd, pve-ha-lrm, pve-ha-crm on
|
||||
install/upgrade/remove — pve-ha-lrm/pve-ha-crm previously kept running
|
||||
against the pre-install PVE::Storage state, so HA-managed VMs on TrueNAS
|
||||
storage failed to start (#179)
|
||||
* pve-ha-lrm/pve-ha-crm restarted via systemctl (no restart subcommand);
|
||||
all restarts changed from `cmd && log ...` to bare statements so a
|
||||
genuine failure aborts the script instead of being silently swallowed
|
||||
by set -e's && exemption
|
||||
|
||||
-- KSA Technologies, LLC <theprofessor@ksatechnologies.com> Sat, 01 Aug 2026 00:00:00 +0000
|
||||
|
||||
truenas-proxmox (3.2.2-1) bookworm; urgency=low
|
||||
|
||||
* Bump api() return value from 14 to 15 to match PVE 9 APIVER — silences
|
||||
|
||||
Reference in New Issue
Block a user