← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~hyask/autopkgtest-cloud:skia/wait_for_deletion into autopkgtest-cloud:master

 

Skia has proposed merging ~hyask/autopkgtest-cloud:skia/wait_for_deletion into autopkgtest-cloud:master.

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)
Related bugs:
  Bug #2067628 in Auto Package Testing: "openstack core count may be inaccurate"
  https://bugs.launchpad.net/auto-package-testing/+bug/2067628

For more details, see:
https://code.launchpad.net/~hyask/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/468242

Context is all in bug #2067628
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~hyask/autopkgtest-cloud:skia/wait_for_deletion into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
index e9bc152..c9f1a3d 100755
--- a/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
+++ b/charms/focal/autopkgtest-cloud-worker/autopkgtest-cloud/worker/worker
@@ -31,6 +31,7 @@ import amqplib.client_0_8 as amqp
 import distro_info
 import novaclient.client
 import novaclient.exceptions
+import osc_lib
 import swiftclient
 import systemd.journal
 from influxdb import InfluxDBClient
@@ -669,6 +670,12 @@ def kill_openstack_server(test_uuid: str):
         if test_uuid in instance.name:
             try:
                 instance.delete()
+                if not osc_lib.utils.wait_for_delete(
+                    nova.servers,
+                    instance.id,
+                ):
+                    msg = "Error deleting server: %s" % instance.id
+                    raise RuntimeError(msg)
                 logging.info("Deleted test server: %s", instance.name)
                 return
             except novaclient.exceptions.ClientException as e: