Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
running_vm,
update_vm_efi_spec_and_restart,
validate_libvirt_persistent_domain,
validate_pause_optional_migrate_unpause_linux_vm,
validate_pause_unpause_linux_vm,
validate_virtctl_guest_agent_data_over_time,
wait_for_console,
)
Expand Down Expand Up @@ -135,12 +135,12 @@ def test_migrate_vm(self, skip_access_mode_rwo_scope_class, golden_image_rhel_vm
@pytest.mark.polarion("CNV-11836")
@pytest.mark.dependency(depends=[f"{TESTS_MODULE_IDENTIFIER}::{TESTS_MIGRATE_VM}"])
def test_pause_unpause_vm(self, golden_image_rhel_vm_with_instance_type):
validate_pause_optional_migrate_unpause_linux_vm(vm=golden_image_rhel_vm_with_instance_type)
validate_pause_unpause_linux_vm(vm=golden_image_rhel_vm_with_instance_type)

@pytest.mark.polarion("CNV-11837")
@pytest.mark.dependency(depends=[f"{TESTS_MODULE_IDENTIFIER}::{TESTS_MIGRATE_VM}"])
def test_pause_unpause_after_migrate(self, golden_image_rhel_vm_with_instance_type, ping_process_in_rhel_os):
validate_pause_optional_migrate_unpause_linux_vm(
validate_pause_unpause_linux_vm(
vm=golden_image_rhel_vm_with_instance_type,
pre_pause_pid=ping_process_in_rhel_os(golden_image_rhel_vm_with_instance_type),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
migrate_vm_and_verify,
running_vm,
validate_libvirt_persistent_domain,
validate_pause_optional_migrate_unpause_linux_vm,
validate_pause_unpause_linux_vm,
validate_virtctl_guest_agent_after_guest_reboot,
validate_virtctl_guest_agent_data_over_time,
wait_for_console,
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_vm_smbios_default(self, smbios_from_kubevirt_config, matrix_centos_os_v
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::start_vm"])
@pytest.mark.polarion("CNV-5918")
def test_pause_unpause_vm(self, matrix_centos_os_vm_from_template):
validate_pause_optional_migrate_unpause_linux_vm(vm=matrix_centos_os_vm_from_template)
validate_pause_unpause_linux_vm(vm=matrix_centos_os_vm_from_template)

@pytest.mark.rwx_default_storage
@pytest.mark.polarion("CNV-5841")
Expand All @@ -132,9 +132,7 @@ def test_migrate_vm(self, matrix_centos_os_vm_from_template):
@pytest.mark.polarion("CNV-5904")
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::migrate_vm_and_verify"])
def test_pause_unpause_after_migrate(self, matrix_centos_os_vm_from_template, ping_process_in_centos_os):
validate_pause_optional_migrate_unpause_linux_vm(
vm=matrix_centos_os_vm_from_template, pre_pause_pid=ping_process_in_centos_os
)
validate_pause_unpause_linux_vm(vm=matrix_centos_os_vm_from_template, pre_pause_pid=ping_process_in_centos_os)

@pytest.mark.polarion("CNV-6008")
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::migrate_vm_and_verify"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
migrate_vm_and_verify,
running_vm,
validate_libvirt_persistent_domain,
validate_pause_optional_migrate_unpause_linux_vm,
validate_pause_unpause_linux_vm,
validate_virtctl_guest_agent_after_guest_reboot,
validate_virtctl_guest_agent_data_over_time,
wait_for_console,
Expand Down Expand Up @@ -194,7 +194,7 @@ def test_vm_machine_type(self, matrix_fedora_os_vm_from_template):
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::start_vm"])
@pytest.mark.polarion("CNV-5917")
def test_pause_unpause_vm(self, matrix_fedora_os_vm_from_template):
validate_pause_optional_migrate_unpause_linux_vm(vm=matrix_fedora_os_vm_from_template)
validate_pause_unpause_linux_vm(vm=matrix_fedora_os_vm_from_template)

@pytest.mark.rwx_default_storage
@pytest.mark.ibm_bare_metal
Expand All @@ -211,9 +211,7 @@ def test_migrate_vm(self, matrix_fedora_os_vm_from_template):
@pytest.mark.polarion("CNV-5901")
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::migrate_vm_and_verify"])
def test_pause_unpause_after_migrate(self, matrix_fedora_os_vm_from_template, ping_process_in_fedora_os):
validate_pause_optional_migrate_unpause_linux_vm(
vm=matrix_fedora_os_vm_from_template, pre_pause_pid=ping_process_in_fedora_os
)
validate_pause_unpause_linux_vm(vm=matrix_fedora_os_vm_from_template, pre_pause_pid=ping_process_in_fedora_os)

@pytest.mark.polarion("CNV-6006")
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::migrate_vm_and_verify"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
vm_os_version,
)
from utilities import console
from utilities.constants import LINUX_STR, QUARANTINED
from utilities.constants import LINUX_STR
from utilities.infra import validate_os_info_vmi_vs_linux_os
from utilities.virt import (
assert_linux_efi,
Expand All @@ -26,7 +26,7 @@
running_vm,
update_vm_efi_spec_and_restart,
validate_libvirt_persistent_domain,
validate_pause_optional_migrate_unpause_linux_vm,
validate_pause_unpause_linux_vm,
validate_virtctl_guest_agent_after_guest_reboot,
validate_virtctl_guest_agent_data_over_time,
wait_for_console,
Expand Down Expand Up @@ -174,13 +174,12 @@ def test_vm_machine_type(self, matrix_rhel_os_vm_from_template):
def test_vm_smbios_default(self, smbios_from_kubevirt_config, matrix_rhel_os_vm_from_template):
check_vm_xml_smbios(vm=matrix_rhel_os_vm_from_template, cm_values=smbios_from_kubevirt_config)

@pytest.mark.xfail(reason=f"{QUARANTINED}: Flake in pause VM checks; CNV-70033", run=False)
@pytest.mark.arm64
@pytest.mark.sno
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::start_vm"])
@pytest.mark.polarion("CNV-5916")
def test_pause_unpause_vm(self, matrix_rhel_os_vm_from_template):
validate_pause_optional_migrate_unpause_linux_vm(vm=matrix_rhel_os_vm_from_template)
validate_pause_unpause_linux_vm(vm=matrix_rhel_os_vm_from_template)

@pytest.mark.arm64
@pytest.mark.smoke
Expand All @@ -199,7 +198,7 @@ def test_migrate_vm(self, matrix_rhel_os_vm_from_template):
@pytest.mark.polarion("CNV-5902")
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::migrate_vm_and_verify"])
def test_pause_unpause_after_migrate(self, matrix_rhel_os_vm_from_template, ping_process_in_rhel_os):
validate_pause_optional_migrate_unpause_linux_vm(
validate_pause_unpause_linux_vm(
vm=matrix_rhel_os_vm_from_template,
pre_pause_pid=ping_process_in_rhel_os(matrix_rhel_os_vm_from_template),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
validate_os_info_virtctl_vs_windows_os,
validate_user_info_virtctl_vs_windows_os,
)
from tests.virt.utils import validate_pause_optional_migrate_unpause_windows_vm
from tests.virt.utils import validate_pause_unpause_windows_vm
from utilities.constants import OS_FLAVOR_WINDOWS
from utilities.guest_support import assert_windows_efi, check_vm_xml_hyperv, check_windows_vm_hvinfo
from utilities.ssp import validate_os_info_vmi_vs_windows_os
Expand Down Expand Up @@ -113,7 +113,7 @@ def test_vm_machine_type(self, matrix_windows_os_vm_from_template):
@pytest.mark.polarion("CNV-3087")
def test_pause_unpause_vm(self, matrix_windows_os_vm_from_template):
"""Test VM pause and unpause"""
validate_pause_optional_migrate_unpause_windows_vm(vm=matrix_windows_os_vm_from_template)
validate_pause_unpause_windows_vm(vm=matrix_windows_os_vm_from_template)

@pytest.mark.sno
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::start_vm"])
Expand All @@ -134,7 +134,7 @@ def test_migrate_vm(self, matrix_windows_os_vm_from_template):
@pytest.mark.polarion("CNV-5903")
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::migrate_vm_and_verify"])
def test_pause_unpause_after_migrate(self, matrix_windows_os_vm_from_template, regedit_process_in_windows_os):
validate_pause_optional_migrate_unpause_windows_vm(
validate_pause_unpause_windows_vm(
vm=matrix_windows_os_vm_from_template, pre_pause_pid=regedit_process_in_windows_os
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from utilities.virt import (
CIRROS_IMAGE,
VirtualMachineForTests,
pause_optional_migrate_unpause_and_check_connectivity,
pause_unpause_vm_and_check_connectivity,
)

pytestmark = [
Expand Down Expand Up @@ -119,7 +119,7 @@ def test_pause_unpause_hostdevices_rhel_vm(self, gpu_vma):
Test VM with Device using hostdevices spec, can be paused and unpaused successfully.
"""
with running_sleep_in_linux(vm=gpu_vma):
pause_optional_migrate_unpause_and_check_connectivity(vm=gpu_vma)
pause_unpause_vm_and_check_connectivity(vm=gpu_vma)

@pytest.mark.dependency(depends=[f"{TESTS_CLASS_RHEL_HOSTDEVICES_NAME}::test_access_hostdevices_rhel_vm"])
@pytest.mark.polarion("CNV-5641")
Expand Down Expand Up @@ -164,7 +164,7 @@ def test_pause_unpause_gpus_rhel_vm(self, gpu_vma):
Test VM with Device using GPUS spec, can be paused and unpaused successfully.
"""
with running_sleep_in_linux(vm=gpu_vma):
pause_optional_migrate_unpause_and_check_connectivity(vm=gpu_vma)
pause_unpause_vm_and_check_connectivity(vm=gpu_vma)

@pytest.mark.dependency(depends=[f"{TESTS_CLASS_RHEL_GPUS_NAME}::access_gpus_rhel_vm"])
@pytest.mark.polarion("CNV-5642")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from tests.virt.node.gpu.utils import (
restart_and_check_gpu_exists,
)
from tests.virt.utils import validate_pause_optional_migrate_unpause_windows_vm, verify_gpu_device_exists_in_vm
from tests.virt.utils import validate_pause_unpause_windows_vm, verify_gpu_device_exists_in_vm
from utilities.constants import Images

pytestmark = [
Expand Down Expand Up @@ -72,7 +72,7 @@ def test_pause_unpause_hostdevices_win_vm(self, gpu_vma):
"""
Test Windows VM with Device using hostdevices spec, can be paused and unpaused successfully.
"""
validate_pause_optional_migrate_unpause_windows_vm(vm=gpu_vma)
validate_pause_unpause_windows_vm(vm=gpu_vma)

@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::test_access_hostdevices_win_vm"])
@pytest.mark.polarion("CNV-5648")
Expand All @@ -96,7 +96,7 @@ def test_pause_unpause_gpus_win_vm(self, gpu_vma):
"""
Test Windows VM with Device using gpus spec, can be paused and unpaused successfully.
"""
validate_pause_optional_migrate_unpause_windows_vm(vm=gpu_vma)
validate_pause_unpause_windows_vm(vm=gpu_vma)

@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::test_access_gpus_win_vm"])
@pytest.mark.polarion("CNV-5744")
Expand Down
4 changes: 2 additions & 2 deletions tests/virt/node/gpu/vgpu/test_rhel_vm_with_vgpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
)
from utilities.virt import (
VirtualMachineForTestsFromTemplate,
pause_optional_migrate_unpause_and_check_connectivity,
pause_unpause_vm_and_check_connectivity,
running_vm,
vm_instance_from_template,
)
Expand Down Expand Up @@ -152,7 +152,7 @@ def test_pause_unpause_vgpus_rhel_vm(self, gpu_vma):
Test VM with vGPU using GPUs spec, can be paused and unpaused successfully.
"""
with running_sleep_in_linux(vm=gpu_vma):
pause_optional_migrate_unpause_and_check_connectivity(vm=gpu_vma)
pause_unpause_vm_and_check_connectivity(vm=gpu_vma)

@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::test_access_vgpus_rhel_vm"])
@pytest.mark.polarion("CNV-4767")
Expand Down
4 changes: 2 additions & 2 deletions tests/virt/node/gpu/vgpu/test_windows_vm_with_vgpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)
from tests.virt.utils import (
get_gpu_device_name_from_windows_vm,
validate_pause_optional_migrate_unpause_windows_vm,
validate_pause_unpause_windows_vm,
verify_gpu_device_exists_in_vm,
)
from utilities.constants import Images
Expand Down Expand Up @@ -102,7 +102,7 @@ def test_pause_unpause_gpus_win_vm(self, gpu_vma):
"""
Test Windows VM with vGPU using gpus spec, can be paused and unpaused successfully.
"""
validate_pause_optional_migrate_unpause_windows_vm(vm=gpu_vma)
validate_pause_unpause_windows_vm(vm=gpu_vma)

@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::test_access_vgpus_win_vm"])
@pytest.mark.polarion("CNV-8083")
Expand Down
6 changes: 3 additions & 3 deletions tests/virt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
get_vm_boot_time,
kill_processes_by_name_linux,
migrate_vm_and_verify,
pause_optional_migrate_unpause_and_check_connectivity,
pause_unpause_vm_and_check_connectivity,
start_and_fetch_processid_on_linux_vm,
start_and_fetch_processid_on_windows_vm,
verify_vm_migrated,
Expand Down Expand Up @@ -283,11 +283,11 @@ def kill_processes_by_name_windows(vm, process_name):
run_ssh_commands(host=vm.ssh_exec, commands=cmd, tcp_timeout=TCP_TIMEOUT_30SEC)


def validate_pause_optional_migrate_unpause_windows_vm(vm, pre_pause_pid=None, migrate=False):
def validate_pause_unpause_windows_vm(vm: VirtualMachineForTests, pre_pause_pid: int | None = None) -> None:
proc_name = OS_PROC_NAME["windows"]
if not pre_pause_pid:
pre_pause_pid = start_and_fetch_processid_on_windows_vm(vm=vm, process_name=proc_name)
pause_optional_migrate_unpause_and_check_connectivity(vm=vm, migrate=migrate)
pause_unpause_vm_and_check_connectivity(vm=vm)
post_pause_pid = fetch_pid_from_windows_vm(vm=vm, process_name=proc_name)
kill_processes_by_name_windows(vm=vm, process_name=proc_name)
assert post_pause_pid == pre_pause_pid, (
Expand Down
17 changes: 6 additions & 11 deletions utilities/virt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2464,23 +2464,18 @@ def assert_linux_efi(vm: VirtualMachineForTests) -> None:
return run_ssh_commands(host=vm.ssh_exec, commands=shlex.split("ls -ld /sys/firmware/efi"))[0]


def pause_optional_migrate_unpause_and_check_connectivity(vm: VirtualMachineForTests, migrate: bool = False) -> None:
vmi = VirtualMachineInstance(client=get_client(), name=vm.vmi.name, namespace=vm.vmi.namespace)
vmi.pause(wait=True)
if migrate:
migrate_vm_and_verify(vm=vm, wait_for_interfaces=False)
vmi.unpause(wait=True)
def pause_unpause_vm_and_check_connectivity(vm: VirtualMachineForTests) -> None:
vm.vmi.pause(wait=True)
vm.vmi.unpause(wait=True)
LOGGER.info("Verify VM is running and ready after unpause")
wait_for_running_vm(vm=vm)
wait_for_ssh_connectivity(vm=vm, timeout=TIMEOUT_2MIN)


def validate_pause_optional_migrate_unpause_linux_vm(
vm: VirtualMachineForTests, pre_pause_pid: int | None = None, migrate: bool = False
) -> None:
def validate_pause_unpause_linux_vm(vm: VirtualMachineForTests, pre_pause_pid: int | None = None) -> None:
proc_name = OS_PROC_NAME["linux"]
if not pre_pause_pid:
pre_pause_pid = start_and_fetch_processid_on_linux_vm(vm=vm, process_name=proc_name, args="localhost")
pause_optional_migrate_unpause_and_check_connectivity(vm=vm, migrate=migrate)
pause_unpause_vm_and_check_connectivity(vm=vm)
post_pause_pid = fetch_pid_from_linux_vm(vm=vm, process_name=proc_name)
kill_processes_by_name_linux(vm=vm, process_name=proc_name)
assert post_pause_pid == pre_pause_pid, (
Expand Down
Loading