scripts, test: fix python overindent issues

Signed-off-by: shahar salzman <shahar.salzman@kaminario.com>
Change-Id: I52f3b39d1ae7d0454a2a3d5f2564aae2c758cab7
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449992
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
shahar salzman 2019-04-03 10:47:43 +03:00 committed by Jim Harris
parent c1dd96ae63
commit 21cfc857ff
3 changed files with 55 additions and 55 deletions

View File

@ -68,11 +68,11 @@ def main():
configure_devices(devices)
try:
fio_executable = check_output("which fio", shell=True).split()[0]
fio_executable = check_output("which fio", shell=True).split()[0]
except CalledProcessError as e:
sys.stderr.write(str(e))
sys.stderr.write("\nCan't find the fio binary, please install it.\n")
sys.exit(1)
sys.stderr.write(str(e))
sys.stderr.write("\nCan't find the fio binary, please install it.\n")
sys.exit(1)
device_paths = ['/dev/' + dev for dev in devices]
print("Device paths:")

View File

@ -76,7 +76,7 @@ class ServerHandler(BaseHTTPRequestHandler):
def do_POST(self):
if self.headers['Authorization'] != 'Basic ' + self.key:
self.do_AUTHHEAD()
self.do_AUTHHEAD()
else:
data_string = self.rfile.read(int(self.headers['Content-Length']))

View File

@ -45,66 +45,66 @@ def save_file(path, mode, contents):
def run_fio(vms, fio_cfg_fname, out_path, perf_vmex=False, json=False):
global fio_bin
job_name = os.path.splitext(os.path.basename(fio_cfg_fname))[0]
global fio_bin
job_name = os.path.splitext(os.path.basename(fio_cfg_fname))[0]
# Build command for FIO
fio_cmd = " ".join([fio_bin, "--eta=never"])
if json:
fio_cmd = " ".join([fio_bin, "--output-format=json"])
for vm in vms:
# vm[0] = IP address, vm[1] = Port number
fio_cmd = " ".join([fio_cmd,
"--client={vm_ip},{vm_port}".format(vm_ip=vm[0], vm_port=vm[1]),
"--remote-config {cfg}".format(cfg=fio_cfg_fname)])
print(fio_cmd)
# Build command for FIO
fio_cmd = " ".join([fio_bin, "--eta=never"])
if json:
fio_cmd = " ".join([fio_bin, "--output-format=json"])
for vm in vms:
# vm[0] = IP address, vm[1] = Port number
fio_cmd = " ".join([fio_cmd,
"--client={vm_ip},{vm_port}".format(vm_ip=vm[0], vm_port=vm[1]),
"--remote-config {cfg}".format(cfg=fio_cfg_fname)])
print(fio_cmd)
if perf_vmex:
perf_dir = os.path.join(out_path, "perf_stats")
try:
os.mkdir(perf_dir)
except OSError:
pass
if perf_vmex:
perf_dir = os.path.join(out_path, "perf_stats")
try:
os.mkdir(perf_dir)
except OSError:
pass
# Start gathering perf statistics for host and VM guests
perf_rec_file = os.path.join(perf_dir, "perf.data.kvm")
perf_run_cmd = "perf kvm --host --guest " + \
"-o {0} stat record -a".format(perf_rec_file)
print(perf_run_cmd)
perf_p = exec_cmd(perf_run_cmd, blocking=False)
# Start gathering perf statistics for host and VM guests
perf_rec_file = os.path.join(perf_dir, "perf.data.kvm")
perf_run_cmd = "perf kvm --host --guest " + \
"-o {0} stat record -a".format(perf_rec_file)
print(perf_run_cmd)
perf_p = exec_cmd(perf_run_cmd, blocking=False)
# Run FIO test on VMs
rc, out = exec_cmd(fio_cmd, blocking=True)
# Run FIO test on VMs
rc, out = exec_cmd(fio_cmd, blocking=True)
# if for some reason output contains lines with "eta" - remove them
out = re.sub(r'.+\[eta\s+\d{2}m:\d{2}s\]', '', out)
# if for some reason output contains lines with "eta" - remove them
out = re.sub(r'.+\[eta\s+\d{2}m:\d{2}s\]', '', out)
print(out)
print(out)
if rc != 0:
print("ERROR! While executing FIO jobs - RC: {rc}".format(rc=rc, out=out))
sys.exit(rc)
else:
save_file(os.path.join(out_path, ".".join([job_name, "log"])), "w", out)
if rc != 0:
print("ERROR! While executing FIO jobs - RC: {rc}".format(rc=rc, out=out))
sys.exit(rc)
else:
save_file(os.path.join(out_path, ".".join([job_name, "log"])), "w", out)
if perf_vmex:
# Stop gathering perf statistics and prepare some result files
perf_p.send_signal(signal.SIGINT)
perf_p.wait()
if perf_vmex:
# Stop gathering perf statistics and prepare some result files
perf_p.send_signal(signal.SIGINT)
perf_p.wait()
perf_stat_cmd = "perf kvm --host -i {perf_rec} stat report --event vmexit"\
.format(perf_rec=perf_rec_file)
perf_stat_cmd = "perf kvm --host -i {perf_rec} stat report --event vmexit"\
.format(perf_rec=perf_rec_file)
rc, out = exec_cmd(" ".join([perf_stat_cmd, "--event vmexit"]),
blocking=True)
print("VMexit host stats:")
print("{perf_out}".format(perf_out=out))
save_file(os.path.join(perf_dir, "vmexit_stats_" + job_name),
"w", "{perf_out}".format(perf_out=out))
try:
os.remove(perf_rec_file)
except OSError:
pass
rc, out = exec_cmd(" ".join([perf_stat_cmd, "--event vmexit"]),
blocking=True)
print("VMexit host stats:")
print("{perf_out}".format(perf_out=out))
save_file(os.path.join(perf_dir, "vmexit_stats_" + job_name),
"w", "{perf_out}".format(perf_out=out))
try:
os.remove(perf_rec_file)
except OSError:
pass
def main():