22# SPDX-License-Identifier: Apache-2.0
33"""Tests for guest-side operations on /drives resources."""
44
5- import concurrent
5+ import concurrent . futures
66import os
77import time
88
@@ -409,7 +409,7 @@ def run_fio(microvm, mode, block_size, test_output_dir, fio_engine="libaio"):
409409 .with_arg (f"--bs={ block_size } " )
410410 .with_arg (f"--size={ BLOCK_DEVICE_SIZE_MB } M" )
411411 .with_arg (f"--ioengine={ fio_engine } " )
412- .with_arg ("--iodepth=32 " )
412+ .with_arg ("--iodepth=256 " )
413413 # Set affinity of the entire fio process to a set of vCPUs equal in size to number of workers
414414 .with_arg (
415415 f"--cpus_allowed={ ',' .join (str (i ) for i in range (microvm .vcpus_count ))} "
@@ -431,17 +431,17 @@ def run_fio(microvm, mode, block_size, test_output_dir, fio_engine="libaio"):
431431 prepare_microvm_for_test (microvm )
432432
433433 with concurrent .futures .ThreadPoolExecutor () as executor :
434- executor .submit (_run_fio , microvm , test_output_dir )
435-
436- for _ in range (30 ):
437- microvm .ssh .check_output ("true" )
438- time .sleep (1 )
434+ fio_future = executor .submit (_run_fio , microvm , cmd , test_output_dir )
435+ while not fio_future .done ():
436+ microvm .ssh .check_output ("true" , timeout = 1 )
437+ fio_future .result ()
439438
440439
441440def _run_fio (microvm , cmd , test_output_dir ):
442- rc , _ , stderr = microvm .ssh .run (f"cd /tmp; { cmd } " )
443- assert rc == 0 , stderr
441+ rc , stdout , stderr = microvm .ssh .run (f"cd /tmp; { cmd } " )
442+ assert rc == 0
444443 assert stderr == ""
444+ print (f"standard output: { stdout } " )
445445
446446 microvm .ssh .scp_get ("/tmp/fio.json" , test_output_dir )
447447 microvm .ssh .scp_get ("/tmp/*.log" , test_output_dir )
@@ -460,22 +460,22 @@ def test_greedy_block(
460460 fio_block_size ,
461461 fio_engine ,
462462 io_engine ,
463- metrics ,
464463 results_dir ,
465464):
466465 """
467466 Make sure that a guest continuously using the block device
468467 doesn't starve a Network device
469468 """
470469 vm = microvm_factory .build (guest_kernel_acpi , rootfs , monitor_memory = False )
470+ vm .jailer .extra_args .update ({"no-seccomp" : None })
471471 vm .spawn (log_level = "Info" , emit_metrics = False )
472472 vm .basic_config (vcpu_count = vcpus , mem_size_mib = 1024 )
473473 vm .add_net_iface ()
474474
475475 # Add a secondary block device for testing
476476 fs = drive_tools .FilesystemFile (os .path .join (vm .fsfiles , "scratch" ), 4096 )
477- vm .add_drive ("scratch " , fs .path , io_engine = io_engine )
477+ vm .add_drive ("scratch2 " , fs .path , io_engine = io_engine )
478478
479479 vm .start ()
480480
481- cpu_util = run_fio (vm , fio_mode , fio_block_size , results_dir , fio_engine )
481+ run_fio (vm , fio_mode , fio_block_size , results_dir , fio_engine )
0 commit comments