Ryan Harper has proposed merging 
~raharper/cloud-init:fix/cloud-tests-lxd-retry-delete into cloud-init:master.

Commit message:
cloud_test/lxd: Retry container delete a few times

LXD integration tests fail sometimes due to failure to delete the
container, usually related to ZFS backend.  This is a transient
issue unrelated to the test itself.  Teach LXD platform to retry
this a few times before returning an error.

Requested reviews:
  cloud-init Commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/374043
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~raharper/cloud-init:fix/cloud-tests-lxd-retry-delete into cloud-init:master.
diff --git a/tests/cloud_tests/platforms/lxd/instance.py b/tests/cloud_tests/platforms/lxd/instance.py
index 83c97ab..027c1dd 100644
--- a/tests/cloud_tests/platforms/lxd/instance.py
+++ b/tests/cloud_tests/platforms/lxd/instance.py
@@ -224,7 +224,17 @@ class LXDInstance(Instance):
         LOG.debug("%s: deleting container.", self)
         self.unfreeze()
         self.shutdown()
-        self.pylxd_container.delete(wait=True)
+        retries = [1] * 5
+        for attempt, wait in enumerate(retries):
+            try:
+                self.pylxd_container.delete(wait=True)
+                break
+            except Exception:
+                if attempt + 1 >= len(retries):
+                    raise
+                LOG.debug('Failed to delete container %s (%s/%s) retrying...',
+                          self, attempt + 1, len(retries))
+
         self._pylxd_container = None
 
         if self.platform.container_exists(self.name):
_______________________________________________
Mailing list: https://launchpad.net/~cloud-init-dev
Post to     : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to