coren has uploaded a new change for review.
https://gerrit.wikimedia.org/r/206116
Change subject: Labs: make reboot-if-idmap smarter
......................................................................
Labs: make reboot-if-idmap smarter
It will now try to unmount all NFS filesystems and reload
the kernel module before it tries to reboot the instance.
Change-Id: Ia3fbd52b8c434964e8e1420fdc00262b3fd8c668
---
M files/nfs/reboot-if-idmap
1 file changed, 23 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/16/206116/1
diff --git a/files/nfs/reboot-if-idmap b/files/nfs/reboot-if-idmap
index dd96526..2cccadf 100644
--- a/files/nfs/reboot-if-idmap
+++ b/files/nfs/reboot-if-idmap
@@ -9,17 +9,38 @@
testfile="/home/._._testfile"
if [ -e $testfile ]; then
- echo "$testfile: already exists\n" >&2
+ echo "$testfile: already exists\n"
exit 1
fi
trap "rm -f $testfile" 0
-if ! touch $testfile; then
+if ! touch $testfile 2>/dev/null; then
+ echo "$testfile: unable to create\n"
exit 1
fi
if ! chown 456 $testfile 2>/dev/null; then
# UID 456 picked because known to not be on labstore
+
+ # Rather than reboot outright, try to unmount the NFS
+ # filesystems and unload the kernel module. This will
+ # fail if anything is using NFS but will prevent a
+ # needless reboot for instances that aren't actually
+ # using it at this time.
+
+ if /bin/umount -a -t nfs 2>/dev/null; then
+ if /sbin/rmmod nfs 2>/dev/null; then
+ if /sbin/modprobe nfs 2>/dev/null; then
+ if /bin/mount -a -t nfs 2>/dev/null; then
+ echo "skipped - was able to reload the module"
+ exit 1
+ fi
+ fi
+ fi
+ fi
+
/sbin/reboot
+ echo "rebooting"
+ exit 0
fi
--
To view, visit https://gerrit.wikimedia.org/r/206116
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia3fbd52b8c434964e8e1420fdc00262b3fd8c668
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: coren <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits