Log output of lsblk cmd if test_device_tagging failed
test_device_tagging has been failing twice in the last 48h with
the following error: "mount: mounting /dev/sr0 on /mnt failed: Device or
resource busy".
Add the result of the lsblk command to see whether /dev/sr0 exists
and /mnt is not already mounted.
Change-Id: I7067b87cad79f98cdf6eff83809d96dd0ac3ed2f
diff --git a/tempest/api/compute/servers/test_device_tagging.py b/tempest/api/compute/servers/test_device_tagging.py
index 57aa72e..6e5d42f 100644
--- a/tempest/api/compute/servers/test_device_tagging.py
+++ b/tempest/api/compute/servers/test_device_tagging.py
@@ -263,7 +263,17 @@
'the config drive.', server['id'])
dev_name = self.ssh_client.exec_command(cmd_blkid)
dev_name = dev_name.rstrip()
- self.ssh_client.exec_command('sudo mount %s /mnt' % dev_name)
+ try:
+ self.ssh_client.exec_command('sudo mount %s /mnt' % dev_name)
+ except exceptions.SSHExecCommandFailed:
+ # So the command failed, let's try to know why and print some
+ # useful information.
+ lsblk = self.ssh_client.exec_command('sudo lsblk --fs --ascii')
+ LOG.error("Mounting %s on /mnt failed. Right after the "
+ "failure 'lsblk' in the guest reported:\n%s",
+ dev_name, lsblk)
+ raise
+
cmd_md = 'sudo cat /mnt/openstack/latest/meta_data.json'
md_json = self.ssh_client.exec_command(cmd_md)
self.verify_device_metadata(md_json)