Merge "Create independent mount path for each device"
This commit is contained in:
commit
3619d297d5
@ -182,6 +182,9 @@ class RemoteClient(remote_client.RemoteClient):
|
||||
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:
|
||||
|
@ -1229,16 +1229,18 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
||||
# 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 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
||||
# 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):
|
||||
|
@ -184,28 +184,18 @@ class TestInstancesWithCinderVolumes(manager.ScenarioTest):
|
||||
# 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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user