Small fixes and improvements: in cleanup, cmp_check, offline scripts
* cmp_check: use the specific vm prefix name
* cleanup.py: check whether Obj Store is present, check if volume
backup service is enabled
* init-workspace: choose the first ext net
* update-openstack-resources: remove the typo line
Related-PROD: PROD-37187
Change-Id: I6053d8e715f7f64425f7952c868e9c0a253fe677
diff --git a/cleanup.py b/cleanup.py
index 247dcbe..9ae394f 100644
--- a/cleanup.py
+++ b/cleanup.py
@@ -23,10 +23,15 @@
image = cloud.image
network = cloud.network
orchestration = cloud.orchestration
-object_store = cloud.object_store
volume = cloud.volume
load_balancer = cloud.load_balancer
+# Check if Object Storage is present on the cloud, else skip
+object_store_present = any(service.type == 'object-store' for service
+ in list(identity.services()))
+if object_store_present:
+ object_store = cloud.object_store
+
mask = "cvp|s_rally|rally_|tempest-|tempest_|spt|fio"
full_mask = f"^(?!.*(manual|-static-)).*({mask}).*$"
mask_pattern = re.compile(full_mask, re.IGNORECASE)
@@ -412,7 +417,10 @@
cleanup_load_balancers()
cleanup_servers()
cleanup_flavors()
- cleanup_volume_backups()
+ try: # Skip if cinder-backup service is not enabled
+ cleanup_volume_backups()
+ except openstack.exceptions.ResourceNotFound:
+ pass
cleanup_snapshots()
cleanup_volumes()
cleanup_volume_groups()
@@ -427,7 +435,8 @@
cleanup_regions()
cleanup_routers()
cleanup_networks()
- cleanup_containers()
+ if object_store_present:
+ cleanup_containers()
cleanup_floating_ips()
if args.projects: