Make get_partitions() work for partitioned disks
In general case, attached disks could be partitioned,
and this leads to multiple records in /proc/partitions,
for my laptop which is:
evgeny@eantyshev2:~$ cat /proc/partitions
major minor #blocks name
8 0 125034840 sda
8 1 524288 sda1
8 2 249856 sda2
8 3 124259328 sda3
8 16 976762584 sdb
11 0 1048575 sr0
252 0 1084366848 dm-0
252 1 16650240 dm-1
QEMU adds block devices as unpartitioned disks, so that
we have 1 disk <-> 1 partition match. But this is just
an implementation specific coincidence.
Because the attached disk can have GPT table
and a primary partition covering available disk space, and in this
case it would mean 2 extra devices.
Namely, to run Tempest on Virtuozzo containers, we should allow for
partitioned disks attached.
CT-f9e98104 /# cat /proc/partitions
major minor #blocks name
182 686608 2097152 ploop42913
182 686609 2095104 ploop42913p1
182 506688 1048576 ploop31668
182 506689 1046528 ploop31668p1
Here we see 2 devices for each disk: root disk block device ploop31668,
and partition block device ploop31668p1. We only want to see
root device for each disk, not the partition ones, or
some testcases don't work
(test_verify_created_server_ephemeral_disk naturally expects
device appearance of 1 extra device).
Change-Id: Icd0043b661c41a51acf62cc07cb80c2e9bae56d4
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 3ac6759..bf52211 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -66,10 +66,10 @@
waiters.wait_for_server_status(self.servers_client,
server['id'], 'ACTIVE')
- def check_partitions(self):
+ def check_disks(self):
# NOTE(andreaf) The device name may be different on different guest OS
- partitions = self.linux_client.get_partitions()
- self.assertEqual(1, partitions.count(CONF.compute.volume_device_name))
+ disks = self.linux_client.get_disks()
+ self.assertEqual(1, disks.count(CONF.compute.volume_device_name))
def create_and_add_security_group_to_server(self, server):
secgroup = self._create_security_group()
@@ -145,7 +145,7 @@
self.linux_client = self.get_remote_client(
floating_ip['ip'], private_key=keypair['private_key'])
- self.check_partitions()
+ self.check_disks()
# delete the floating IP, this should refresh the server addresses
self.compute_floating_ips_client.delete_floating_ip(floating_ip['id'])