X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=yardstick%2Fbenchmark%2Fscenarios%2Fstorage%2Ffio.py;h=c57c6edf2eef4a99c545a3d73626eedbe7e139c3;hb=ce1cdc595a7c386cfa02fa03fb182eead3b92661;hp=98fe26973f30510c353a6bb6dd2e34d578e9ce13;hpb=b2552579f300ec9f4c2b516eb44cac0efb3d4dd6;p=yardstick.git diff --git a/yardstick/benchmark/scenarios/storage/fio.py b/yardstick/benchmark/scenarios/storage/fio.py index 98fe26973..c57c6edf2 100644 --- a/yardstick/benchmark/scenarios/storage/fio.py +++ b/yardstick/benchmark/scenarios/storage/fio.py @@ -32,6 +32,10 @@ class Fio(base.Scenario): type: string unit: na default: None + job_file_config - content of job configuration file + type: list + unit: na + default: None directory - mount directoey for test volume type: string unit: na @@ -90,15 +94,26 @@ class Fio(base.Scenario): self.client.wait(timeout=600) self.job_file = self.options.get("job_file", None) + config_lines = self.options.get("job_file_config", None) if self.job_file: self.job_file_script = pkg_resources.resource_filename( "yardstick.resources", 'files/' + self.job_file) - # copy script to host + # copy job file to host self.client._put_file_shell(self.job_file_script, '~/job_file.ini') + elif config_lines: + LOG.debug("Job file configuration received, Fio job file will be created.") + self.job_file = 'tmp_job_file.ini' + self.job_file_script = pkg_resources.resource_filename( + "yardstick.resources", 'files/' + self.job_file) + with open(self.job_file_script, 'w') as f: + f.write('\n'.join(str(line) for line in config_lines)) + # copy job file to host + self.client._put_file_shell(self.job_file_script, '~/job_file.ini') else: + LOG.debug("No job file configuration received, Fio will use parameters.") self.target_script = pkg_resources.resource_filename( "yardstick.benchmark.scenarios.storage", Fio.TARGET_SCRIPT) @@ -109,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 @@ -204,7 +223,7 @@ class Fio(base.Scenario): sla_error += "%s %d < " \ "sla:%s(%d); " % (k, v, k, min_v) - assert sla_error == "", sla_error + self.verify_SLA(sla_error == "", sla_error) def _test():