swift/doc/saio/bin/resetswift
Tim Burke 6c360a70bf saio: Stop processes more forcefully in resetswift
We sometimes see probe test failures in the gate where `resetswift`
fails like

    umount: /mnt/sdb1: target is busy.

It seems to be because `swift-init all kill` is just a stop with a
status check after the fact. Add an orphan sweep afterwards to make
sure worker subprocesses got cleaned up, too.

Change-Id: I533b436a35e5c3deb7488e9961b55f2274c14751
2020-11-04 08:13:57 -08:00

31 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
set -e
swift-init all kill
swift-orphans -a 0 -k KILL
# Remove the following line if you did not set up rsyslog for individual logging:
sudo find /var/log/swift -type f -exec rm -f {} \;
if cut -d' ' -f2 /proc/mounts | grep -q /mnt/sdb1 ; then
sudo umount /mnt/sdb1
fi
# If you are using a loopback device set SAIO_BLOCK_DEVICE to "/srv/swift-disk"
sudo mkfs.xfs -f ${SAIO_BLOCK_DEVICE:-/dev/sdb1}
sudo mount /mnt/sdb1
sudo mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4
sudo chown ${USER}:${USER} /mnt/sdb1/*
mkdir -p /srv/1/node/sdb1 /srv/1/node/sdb5 \
/srv/2/node/sdb2 /srv/2/node/sdb6 \
/srv/3/node/sdb3 /srv/3/node/sdb7 \
/srv/4/node/sdb4 /srv/4/node/sdb8
sudo rm -f /var/log/debug /var/log/messages /var/log/rsyncd.log /var/log/syslog
find /var/cache/swift* -type f -name *.recon -exec rm -f {} \;
if [ "`type -t systemctl`" == "file" ]; then
sudo systemctl restart rsyslog
sudo systemctl restart memcached
else
sudo service rsyslog restart
sudo service memcached restart
fi