summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJingLu5 <lvjing5@huawei.com>2018-02-23 08:04:06 +0000
committerJingLu5 <lvjing5@huawei.com>2018-02-27 09:24:48 +0000
commit6b271bdbd529ffb62eeb8cd14a3abe72aeeb3353 (patch)
tree8833152380f0f5d78fe7457abc7b2fbe852edb0c
parenta134474819400f2f7075d62990899943a06a5086 (diff)
[bugfix]tc006 failed due to volume attached to different location "/dev/vdc"
JIRA: YARDSTICK-857 The yardstick test suites are failing for os-odl-bgpvpn-ha and os-odl-bgpvpn-noha scenarios installed with apex. Here are the yardstick test run logs: os-odl-bgpvpn-ha: https://build.opnfv.org/ci/job/yardstick-apex-baremetal-daily-master/624//consoleFull, https://build.opnfv.org/ci/job/yardstick-apex-baremetal-daily-master/640//consoleFull os-odl-bgpvpn-noha: https://build.opnfv.org/ci/job/yardstick-apex-baremetal-daily-master/637//console The root cause of the problem is in some environment the block device cannot be attached to the target path. In this patch, the actually device path is found and used. Change-Id: I46c601960a0668c81f9b73504ef9553f9e8591dc Signed-off-by: JingLu5 <lvjing5@huawei.com>
-rw-r--r--yardstick/benchmark/scenarios/storage/fio.py16
-rw-r--r--yardstick/tests/unit/benchmark/scenarios/storage/test_fio.py16
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 0cffea224..a713ce728 100644
--- a/yardstick/tests/unit/benchmark/scenarios/storage/test_fio.py
+++ b/yardstick/tests/unit/benchmark/scenarios/storage/test_fio.py
@@ -63,6 +63,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, '', '')