Merge "Create independent mount path for each device"
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 0d93430..dd18190 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -182,6 +182,9 @@
def umount(self, mount_path='/mnt'):
self.exec_command('sudo umount %s' % mount_path)
+ def mkdir(self, dir_path):
+ self.exec_command('sudo mkdir -p %s' % dir_path)
+
def make_fs(self, dev_name, fs='ext4'):
cmd_mkfs = 'sudo mkfs -t %s /dev/%s' % (fs, dev_name)
try:
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index d51e7e5..714a7c7 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -1229,16 +1229,18 @@
# dev_name to mount_path.
target_dir = '/tmp'
if dev_name is not None:
+ mount_path = os.path.join(mount_path, dev_name)
ssh_client.make_fs(dev_name, fs=fs)
- ssh_client.exec_command('sudo mount /dev/%s %s' % (dev_name,
- mount_path))
+ ssh_client.mkdir(mount_path)
+ ssh_client.mount(dev_name, mount_path)
target_dir = mount_path
+
cmd_timestamp = 'sudo sh -c "date > %s/timestamp; sync"' % target_dir
ssh_client.exec_command(cmd_timestamp)
timestamp = ssh_client.exec_command('sudo cat %s/timestamp'
% target_dir)
if dev_name is not None:
- ssh_client.exec_command('sudo umount %s' % mount_path)
+ ssh_client.umount(mount_path)
return timestamp
def get_timestamp(self, ip_address, dev_name=None, mount_path='/mnt',
@@ -1266,12 +1268,14 @@
# dev_name to mount_path.
target_dir = '/tmp'
if dev_name is not None:
+ mount_path = os.path.join(mount_path, dev_name)
+ ssh_client.mkdir(mount_path)
ssh_client.mount(dev_name, mount_path)
target_dir = mount_path
timestamp = ssh_client.exec_command('sudo cat %s/timestamp'
% target_dir)
if dev_name is not None:
- ssh_client.exec_command('sudo umount %s' % mount_path)
+ ssh_client.umount(mount_path)
return timestamp
def get_server_ip(self, server, **kwargs):
diff --git a/tempest/scenario/test_instances_with_cinder_volumes.py b/tempest/scenario/test_instances_with_cinder_volumes.py
index 5f33b49..a907acd 100644
--- a/tempest/scenario/test_instances_with_cinder_volumes.py
+++ b/tempest/scenario/test_instances_with_cinder_volumes.py
@@ -184,28 +184,18 @@
# run write test on all volumes
for volume in attached_volumes:
- waiters.wait_for_volume_resource_status(
- self.volumes_client, volume['id'], 'in-use')
-
# get the mount path
- mount_path = f"/mnt/{volume['attachments'][0]['device'][5:]}"
-
- # create file for mounting on server
- self.create_file(ssh_ip, mount_path,
- private_key=keypair['private_key'],
- server=server)
+ dev_name = volume['attachments'][0]['device'][5:]
# dev name volume['attachments'][0]['device'][5:] is like
# /dev/vdb, we need to remove /dev/ -> first 5 chars
timestamp_before = self.create_timestamp(
ssh_ip, private_key=keypair['private_key'], server=server,
- dev_name=volume['attachments'][0]['device'][5:],
- mount_path=mount_path
+ dev_name=dev_name,
)
timestamp_after = self.get_timestamp(
ssh_ip, private_key=keypair['private_key'], server=server,
- dev_name=volume['attachments'][0]['device'][5:],
- mount_path=mount_path
+ dev_name=dev_name,
)
self.assertEqual(timestamp_before, timestamp_after)