+ 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 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)
+
+ # copy script to host
+ self.client._put_file_shell(self.target_script, '~/fio.sh')
+
+ mount_dir = self.options.get("directory", None)
+
+ if mount_dir:
+ LOG.debug("Formating volume...")
+ _, 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)