@@ -643,8 +643,7 @@ def write_file_via_ssh(vm: virt_util.VirtualMachineForTests, filename: str, cont
643643 content: Content to write to the file
644644 """
645645 cmd = shlex .split (f"echo { shlex .quote (content )} > { shlex .quote (filename )} && sync" )
646- run_ssh_commands (host = vm .ssh_exec , commands = cmd )
647-
646+ run_ssh_commands (host = vm .ssh_exec , commands = cmd , wait_timeout = TIMEOUT_2MIN , sleep = TIMEOUT_5SEC )
648647
649648
650649def run_command_on_vm_and_check_output (vm , command , expected_result ):
@@ -661,6 +660,8 @@ def run_command_on_vm_and_check_output(vm, command, expected_result):
661660 cmd_output = run_ssh_commands (
662661 host = vm .ssh_exec ,
663662 commands = shlex .split (f"bash -c { shlex .quote (command )} " ),
663+ wait_timeout = TIMEOUT_2MIN ,
664+ sleep = TIMEOUT_5SEC ,
664665 )[0 ].strip ()
665666 expected_result = expected_result .strip ()
666667 assert expected_result in cmd_output , f"Expected '{ expected_result } ' in output '{ cmd_output } '"
@@ -673,9 +674,10 @@ def run_command_on_cirros_vm_and_check_output(vm, command, expected_result):
673674
674675
675676def assert_disk_serial (vm , command = shlex .split ("sudo ls /dev/disk/by-id" )):
676- assert HOTPLUG_DISK_SERIAL in run_ssh_commands (host = vm .ssh_exec , commands = command )[0 ], (
677- f"hotplug disk serial id { HOTPLUG_DISK_SERIAL } is not in VM"
678- )
677+ assert (
678+ HOTPLUG_DISK_SERIAL
679+ in run_ssh_commands (host = vm .ssh_exec , commands = command , wait_timeout = TIMEOUT_2MIN , sleep = TIMEOUT_5SEC )[0 ]
680+ ), f"hotplug disk serial id { HOTPLUG_DISK_SERIAL } is not in VM"
679681
680682
681683def assert_hotplugvolume_nonexist (vm ):
@@ -811,6 +813,8 @@ def check_disk_count_in_vm(vm):
811813 out = run_ssh_commands (
812814 host = vm .ssh_exec ,
813815 commands = [shlex .split ("lsblk | grep disk | grep -v SWAP| wc -l" )],
816+ wait_timeout = TIMEOUT_2MIN ,
817+ sleep = TIMEOUT_5SEC ,
814818 )[0 ].strip ()
815819 assert out == str (len (vm .instance .spec .template .spec .domain .devices .disks )), (
816820 "Failed to verify actual disk count against VMI"
0 commit comments