Improve logging in tempest cleanup
Add id or name of the resource which failed to delete
to the logging.
Change-Id: I04b04406e3917a63332199adf5c15b8e4ed6ca5a
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index 3aed4e8..a0ed07f 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -158,7 +158,7 @@
try:
client.delete_snapshot(snap['id'])
except Exception:
- LOG.exception("Delete Snapshot exception.")
+ LOG.exception("Delete Snapshot %s exception.", snap['id'])
def dry_run(self):
snaps = self.list()
@@ -195,7 +195,7 @@
try:
client.delete_server(server['id'])
except Exception:
- LOG.exception("Delete Server exception.")
+ LOG.exception("Delete Server %s exception.", server['id'])
def dry_run(self):
servers = self.list()
@@ -227,7 +227,7 @@
try:
client.delete_server_group(sg['id'])
except Exception:
- LOG.exception("Delete Server Group exception.")
+ LOG.exception("Delete Server Group %s exception.", sg['id'])
def dry_run(self):
sgs = self.list()
@@ -260,11 +260,11 @@
client = self.client
keypairs = self.list()
for k in keypairs:
+ name = k['keypair']['name']
try:
- name = k['keypair']['name']
client.delete_keypair(name)
except Exception:
- LOG.exception("Delete Keypairs exception.")
+ LOG.exception("Delete Keypair %s exception.", name)
def dry_run(self):
keypairs = self.list()
@@ -300,7 +300,7 @@
try:
client.delete_volume(v['id'])
except Exception:
- LOG.exception("Delete Volume exception.")
+ LOG.exception("Delete Volume %s exception.", v['id'])
def dry_run(self):
vols = self.list()
@@ -323,7 +323,8 @@
try:
client.delete_quota_set(self.project_id)
except Exception:
- LOG.exception("Delete Volume Quotas exception.")
+ LOG.exception("Delete Volume Quotas exception for 'project %s'.",
+ self.project_id)
def dry_run(self):
quotas = self.client.show_quota_set(
@@ -342,7 +343,8 @@
try:
client.delete_quota_set(self.project_id)
except Exception:
- LOG.exception("Delete Quotas exception.")
+ LOG.exception("Delete Quotas exception for 'project %s'.",
+ self.project_id)
def dry_run(self):
client = self.limits_client
@@ -397,7 +399,7 @@
try:
client.delete_network(n['id'])
except Exception:
- LOG.exception("Delete Network exception.")
+ LOG.exception("Delete Network %s exception.", n['id'])
def dry_run(self):
networks = self.list()
@@ -431,7 +433,8 @@
try:
client.delete_floatingip(flip['id'])
except Exception:
- LOG.exception("Delete Network Floating IP exception.")
+ LOG.exception("Delete Network Floating IP %s exception.",
+ flip['id'])
def dry_run(self):
flips = self.list()
@@ -467,8 +470,8 @@
ports_client = self.ports_client
routers = self.list()
for router in routers:
+ rid = router['id']
try:
- rid = router['id']
ports = [port for port
in ports_client.list_ports(device_id=rid)['ports']
if net_info.is_router_interface_port(port)]
@@ -476,7 +479,7 @@
client.remove_router_interface(rid, port_id=port['id'])
client.delete_router(rid)
except Exception:
- LOG.exception("Delete Router exception.")
+ LOG.exception("Delete Router %s exception.", rid)
def dry_run(self):
routers = self.list()
@@ -511,7 +514,8 @@
try:
client.delete_metering_label_rule(rule['id'])
except Exception:
- LOG.exception("Delete Metering Label Rule exception.")
+ LOG.exception("Delete Metering Label Rule %s exception.",
+ rule['id'])
def dry_run(self):
rules = self.list()
@@ -546,7 +550,8 @@
try:
client.delete_metering_label(label['id'])
except Exception:
- LOG.exception("Delete Metering Label exception.")
+ LOG.exception("Delete Metering Label %s exception.",
+ label['id'])
def dry_run(self):
labels = self.list()
@@ -585,7 +590,7 @@
try:
client.delete_port(port['id'])
except Exception:
- LOG.exception("Delete Port exception.")
+ LOG.exception("Delete Port %s exception.", port['id'])
def dry_run(self):
ports = self.list()
@@ -626,7 +631,8 @@
try:
client.delete_security_group(secgroup['id'])
except Exception:
- LOG.exception("Delete security_group exception.")
+ LOG.exception("Delete security_group %s exception.",
+ secgroup['id'])
def dry_run(self):
secgroups = self.list()
@@ -661,7 +667,7 @@
try:
client.delete_subnet(subnet['id'])
except Exception:
- LOG.exception("Delete Subnet exception.")
+ LOG.exception("Delete Subnet %s exception.", subnet['id'])
def dry_run(self):
subnets = self.list()
@@ -696,7 +702,7 @@
try:
client.delete_subnetpool(pool['id'])
except Exception:
- LOG.exception("Delete Subnet Pool exception.")
+ LOG.exception("Delete Subnet Pool %s exception.", pool['id'])
def dry_run(self):
pools = self.list()
@@ -736,7 +742,7 @@
try:
client.delete_flavor(flavor['id'])
except Exception:
- LOG.exception("Delete Flavor exception.")
+ LOG.exception("Delete Flavor %s exception.", flavor['id'])
def dry_run(self):
flavors = self.list()
@@ -773,7 +779,7 @@
try:
client.delete_image(image['id'])
except Exception:
- LOG.exception("Delete Image exception.")
+ LOG.exception("Delete Image %s exception.", image['id'])
def dry_run(self):
images = self.list()
@@ -816,7 +822,7 @@
try:
self.client.delete_user(user['id'])
except Exception:
- LOG.exception("Delete User exception.")
+ LOG.exception("Delete User %s exception.", user['id'])
def dry_run(self):
users = self.list()
@@ -856,7 +862,7 @@
try:
self.client.delete_role(role['id'])
except Exception:
- LOG.exception("Delete Role exception.")
+ LOG.exception("Delete Role %s exception.", role['id'])
def dry_run(self):
roles = self.list()
@@ -898,7 +904,7 @@
try:
self.client.delete_project(project['id'])
except Exception:
- LOG.exception("Delete project exception.")
+ LOG.exception("Delete project %s exception.", project['id'])
def dry_run(self):
projects = self.list()
@@ -935,7 +941,7 @@
client.update_domain(domain['id'], enabled=False)
client.delete_domain(domain['id'])
except Exception:
- LOG.exception("Delete Domain exception.")
+ LOG.exception("Delete Domain %s exception.", domain['id'])
def dry_run(self):
domains = self.list()