FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 75db08dc authored by Dr Catherine Pitt's avatar Dr Catherine Pitt
Browse files

Fix a bug in the move-machine script

The generation of the command to unexport NFS filesystems could generate
an invalid command. Leading spaces were not being stripped, and in cases
where there is more than one backup target for a machine we need to
unexport every target. Because we also had 'set -e' in operation at this
point, the script would fail there and never clean up the moved ZFS. I
don't mind if we fail to unexport; if that's subsequently a problem for
removing the ZFS then the script will fail at that point.

This change makes the script generate better exportfs -u commands and
not exit if they fail.
parent e40c1a55
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,6 @@ Priority: optional
Section: otherosfs
Maintainer: Chemistry COs <support@ch.cam.ac.uk>
Architecture: all
Version: 0.9-ch75
Version: 0.9-ch76
Depends: zfs-dkms, postgresql-13 | postgresql-9.5 | postgresql-9.4 , liblockfile-simple-perl, libdbi-perl, libjson-perl, libzfs-perl-chem, libnet-openssh-perl, libdbd-pg-perl, mbuffer, rsync, nfs-kernel-server, pv, libwww-curl-perl
Description: a backup system using ZFS (repository 'backup-scheduler')
......@@ -71,8 +71,12 @@ echo Re-enabling backup task
dosql "update host set disabled='f' where hostname='$FQDN';"
# Tidy up
echo Removing old ZFS, snapshots etc
# need to unexport nfs here
EXPORT=`dosql "select zfs_target from backup_task where backup_task_id in (select backup_task_id from backup_task natural join host where hostname='$FQDN')"`
exportfs -u $FQDN:/$EXPORT
# need to try to unexport nfs here, but failure isn't a worry
set +e
EXPORTS=`dosql "select zfs_target from backup_task where backup_task_id in (select backup_task_id from backup_task natural join host where hostname='$FQDN')"`
for EXPORT in $EXPORTS ; do
exportfs -u $FQDN:/$EXPORT
done
set -e
for SN in `zfs list -r -t snapshot -H -o name $SOURCE/$FQDN ` ; do for H in `zfs holds -H $SN | awk ' { print $2 ; } '` ; do zfs release $H $SN ; done ; done
zfs destroy -r $SOURCE/$FQDN
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment