From 8fcc797a870ba24e23443cfbdff8193ad27d1037 Mon Sep 17 00:00:00 2001 From: Alasdair Lumsden <1268988+alaslums@users.noreply.github.com> Date: Thu, 22 Mar 2018 15:42:56 +0000 Subject: [PATCH] Only mount vmsnap checkpoints CloudAPI offers a method of managing zfs snapshots. These are prefixed with vmsnap, and are mounted on zone boot via lofs into /checkpoints However currently, the zone boot code mounts all snapshots via lofs into /checkpoints. This presents issues for snapshots created/deleted in the global zone, that we perhaps don't want automounted or exposed to customers. For example in our use-case, backup snapshots. The main issue here is with snapshot deletion. By simply mounting vmsnap snapshots only, we avoid this issue whilst retaining compatibility with Triton's CloudAPI snapshot functionality. --- overlay/generic/usr/lib/brand/jcommon/statechange | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/overlay/generic/usr/lib/brand/jcommon/statechange b/overlay/generic/usr/lib/brand/jcommon/statechange index 2678b0fac..4e2c4be4b 100644 --- a/overlay/generic/usr/lib/brand/jcommon/statechange +++ b/overlay/generic/usr/lib/brand/jcommon/statechange @@ -603,7 +603,7 @@ setup_snapshots() # internal information, mount the /root directory of each snapshot # separately. # - for snap in $(ls -1 $ZONEPATH/.zfs/snapshot); do + for snap in $(ls -1 $ZONEPATH/.zfs/snapshot | grep ^vmsnap-); do snapdir=$ZONEPATH/$SNAPSHOT_DIR/$(echo ${snap} | sed -e "s/^vmsnap-//") mkdir -p ${snapdir} mount -F lofs -o ro,setuid,nodevices \