From 1d6c4a23a24424f4d224b85584d13eb8c963a87f Mon Sep 17 00:00:00 2001 From: Yichen Wang Date: Wed, 4 Sep 2019 21:10:03 -0700 Subject: [PATCH] Add retries for deleting VMs Change-Id: I5f4d2b5577b3ff252ec69603c4d77656d21022c5 --- .gitreview | 2 +- vmtp/compute.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitreview b/.gitreview index 9df36b5..09b9c72 100644 --- a/.gitreview +++ b/.gitreview @@ -1,4 +1,4 @@ [gerrit] host=review.openstack.org port=29418 -project=openstack/vmtp.git +project=x/vmtp.git diff --git a/vmtp/compute.py b/vmtp/compute.py index 70e71fb..5f6fb72 100644 --- a/vmtp/compute.py +++ b/vmtp/compute.py @@ -230,7 +230,12 @@ class Compute(object): return False def delete_server(self, server): - self.novaclient.servers.delete(server) + for _ in range(1, 5): + try: + self.novaclient.servers.delete(server) + except novaclient.exceptions.NotFound: + break + time.sleep(2) def find_flavor(self, flavor_type): try: