From: Loic Dachary Date: Thu, 22 Oct 2015 23:39:07 +0000 (+0200) Subject: openstack: add ownedby property to volumes X-Git-Tag: 1.1.0~784^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F666%2Fhead;p=teuthology.git openstack: add ownedby property to volumes And delete the volumes owned by a teuthology instance on restart. Signed-off-by: Loic Dachary --- diff --git a/teuthology/openstack/openstack-teuthology.init b/teuthology/openstack/openstack-teuthology.init index a2ac79f78..6e237dccb 100755 --- a/teuthology/openstack/openstack-teuthology.init +++ b/teuthology/openstack/openstack-teuthology.init @@ -75,6 +75,11 @@ case $1 in while read uuid ; do eval openstack server delete $uuid done + openstack volume list --long -f json | \ + jq ".[] | select(.Properties | contains(\"ownedby='$ip'\")) | .ID" | \ + while read uuid ; do + eval openstack volume delete $uuid + done rm -fr /home/$user/src/* /tmp/stampsdir ;; restart) diff --git a/teuthology/provision.py b/teuthology/provision.py index 078794375..a3e7241c8 100644 --- a/teuthology/provision.py +++ b/teuthology/provision.py @@ -253,6 +253,7 @@ class ProvisionOpenStack(OpenStack): raise e misc.sh("openstack volume create -f json " + config['openstack'].get('volume-create', '') + " " + + " --property ownedby=" + config.openstack['ip'] + " --size " + str(volumes['size']) + " " + volume_name) with safe_while(sleep=2, tries=100,