Wait for nova_server1 to be deleted before deleting it's security group

This adds a 30 second wait loop for the nova_server1 resource to be
deleted before trying to delete it's related security group so we don't
hit a 400 error from nova-api.

This is basically a copy of what is done when deleting the
cinder_server1 resource.

Added notes that we can clean this up with the --wait option on the
`openstack server delete` command when python-openstackclient>=1.4.0 at
least in global-requirements, which will have to wait until at least the
M release since stable/kilo caps osc at <1.1.0.

Closes-Bug: #1460112

Change-Id: I16981765c12db7145f7c4754d454431afb6d5cbb
This commit is contained in:
Matt Riedemann 2015-07-08 16:18:38 -07:00
parent 068998467c
commit 48d23a6bae
2 changed files with 7 additions and 0 deletions

View File

@ -114,6 +114,11 @@ function destroy {
openstack ip floating remove $(resource_get nova nova_server_ip) $NOVA_SERVER
openstack ip floating delete $(resource_get nova nova_server_float)
openstack server delete $NOVA_SERVER
# wait for server to be down before we delete the security group
# TODO(mriedem): Use the --wait option with the openstack server delete
# command when python-openstackclient>=1.4.0 is in global-requirements.
local wait_cmd="while openstack server show $NOVA_SERVER >/dev/null; do sleep 1; done"
timeout 30 sh -c "$wait_cmd"
nova secgroup-delete $NOVA_USER || /bin/true

View File

@ -178,6 +178,8 @@ function destroy {
openstack server delete $CINDER_SERVER
# wait for server to be down before we delete the volume
# TODO(mriedem): Use the --wait option with the openstack server delete
# command when python-openstackclient>=1.4.0 is in global-requirements.
local wait_cmd="while openstack server show $CINDER_SERVER >/dev/null; do sleep 1; done"
timeout 30 sh -c "$wait_cmd"