|
12 | 12 | ) |
13 | 13 |
|
14 | 14 | from tests.os_params import FEDORA_LATEST, WINDOWS_11, WINDOWS_11_TEMPLATE_LABELS |
| 15 | +from tests.storage.cdi_clone.constants import WINDOWS_CLONE_TIMEOUT |
15 | 16 | from tests.storage.utils import ( |
16 | 17 | assert_pvc_snapshot_clone_annotation, |
17 | 18 | assert_use_populator, |
18 | 19 | create_windows_vm_validate_guest_agent_info, |
| 20 | + validate_os_info_vmi_vs_windows_os, |
| 21 | + verify_vtpm_in_windows_vm, |
| 22 | + wait_for_windows_vm, |
19 | 23 | ) |
20 | 24 | from utilities.constants import ( |
21 | 25 | OS_FLAVOR_FEDORA, |
| 26 | + OS_FLAVOR_WIN_CONTAINER_DISK, |
22 | 27 | OS_FLAVOR_WINDOWS, |
23 | 28 | TIMEOUT_1MIN, |
24 | 29 | TIMEOUT_40MIN, |
| 30 | + U1_LARGE, |
| 31 | + WIN_2K22, |
| 32 | + WINDOWS_2K22_PREFERENCE, |
25 | 33 | Images, |
26 | 34 | ) |
27 | 35 | from utilities.storage import ( |
|
38 | 46 | running_vm, |
39 | 47 | ) |
40 | 48 |
|
41 | | -WINDOWS_CLONE_TIMEOUT = TIMEOUT_40MIN |
42 | | - |
43 | 49 |
|
44 | 50 | def create_vm_from_clone_dv_template( |
45 | 51 | vm_name, |
@@ -69,47 +75,6 @@ def create_vm_from_clone_dv_template( |
69 | 75 | running_vm(vm=vm) |
70 | 76 |
|
71 | 77 |
|
72 | | -def create_windows_vm_with_vtpm_validate_guest_agent_info( |
73 | | - dv, |
74 | | - namespace, |
75 | | - unprivileged_client, |
76 | | - windows_version, |
77 | | - admin_client=None, |
78 | | -): |
79 | | - """ |
80 | | - Create Windows VM with vTPM using instance types and preferences. |
81 | | -
|
82 | | - Args: |
83 | | - dv: DataVolume to use for the VM |
84 | | - namespace: Namespace object |
85 | | - unprivileged_client: Client to use |
86 | | - windows_version: Windows version string ("11", "2k22", etc.) |
87 | | - admin_client: Optional admin client for vTPM validation |
88 | | - """ |
89 | | - from tests.storage.utils import validate_os_info_vmi_vs_windows_os, wait_for_windows_vm |
90 | | - |
91 | | - # Map Windows version to preference name |
92 | | - preference_name = f"windows.{windows_version}" # e.g., "windows.11", "windows.2k22" |
93 | | - |
94 | | - with VirtualMachineForTests( |
95 | | - name=f"vm-win-{windows_version}-vtpm", |
96 | | - namespace=namespace.name, |
97 | | - client=unprivileged_client, |
98 | | - os_flavor=OS_FLAVOR_WINDOWS, |
99 | | - vm_instance_type=VirtualMachineClusterInstancetype(name="u1.large", client=unprivileged_client), |
100 | | - vm_preference=VirtualMachineClusterPreference(name=preference_name, client=unprivileged_client), |
101 | | - data_volume_template={"metadata": dv.res["metadata"], "spec": dv.res["spec"]}, |
102 | | - ) as vm: |
103 | | - wait_for_windows_vm(vm=vm, version=windows_version, timeout=TIMEOUT_40MIN) |
104 | | - validate_os_info_vmi_vs_windows_os(vm=vm) |
105 | | - |
106 | | - # Validate vTPM if admin_client provided |
107 | | - if admin_client: |
108 | | - from tests.storage.utils import verify_vtpm_in_windows_vm |
109 | | - |
110 | | - verify_vtpm_in_windows_vm(vm=vm, admin_client=admin_client) |
111 | | - |
112 | | - |
113 | 78 | @pytest.mark.tier3 |
114 | 79 | @pytest.mark.parametrize( |
115 | 80 | "data_volume_multi_storage_scope_function", |
@@ -235,45 +200,31 @@ def test_successful_vm_from_cloned_dv_windows( |
235 | 200 |
|
236 | 201 |
|
237 | 202 | @pytest.mark.tier3 |
238 | | -@pytest.mark.parametrize( |
239 | | - "data_volume_multi_storage_scope_function", |
240 | | - [ |
241 | | - pytest.param( |
242 | | - { |
243 | | - "dv_name": "dv-source-win11-vtpm", |
244 | | - "source": "http", |
245 | | - "image": f"{Images.Windows.DIR}/{Images.Windows.WIN11_IMG}", |
246 | | - "dv_size": Images.Windows.DEFAULT_DV_SIZE, |
247 | | - }, |
248 | | - marks=pytest.mark.polarion("CNV-3638"), |
249 | | - ), |
250 | | - ], |
251 | | - indirect=True, |
252 | | -) |
| 203 | +@pytest.mark.polarion("CNV-3638") |
253 | 204 | def test_successful_vm_from_cloned_dv_windows_with_vtpm( |
| 205 | + admin_client, # only needed for `verify_vtpm_in_windows_vm`, to be deleted once verified |
254 | 206 | unprivileged_client, |
255 | | - admin_client, |
256 | | - data_volume_multi_storage_scope_function, |
257 | 207 | namespace, |
| 208 | + cloned_windows_dv_from_registry, |
258 | 209 | ): |
259 | | - """Test cloning Windows 11 DV and creating VM with vTPM using instance types.""" |
260 | | - with create_dv( |
| 210 | + """Test cloning Windows 2022 DV and creating VM with vTPM using instance types.""" |
| 211 | + |
| 212 | + with VirtualMachineForTests( |
| 213 | + name=f"vm-{WIN_2K22}-vtpm", |
| 214 | + namespace=namespace.name, |
261 | 215 | client=unprivileged_client, |
262 | | - source="pvc", |
263 | | - dv_name="dv-target-win11-vtpm", |
264 | | - namespace=data_volume_multi_storage_scope_function.namespace, |
265 | | - size=data_volume_multi_storage_scope_function.size, |
266 | | - source_pvc=data_volume_multi_storage_scope_function.name, |
267 | | - storage_class=data_volume_multi_storage_scope_function.storage_class, |
268 | | - ) as cdv: |
269 | | - cdv.wait_for_dv_success(timeout=WINDOWS_CLONE_TIMEOUT) |
270 | | - create_windows_vm_with_vtpm_validate_guest_agent_info( |
271 | | - dv=cdv, |
272 | | - namespace=namespace, |
273 | | - unprivileged_client=unprivileged_client, |
274 | | - windows_version="11", |
275 | | - admin_client=admin_client, |
276 | | - ) |
| 216 | + os_flavor=OS_FLAVOR_WIN_CONTAINER_DISK, |
| 217 | + vm_instance_type=VirtualMachineClusterInstancetype(name=U1_LARGE, client=unprivileged_client), |
| 218 | + vm_preference=VirtualMachineClusterPreference(name=WINDOWS_2K22_PREFERENCE, client=unprivileged_client), |
| 219 | + data_volume_template={ |
| 220 | + "metadata": cloned_windows_dv_from_registry.res["metadata"], |
| 221 | + "spec": cloned_windows_dv_from_registry.res["spec"], |
| 222 | + }, |
| 223 | + ) as vm: |
| 224 | + vm.start() |
| 225 | + wait_for_windows_vm(vm=vm, version="2k22", timeout=TIMEOUT_40MIN) |
| 226 | + validate_os_info_vmi_vs_windows_os(vm=vm) |
| 227 | + verify_vtpm_in_windows_vm(vm=vm, admin_client=admin_client) |
277 | 228 |
|
278 | 229 |
|
279 | 230 | @pytest.mark.parametrize( |
|
0 commit comments