Fix: --disable-nested-snapshots did not disable anything until reboot
apply.sh only ever ADDED patches; there was no revert path anywhere. Disabling
removed the opt-in marker and then merely skipped re-applying -- but the overlay
persists for the whole boot, so the previously patched cloud/{snapshot,crud}.py,
cloud_backup/sync.py and _truecloud_nested.py were all still on disk, and
middlewared re-imported them on the restart install.sh performs.
It printed "DISABLED (stock guard restored)" while the feature kept running until
the next reboot. Someone disabling it because they were worried about it would
have believed it was off.
apply.sh now reverts on every not-needed path (opt-out, or superseded by native
support): remove the module FIRST -- every injected block is guarded by
`if _tc_nested is not None`, so the stock guard comes back even if a later step
fails -- then strip the appended blocks from the three patched files.
restic.py also carries a TRUECLOUD_PATCH block but belongs to the providers
module; reverting it would silently break B2 backups, so it is explicitly
excluded. Verified: the three nested files restore byte-for-byte to stock, the
module is removed, and restic.py's block survives.
install.sh --disable also tears the staging tree down first, since those bind
mounts pin ZFS snapshots that could otherwise never be destroyed.
Updating WITHOUT the flag was always correct and is unchanged: the nested module
is never installed into middleware unless explicitly enabled.
109 tests, ruff and shellcheck clean.
This commit is contained in:
+10
-3
@@ -18,7 +18,7 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
VERSION="0.3.1"
|
||||
VERSION="0.3.2"
|
||||
|
||||
# The directory containing install.sh is the permanent install location.
|
||||
PATCH_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
@@ -160,10 +160,17 @@ case "$_nested_choice" in
|
||||
off)
|
||||
if [ -f "$_NESTED_MARKER" ]; then
|
||||
rm -f "$_NESTED_MARKER"
|
||||
echo "Nested-dataset snapshots: DISABLED (stock guard restored)."
|
||||
# Tear down any staging tree first: those bind mounts PIN their ZFS
|
||||
# snapshots, so leaving them would block those snapshots from ever
|
||||
# being destroyed. apply.sh (below) then reverts the patched files.
|
||||
python3 "$PATCH_DIR/patch/truecloud_nested.py" cleanup || \
|
||||
echo " WARNING: staging mounts remain; unmount them manually."
|
||||
echo "Nested-dataset snapshots: DISABLED."
|
||||
echo " apply.sh will revert the patched middleware files and the stock"
|
||||
echo " guard is restored when middlewared restarts (this script does that)."
|
||||
echo " Any task that already has snapshot=true on a nested dataset will"
|
||||
echo " fail validation on its next edit. Turn the option off on those"
|
||||
echo " tasks, or re-run with --enable-nested-snapshots."
|
||||
echo " tasks first, or re-run with --enable-nested-snapshots."
|
||||
else
|
||||
echo "Nested-dataset snapshots: already disabled."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user