Add retries for security group delete

Change-Id: I8123a9475831424c34a47530c793b2a7bee553f0
This commit is contained in:
Yichen Wang 2017-08-23 15:00:02 -07:00
parent 4dec062df8
commit 78b0574dbc

View File

@ -21,6 +21,7 @@ import time
import glanceclient.exc as glance_exception import glanceclient.exc as glance_exception
import keystoneauth1 import keystoneauth1
from log import LOG from log import LOG
from neutronclient.common.exceptions import Conflict
import novaclient import novaclient
import novaclient.exceptions as exceptions import novaclient.exceptions as exceptions
@ -416,7 +417,12 @@ class Compute(object):
def security_group_delete(self, group): def security_group_delete(self, group):
if group: if group:
LOG.info("Deleting security group") LOG.info("Deleting security group")
self.neutron.delete_security_group(group["id"]) for _ in range(1, 5):
try:
self.neutron.delete_security_group(group["id"])
break
except Conflict:
time.sleep(1)
# Add rules to the security group # Add rules to the security group
def security_group_add_rules(self, group): def security_group_add_rules(self, group):