diff options
author | Rex Lee <limingjiang@huawei.com> | 2018-03-07 01:14:36 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-03-07 01:14:36 +0000 |
commit | 97c3405223fc1837047cf109d9105b87bf573e63 (patch) | |
tree | 66b192a01e97efeadf2c445075abd094434d86d6 | |
parent | 5306c1fa53c3c04016bf6af975e2387d20626b3d (diff) | |
parent | 6b271bdbd529ffb62eeb8cd14a3abe72aeeb3353 (diff) |
Merge "[bugfix]tc006 failed due to volume attached to different location "/dev/vdc""
-rw-r--r-- | yardstick/benchmark/scenarios/storage/fio.py | 16 | ||||
-rw-r--r-- | yardstick/tests/unit/benchmark/scenarios/storage/test_fio.py | 16 |
2 files changed, 26 insertions, 6 deletions
diff --git a/yardstick/benchmark/scenarios/storage/fio.py b/yardstick/benchmark/scenarios/storage/fio.py index 125bc7ed4..d3ed840d8 100644 --- a/yardstick/benchmark/scenarios/storage/fio.py +++ b/yardstick/benchmark/scenarios/storage/fio.py @@ -124,12 +124,16 @@ class Fio(base.Scenario): if mount_dir: LOG.debug("Formating volume...") - self.client.execute("sudo mkfs.ext4 /dev/vdb") - cmd = "sudo mkdir %s" % mount_dir - self.client.execute(cmd) - LOG.debug("Mounting volume at: %s", mount_dir) - cmd = "sudo mount /dev/vdb %s" % mount_dir - self.client.execute(cmd) + _, stdout, _ = self.client.execute( + "lsblk -dps | grep -m 1 disk | awk '{print $1}'") + block_device = stdout.strip() + if block_device: + self.client.execute("sudo mkfs.ext4 %s" % block_device) + cmd = "sudo mkdir %s" % mount_dir + self.client.execute(cmd) + LOG.debug("Mounting volume at: %s", mount_dir) + cmd = "sudo mount %s %s" % (block_device, mount_dir) + self.client.execute(cmd) self.setup_done = True diff --git a/yardstick/tests/unit/benchmark/scenarios/storage/test_fio.py b/yardstick/tests/unit/benchmark/scenarios/storage/test_fio.py index f47d1ca29..f149cee69 100644 --- a/yardstick/tests/unit/benchmark/scenarios/storage/test_fio.py +++ b/yardstick/tests/unit/benchmark/scenarios/storage/test_fio.py @@ -61,6 +61,22 @@ class FioTestCase(unittest.TestCase): } args = {'options': options} p = fio.Fio(args, self.ctx) + mock_ssh.SSH.from_node().execute.return_value = (0, '/dev/vdb', '') + p.setup() + + mock_ssh.SSH.from_node().execute.return_value = (0, '', '') + self.assertIsNotNone(p.client) + self.assertTrue(p.setup_done) + + def test_fio_job_file_no_disk__setup(self, mock_ssh): + + options = { + 'job_file': 'job_file.ini', + 'directory': '/FIO_Test' + } + args = {'options': options} + p = fio.Fio(args, self.ctx) + mock_ssh.SSH.from_node().execute.return_value = (0, '', '') p.setup() mock_ssh.SSH.from_node().execute.return_value = (0, '', '') |