Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion tests/virt/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@


# MigrationPolicy labels
VM_LABEL = {"post-copy-vm": "true"}
WORKLOAD_DISRUPTION_VM_LABEL = {"workload-disruption-vm": "true"}


# BASH
Expand Down
15 changes: 9 additions & 6 deletions tests/virt/node/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ def vmx_disabled_flag(nodes_cpu_architecture):


@pytest.fixture(scope="class")
def hotplugged_vm(
def vm_with_hotplug_support(
request,
namespace,
unprivileged_client,
admin_client,
golden_image_data_volume_template_for_test_scope_class,
modern_cpu_for_migration,
vmx_disabled_flag,
Expand All @@ -98,22 +99,24 @@ def hotplugged_vm(
) as vm:
running_vm(vm=vm)
yield vm
if is_jira_open(jira_id="CNV-92094"):
clean_up_migration_jobs(client=admin_client, vm=vm)


@pytest.fixture()
def hotplugged_sockets_memory_guest(request, admin_client, hotplugged_vm, unprivileged_client):
def hotplugged_sockets_memory_guest(request, admin_client, vm_with_hotplug_support, unprivileged_client):
param = request.param
if param.get("skip_migration"):
hotplug_spec_vm(vm=hotplugged_vm, sockets=param.get("sockets"), memory_guest=param.get("memory_guest"))
hotplug_spec_vm(
vm=vm_with_hotplug_support, sockets=param.get("sockets"), memory_guest=param.get("memory_guest")
)
else:
hotplug_spec_vm_and_verify_hotplug(
vm=hotplugged_vm,
vm=vm_with_hotplug_support,
client=unprivileged_client,
sockets=param.get("sockets"),
memory_guest=param.get("memory_guest"),
)
yield
clean_up_migration_jobs(client=admin_client, vm=hotplugged_vm)


@pytest.fixture()
Expand Down
65 changes: 35 additions & 30 deletions tests/virt/node/hotplug/test_cpu_memory_hotplug.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
hotplug_spec_vm,
wait_for_guest_os_cpu_count,
)
from utilities.constants.images import OS_FLAVOR_WINDOWS
from utilities.constants.virt import (
FIVE_GI_MEMORY,
FOUR_CPU_SOCKETS,
Expand Down Expand Up @@ -41,24 +42,24 @@


@pytest.fixture()
def xfail_windows_memory_hotunplug(hotplugged_vm):
if "windows" in hotplugged_vm.name:
def xfail_windows_memory_hotunplug(vm_with_hotplug_support):
if vm_with_hotplug_support.os_flavor == OS_FLAVOR_WINDOWS:
pytest.xfail(reason="Windows OS doesn't officially support memory hot unplug!")


@pytest.fixture(scope="class")
def hotplug_vm_snapshot(hotplugged_vm):
def hotplug_vm_snapshot(vm_with_hotplug_support):
with VirtualMachineSnapshot(
name=f"{hotplugged_vm.name}-snapshot",
namespace=hotplugged_vm.namespace,
vm_name=hotplugged_vm.name,
name=f"{vm_with_hotplug_support.name}-snapshot",
namespace=vm_with_hotplug_support.namespace,
vm_name=vm_with_hotplug_support.name,
) as snapshot:
snapshot.wait_snapshot_done()
yield snapshot


@pytest.mark.parametrize(
"golden_image_data_source_for_test_scope_class, hotplugged_vm",
"golden_image_data_source_for_test_scope_class, vm_with_hotplug_support",
[
pytest.param(
{"os_dict": RHEL_LATEST},
Expand All @@ -81,19 +82,21 @@ class TestCPUHotPlug:
)
@pytest.mark.dependency(name=f"{TESTS_CLASS_NAME}::hotplug_cpu")
@pytest.mark.polarion("CNV-10695")
def test_hotplug_cpu(self, hotplugged_sockets_memory_guest, hotplugged_vm):
wait_for_guest_os_cpu_count(vm=hotplugged_vm, spec_cpu_amount=SIX_CPU_SOCKETS)
def test_hotplug_cpu(self, hotplugged_sockets_memory_guest, vm_with_hotplug_support):
wait_for_guest_os_cpu_count(vm=vm_with_hotplug_support, spec_cpu_amount=SIX_CPU_SOCKETS)

@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::hotplug_cpu"])
@pytest.mark.polarion("CNV-10696")
@pytest.mark.usefixtures("hotplug_vm_snapshot")
def test_migrate_snapshot_hotplugged_vm(self, admin_client: DynamicClient, hotplugged_vm: VirtualMachineForTests):
migrate_vm_and_verify(vm=hotplugged_vm, client=admin_client, check_ssh_connectivity=True)
def test_migrate_snapshot_hotplugged_vm(
self, admin_client: DynamicClient, vm_with_hotplug_support: VirtualMachineForTests
):
migrate_vm_and_verify(vm=vm_with_hotplug_support, client=admin_client, check_ssh_connectivity=True)

@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::hotplug_cpu"])
@pytest.mark.polarion("CNV-10697")
def test_restart_hotplugged_vm(self, hotplugged_vm):
restart_vm_wait_for_running_vm(vm=hotplugged_vm)
def test_restart_hotplug_vm(self, vm_with_hotplug_support):
restart_vm_wait_for_running_vm(vm=vm_with_hotplug_support)

@pytest.mark.parametrize(
"hotplugged_sockets_memory_guest",
Expand All @@ -102,21 +105,21 @@ def test_restart_hotplugged_vm(self, hotplugged_vm):
)
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::hotplug_cpu"])
@pytest.mark.polarion("CNV-10698")
def test_decrease_cpu_value(self, hotplugged_sockets_memory_guest, hotplugged_vm):
def test_decrease_cpu_value(self, hotplugged_sockets_memory_guest, vm_with_hotplug_support):
assert_restart_required_condition(
vm=hotplugged_vm, expected_message="Reduction of CPU socket count requires a restart"
vm=vm_with_hotplug_support, expected_message="Reduction of CPU socket count requires a restart"
)

@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::hotplug_cpu"])
@pytest.mark.polarion("CNV-10699")
def test_hotplug_cpu_above_max_value(self, hotplugged_vm):
def test_hotplug_cpu_above_max_value(self, vm_with_hotplug_support):
with pytest.raises(UnprocessibleEntityError):
hotplug_spec_vm(vm=hotplugged_vm, sockets=TEN_CPU_SOCKETS)
hotplug_spec_vm(vm=vm_with_hotplug_support, sockets=TEN_CPU_SOCKETS)
pytest.fail("Socket value set higher than max value!")


@pytest.mark.parametrize(
"golden_image_data_source_for_test_scope_class, hotplugged_vm",
"golden_image_data_source_for_test_scope_class, vm_with_hotplug_support",
[
pytest.param(
{"os_dict": RHEL_LATEST},
Expand All @@ -138,35 +141,37 @@ class TestMemoryHotPlug:
)
@pytest.mark.dependency(name=f"{TESTS_CLASS_NAME}::hotplug_memory")
@pytest.mark.polarion("CNV-10676")
def test_hotplug_memory(self, hotplugged_sockets_memory_guest, hotplugged_vm):
assert_guest_os_memory_amount(vm=hotplugged_vm, spec_memory_amount=SIX_GI_MEMORY)
def test_hotplug_memory(self, hotplugged_sockets_memory_guest, vm_with_hotplug_support):
assert_guest_os_memory_amount(vm=vm_with_hotplug_support, spec_memory_amount=SIX_GI_MEMORY)

@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::hotplug_memory"])
@pytest.mark.polarion("CNV-10677")
@pytest.mark.usefixtures("hotplug_vm_snapshot")
def test_migrate_snapshot_hotplugged_vm(self, admin_client: DynamicClient, hotplugged_vm: VirtualMachineForTests):
migrate_vm_and_verify(vm=hotplugged_vm, client=admin_client, check_ssh_connectivity=True)
def test_migrate_snapshot_hotplugged_vm(
self, admin_client: DynamicClient, vm_with_hotplug_support: VirtualMachineForTests
):
migrate_vm_and_verify(vm=vm_with_hotplug_support, client=admin_client, check_ssh_connectivity=True)

@pytest.mark.parametrize(
"hotplugged_sockets_memory_guest", [pytest.param({"memory_guest": FIVE_GI_MEMORY})], indirect=True
)
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::hotplug_memory"])
@pytest.mark.polarion("CNV-10679")
def test_decrease_memory_value(
self, xfail_windows_memory_hotunplug, hotplugged_sockets_memory_guest, hotplugged_vm
self, xfail_windows_memory_hotunplug, hotplugged_sockets_memory_guest, vm_with_hotplug_support
):
assert_guest_os_memory_amount(vm=hotplugged_vm, spec_memory_amount=FIVE_GI_MEMORY)
assert_guest_os_memory_amount(vm=vm_with_hotplug_support, spec_memory_amount=FIVE_GI_MEMORY)

@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::hotplug_memory"])
@pytest.mark.polarion("CNV-10678")
def test_restart_hotplugged_vm(self, hotplugged_vm):
restart_vm_wait_for_running_vm(vm=hotplugged_vm)
def test_restart_hotplug_vm(self, vm_with_hotplug_support):
restart_vm_wait_for_running_vm(vm=vm_with_hotplug_support)

@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::hotplug_memory"])
@pytest.mark.polarion("CNV-10681")
def test_hotplug_memory_above_max_value(self, hotplugged_vm):
def test_hotplug_memory_above_max_value(self, vm_with_hotplug_support):
with pytest.raises(UnprocessibleEntityError):
hotplug_spec_vm(vm=hotplugged_vm, memory_guest=TWELVE_GI_MEMORY)
hotplug_spec_vm(vm=vm_with_hotplug_support, memory_guest=TWELVE_GI_MEMORY)
pytest.fail("Memory value set higher than max value!")

@pytest.mark.parametrize(
Expand All @@ -176,8 +181,8 @@ def test_hotplug_memory_above_max_value(self, hotplugged_vm):
)
@pytest.mark.dependency(depends=[f"{TESTS_CLASS_NAME}::hotplug_memory"])
@pytest.mark.polarion("CNV-10682")
def test_reduce_memory_below_start_value(self, hotplugged_sockets_memory_guest, hotplugged_vm):
def test_reduce_memory_below_start_value(self, hotplugged_sockets_memory_guest, vm_with_hotplug_support):
assert_restart_required_condition(
vm=hotplugged_vm,
vm=vm_with_hotplug_support,
expected_message="memory updated in template spec to a value lower than what the VM started with",
)
160 changes: 0 additions & 160 deletions tests/virt/node/migration_and_maintenance/test_post_copy_migration.py

This file was deleted.

Loading