]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
openstack: only destroy target/ceph- VMs on restart 800/head
authorLoic Dachary <ldachary@redhat.com>
Thu, 14 Jan 2016 07:37:27 +0000 (08:37 +0100)
committerLoic Dachary <ldachary@redhat.com>
Sat, 27 Feb 2016 07:09:33 +0000 (14:09 +0700)
Obsolete resources will be taken care of by the teuthology-nuke
--stale-openstack cron job. We just want to avoid running into obsolete
targets.

The ceph-* targets which are created by the buildpackages task must also
be disposed of.

The timestamps dir is wiped out, except for packages-repository, if
it exists.

Signed-off-by: Loic Dachary <loic@dachary.org>
teuthology/openstack/__init__.py
teuthology/openstack/openstack-teuthology.init

index 164a06244e21ac6fe3d71d5d0bf1e74d08bbce1c..402aae89775871269afd0bb39ab9cab755c70b55 100644 (file)
@@ -765,6 +765,7 @@ openstack security group rule create --proto udp --dst-port 53 teuthology # dns
         self.ssh("sudo /etc/init.d/teuthology stop || true")
         instance_id = self.get_instance_id(self.args.name)
         self.delete_floating_ip(instance_id)
+        misc.sh("openstack server delete packages-repository || true")
         misc.sh("openstack server delete --wait " + self.args.name)
 
 def main(ctx, argv):
index 67f96e08aa5506c2b923052c791849123c781167..3d02f06e1cf98b4fc8f9d029fb7111b4d217be5f 100755 (executable)
@@ -70,14 +70,24 @@ case $1 in
                 source /home/$user/teuthology/virtualenv/bin/activate
                 source /home/$user/openrc.sh
                 ip=$(ip a show dev eth0 | sed -n "s:.*inet \(.*\)/.*:\1:p")
-                openstack server list --long -f json | \
+                openstack server list --long -f json --name target | \
+                    jq ".[] | select(.Properties | contains(\"ownedby='$ip'\")) | .ID" | \
+                    xargs --no-run-if-empty --max-args 1 -P20 openstack server delete --wait
+                openstack server list --long -f json --name ceph- | \
                     jq ".[] | select(.Properties | contains(\"ownedby='$ip'\")) | .ID" | \
                     xargs --no-run-if-empty --max-args 1 -P20 openstack server delete --wait
                 openstack volume list --long -f json | \
                     jq ".[] | select(.Properties | contains(\"ownedby='$ip'\")) | .ID" | \
                     xargs --no-run-if-empty --max-args 1 -P20 openstack volume delete
                 perl -pi -e 's/.*gitbuilder_host.*/gitbuilder_host: gitbuilder.ceph.com/' /home/$user/.teuthology.yaml
-                rm -fr /home/$user/src/* /tmp/stampsdir
+                rm -fr /home/$user/src/*
+                mv /tmp/stampsdir /tmp/stampsdir.old
+                mkdir /tmp/stampsdir
+                chown $user /tmp/stampsdir
+                if test -f /tmp/stampsdir.old/packages-repository ; then
+                    mv /tmp/stampsdir.old/*packages-repository* /tmp/stampsdir
+                fi
+                rm -fr /tmp/stampsdir.old
                 ;;
         restart)
                 $0 stop