/** * Performs workload dependent preconditioning - this method must be * implemented by sub-classes. It should return one of the following * values: * TRUE: preconditioning successful and steady state achieved * FALSE: preconditioning successful but steady state not achieved * NULL: preconditioning failed * @return boolean */ public function wdpc() { $status = NULL; $verbose = isset($this->options['verbose']) && $this->options['verbose']; BlockStorageTest::printMsg(sprintf('Initiating workload dependent preconditioning and steady state for XSR test'), $verbose, __FILE__, __LINE__); // TODO return $status; }
/** * overrides the parent method in order to write javascript files for 128k * and 1024k workloads separately */ public function generateJson($dir = NULL) { $generated = FALSE; if ($this->bs !== NULL) { return parent::generateJson($dir, $this->bs); } else { foreach (array_keys($this->subtests) as $bs) { $generated = $this->subtests[$bs]->generateJson($dir); } } return $generated; }
if (!$controller->wipc()) { $exitCode = 1; print_msg(sprintf('Testing aborted because workload independent preconditioning failed and --noprecondition argument was not specified'), $verbose, __FILE__, __LINE__, TRUE); break; } else { print_msg(sprintf('Workload independent preconditioning successful - continuing testing'), $verbose, __FILE__, __LINE__); } } // workload dependent pre-conditioning & testing $status = $controller->wdpc(); if ($status !== NULL) { print_msg(sprintf('Workload dependent preconditioning for test %s successful%s. wdpcComplete=%d; wdpcIntervals=%d. Generating test artifacts...', $test, $status ? '' : ' - but steady state was not achieved', $controller->wdpcComplete, $controller->wdpcIntervals), $verbose, __FILE__, __LINE__); // generate fio JSON output $controller->generateJson(); $controllers[$test] =& $controller; } else { print_msg(sprintf('Workload dependent preconditioning for test %s failed', strtoupper($test)), $verbose, __FILE__, __LINE__, TRUE); } $controller->stop(); } else { print_msg(sprintf('Unable to get %s test controller', $test), $verbose, __FILE__, __LINE__, TRUE); } } // generate report if (!$exitCode && count($controllers)) { print_msg(sprintf('Generating reports...'), $verbose, __FILE__, __LINE__); BlockStorageTest::generateReports($controllers); print_msg(sprintf('Report generation complete'), $verbose, __FILE__, __LINE__); } print_msg(sprintf('Exiting with status code %d', $exitCode), $verbose, __FILE__, __LINE__); exit($exitCode);
if ($db->addRow($test, $results)) { print_msg(sprintf('Successfully saved %s test results', $test), isset($args['verbose']), __FILE__, __LINE__); } else { print_msg(sprintf('Failed to save %s test results', $test), isset($args['verbose']), __FILE__, __LINE__, TRUE); } // save fio results if (!isset($args['nosave_fio'])) { $files = $test == 'throughput' ? array(sprintf('%s/fio-%s-1024k.json', $dir, $test), sprintf('%s/fio-%s-128k.json', $dir, $test)) : array(sprintf('%s/fio-%s.json', $dir, $test)); foreach ($files as $file) { if (file_exists($file) && ($results = json_decode(file_get_contents($file), TRUE)) && isset($results['jobs'])) { $njobs = count($results['jobs']); foreach ($results['jobs'] as $i => $job) { if ($row = BlockStorageTest::getFioJobRow($job)) { $row['test'] = $test; $row['iteration'] = $iteration; $row = array_merge(BlockStorageTest::getMetaCols($dir), $row); if ($db->addRow('fio', $row)) { print_msg(sprintf('Successfully saved job %s to fio table', $row['jobname']), isset($args['verbose']), __FILE__, __LINE__); } else { print_msg(sprintf('Failed to save job %s to fio table', $row['jobname']), isset($args['verbose']), __FILE__, __LINE__, TRUE); } } else { print_msg(sprintf('Unable to get fio row data for job %s', $row['jobname']), isset($args['verbose']), __FILE__, __LINE__, TRUE); } } } else { print_msg(sprintf('Failed to save fio results from file %s', basename($file)), isset($args['verbose']), __FILE__, __LINE__, TRUE); } } } else { print_msg(sprintf('%s fio results will not be saved because the --nosave_fio argument was set', $test), isset($args['verbose']), __FILE__, __LINE__);
/** * validate run options. returns an array populated with error messages * indexed by the argument name. If options are valid, the array returned * will be empty * @param array $options the run options (see BlockStorageTest::getRunOptions) * @return array */ public static function validateRunOptions($options) { $validate = array('active_range' => array('min' => 1, 'max' => 100), 'font_size' => array('min' => 6, 'max' => 64), 'oio_per_thread' => array('min' => 1, 'max' => 256), 'output' => array('write' => TRUE), 'precondition_passes' => array('min' => 1, 'max' => 5), 'skip_blocksize' => array('option' => array('1m', '128k', '64k', '32k', '16k', '8k', '512b')), 'skip_workload' => array('option' => array('100/0', '95/5', '65/35', '50/50', '35/65', '5/95')), 'ss_max_rounds' => array('min' => 5, 'max' => 100), 'ss_verification' => array('min' => 1, 'max' => 100), 'target' => array('required' => TRUE, 'write' => TRUE), 'test' => array('option' => BlockStorageTest::getSupportedTests(), 'required' => TRUE), 'threads' => array('min' => 1), 'threads_per_core_max' => array('min' => 1), 'threads_per_target_max' => array('min' => 1), 'timeout' => array('min' => 3600), 'trim_offset_end' => array('min' => 1), 'wd_test_duration' => array('min' => 10)); if (!($valid = validate_options($options, $validate))) { $devices = 0; $volumes = 0; // device and volume type targets cannot be mixed foreach ($options['target'] as $target) { $device = BlockStorageTest::getDevice($target); $device == $target ? $devices++ : $volumes++; } if ($devices && $volumes) { $valid = array('target' => 'Device and volume type targets cannot be mixed'); } // validate collectd rrd options if (isset($options['collectd_rrd'])) { if (!ch_check_sudo()) { $valid['collectd_rrd'] = 'sudo privilege is required to use this option'; } else { if (!is_dir($options['collectd_rrd_dir'])) { $valid['collectd_rrd_dir'] = sprintf('The directory %s does not exist', $options['collectd_rrd_dir']); } else { if (shell_exec('ps aux | grep collectd | wc -l') * 1 < 2) { $valid['collectd_rrd'] = 'collectd is not running'; } else { if (shell_exec(sprintf('find %s -maxdepth 1 -type d 2>/dev/null | wc -l', $options['collectd_rrd_dir'])) * 1 < 2) { $valid['collectd_rrd_dir'] = sprintf('The directory %s is empty', $options['collectd_rrd_dir']); } } } } } } return $valid; }