From ceca9c4764e6235d2e21d4ee640161321c09355b Mon Sep 17 00:00:00 2001 From: Tim Foster Date: Sun, 19 Oct 2008 23:23:38 +0100 Subject: [PATCH] 6761081 spurious zfs/auto-snapshot:default instance, other problems with auto-snapshot manifests Make the dist target tag the method script Fix README --- Makefile | 13 +- README.zfs-auto-snapshot.txt | 4 +- src/lib/svc/method/zfs-auto-snapshot | 9 - src/pkginfo | 2 +- src/prototype | 9 - .../system/filesystem/auto-snapshot.xml | 319 +++++++++++++++--- .../filesystem/zfs-auto-snapshot-daily.xml | 65 ---- .../filesystem/zfs-auto-snapshot-frequent.xml | 65 ---- .../filesystem/zfs-auto-snapshot-hourly.xml | 65 ---- .../filesystem/zfs-auto-snapshot-monthly.xml | 65 ---- .../filesystem/zfs-auto-snapshot-weekly.xml | 65 ---- 11 files changed, 279 insertions(+), 402 deletions(-) mode change 100755 => 100644 src/lib/svc/method/zfs-auto-snapshot delete mode 100644 src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-daily.xml delete mode 100644 src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-frequent.xml delete mode 100644 src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-hourly.xml delete mode 100644 src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-monthly.xml delete mode 100644 src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-weekly.xml diff --git a/Makefile b/Makefile index 52a45ad..b0e5bd3 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,9 @@ ZFS_AUTO_SNAPSHOT_CHANGESET = \ pkg: clean mkdir -p proto find src | cpio -pvdum proto + # we tag the method script during the build, which will + # only happen if we're building from the original hg source, + # not from the dist tarball - see the dist: target. cat src/lib/svc/method/zfs-auto-snapshot | sed -e "s/~ZFS_AUTO_SNAPSHOT_CHANGESET~/${ZFS_AUTO_SNAPSHOT_CHANGESET}/g" > proto/src/lib/svc/method/zfs-auto-snapshot pkgmk -f proto/src/prototype -p `uname -n``date +%Y%m%d%H%M%S` -d proto -r proto/src @@ -16,7 +19,15 @@ clean: fi dist: clean - hg revert --all + # save off a copy of the method script before tagging it + cp src/lib/svc/method/zfs-auto-snapshot zfs-auto-snapshot.src + + cat src/lib/svc/method/zfs-auto-snapshot | sed -e "s/~ZFS_AUTO_SNAPSHOT_CHANGESET~/${ZFS_AUTO_SNAPSHOT_CHANGESET}/g" > src/lib/svc/method/tagged-method-script + mv src/lib/svc/method/tagged-method-script src/lib/svc/method/zfs-auto-snapshot + grep "zfs-auto-snapshot changeset" src/lib/svc/method/zfs-auto-snapshot tar cf ${DIR}.tar -C .. ${DIR}/Changelog -C .. ${DIR}/Makefile \ -C .. ${DIR}/README.zfs-auto-snapshot.txt -C .. ${DIR}/src gzip ${DIR}.tar + + # drop our saved method script back where we left it + cp zfs-auto-snapshot.src src/lib/svc/method/zfs-auto-snapshot diff --git a/README.zfs-auto-snapshot.txt b/README.zfs-auto-snapshot.txt index bd87ab6..9ded47f 100644 --- a/README.zfs-auto-snapshot.txt +++ b/README.zfs-auto-snapshot.txt @@ -1,7 +1,7 @@ NAME -ZFS Automatic Snapshot SMF Service, version 0.11 +ZFS Automatic Snapshot SMF Service, version 0.11.2 DESCRIPTION @@ -20,7 +20,7 @@ application. INSTALLATION -To install, as root, pkgadd TIMFauto-snapshot. This package now contains +To install, as root, pkgadd SUNWzfs-auto-snapshot. This package now contains several canned SMF instances. These are: online 1:17:43 svc:/system/filesystem/zfs/auto-snapshot:hourly diff --git a/src/lib/svc/method/zfs-auto-snapshot b/src/lib/svc/method/zfs-auto-snapshot old mode 100755 new mode 100644 index e009edc..9b7a99c --- a/src/lib/svc/method/zfs-auto-snapshot +++ b/src/lib/svc/method/zfs-auto-snapshot @@ -911,11 +911,6 @@ fi # $1 start | stop | refresh | an FMRI that we want to take snapshots of. case "$1" in 'start') - if [ "$SMF_FMRI" = "svc:/system/filesystem/zfs/auto-snapshot:default" ] ; then - print_log "The default service should not be enabled - use instances instead." - exit $SMF_EXIT_OK - fi - auto_include $SMF_FMRI schedule_snapshots $SMF_FMRI if [ $? -eq 0 ] ; then @@ -927,10 +922,6 @@ case "$1" in ;; 'stop') - if [ "$SMF_FMRI" = "svc:/system/filesystem/zfs/auto-snapshot:default" ] ; then - print_log "The default service should not be used - use instances instead." - exit $SMF_EXIT_OK - fi unschedule_snapshots $SMF_FMRI if [ $? -eq 0 ] ; then result=$SMF_EXIT_OK diff --git a/src/pkginfo b/src/pkginfo index a7db04b..075859d 100644 --- a/src/pkginfo +++ b/src/pkginfo @@ -8,7 +8,7 @@ PKG=SUNWzfs-auto-snapshot NAME=ZFS Automatic Snapshot Service ARCH=all BASEDIR=/ -VERSION=0.11 +VERSION=0.11.2 MAXINST=1 CATEGORY=application DESC=Takes automatic snapshots of ZFS filesystems on a periodic basis. diff --git a/src/prototype b/src/prototype index cad031e..85c56af 100644 --- a/src/prototype +++ b/src/prototype @@ -12,13 +12,4 @@ d none var/svc 0755 root sys d none var/svc/manifest 0755 root sys d none var/svc/manifest/system 0755 root sys d none var/svc/manifest/system/filesystem 0755 root sys -# The order here is important: the auto-snapshot.xml manifest -# must be imported before the instance manifests, otherwise -# dependency information isn't set in the instances until -# they get refreshed. f manifest var/svc/manifest/system/filesystem/auto-snapshot.xml 0644 root sys -f manifest var/svc/manifest/system/filesystem/zfs-auto-snapshot-monthly.xml 0644 root sys -f manifest var/svc/manifest/system/filesystem/zfs-auto-snapshot-frequent.xml 0644 root sys -f manifest var/svc/manifest/system/filesystem/zfs-auto-snapshot-daily.xml 0644 root sys -f manifest var/svc/manifest/system/filesystem/zfs-auto-snapshot-hourly.xml 0644 root sys -f manifest var/svc/manifest/system/filesystem/zfs-auto-snapshot-weekly.xml 0644 root sys diff --git a/src/var/svc/manifest/system/filesystem/auto-snapshot.xml b/src/var/svc/manifest/system/filesystem/auto-snapshot.xml index e30890d..a122484 100644 --- a/src/var/svc/manifest/system/filesystem/auto-snapshot.xml +++ b/src/var/svc/manifest/system/filesystem/auto-snapshot.xml @@ -84,33 +84,33 @@ - - note: recommend an infinite timeout here - or at least a long one, - SMF tries to start all instances in parallel, however, since - we need to add entries to cron, we need to put locks around - start and stop, running these serially - if there are - sufficiently high numbers of instances, we can trip, say a 10 - sec. timeout. + + + + + + + + + - - - - - + + + + + + - - - + + + - + - + - + - A set of instances are provided that snapshot periodically hourly, - daily, weekly, monthly, and at 15 minute intervals, and have their - fs-name set to "//", consulting the com.sun:auto-snapshot:hourly,etc. - ZFS user properties to determine which datasets to snapshot. - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-daily.xml b/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-daily.xml deleted file mode 100644 index eeec405..0000000 --- a/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-daily.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-frequent.xml b/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-frequent.xml deleted file mode 100644 index 8b00611..0000000 --- a/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-frequent.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-hourly.xml b/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-hourly.xml deleted file mode 100644 index 39c1ed1..0000000 --- a/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-hourly.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-monthly.xml b/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-monthly.xml deleted file mode 100644 index b415377..0000000 --- a/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-monthly.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-weekly.xml b/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-weekly.xml deleted file mode 100644 index 6400f50..0000000 --- a/src/var/svc/manifest/system/filesystem/zfs-auto-snapshot-weekly.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -