From 0b782a8000970a126e5272ffabd9be9f37ddd446 Mon Sep 17 00:00:00 2001 From: dw035535 Date: Wed, 7 May 2025 05:54:04 +0000 Subject: [PATCH 01/10] set nvme_vhba_device_ops_spec13 not applicable Signed-off-by: dw035535 --- .../nvme_vhba_device_ops_spec13.yml | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/windows/vhba_hot_add_remove/nvme_vhba_device_ops_spec13.yml b/windows/vhba_hot_add_remove/nvme_vhba_device_ops_spec13.yml index 386127d68..49b11d026 100644 --- a/windows/vhba_hot_add_remove/nvme_vhba_device_ops_spec13.yml +++ b/windows/vhba_hot_add_remove/nvme_vhba_device_ops_spec13.yml @@ -3,7 +3,17 @@ --- # Description: # This test case is used for check hotadd, hot remove disk -# on a new and existing NVMe controller with NVMe Spec 1.3 enabled. +# on a new and existing NVMe controller with NVMe Spec 1.3 enabled +# manually. +# Notes: +# Please refer to the release notes of ESXi 8.0.2: +# https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/ +# release-notes/esxi-update-and-patch-release-notes/vsphere-esxi-802-release-notes.html +# Default NVMe version 1.3 for Windows virtual machines: +# Starting with vSphere 8.0 Update 2, the NVMe version of Windows Server 2022 +# or Windows 11 and later virtual machines with hardware version 21 and later, +# and a virtual NVMe controller, is set to 1.3 by default. +# Set this test case result to "Not Applicable" in above situation. # - name: nvme_vhba_device_ops_spec13 hosts: localhost @@ -37,6 +47,20 @@ - guest_os_product_type == 'server' - guest_os_ansible_kernel is version('10.0.20348.0', '<') + - name: "Skip test case" + include_tasks: ../../common/skip_test_case.yml + vars: + skip_msg: >- + Skip testing on this guest OS '{{ guest_os_ansible_distribution }}' with VM hardware version + '{{ vm_hardware_version_num }}', since NVMe version is 1.3 by default for Windows Server 2022, + Windows 11 and later VMs with hardware version 21 on ESXi 8.0.2 and later. + So skip this test case and only run test case 'nvme_vhba_device_ops' with default NVMe v1.3. + skip_reason: "Not Applicable" + when: + - vm_hardware_version_num | int >= 21 + - (guest_os_product_type == 'server' and guest_os_build_num | int >= 20348) or + (guest_os_product_type == 'client' and guest_os_build_num | int >= 22000) + - name: "Test run" include_tasks: vhba_test.yml vars: From 666212eb7d91716a2c814a780b8aee26b9904d3a Mon Sep 17 00:00:00 2001 From: dw035535 Date: Wed, 7 May 2025 06:26:23 +0000 Subject: [PATCH 02/10] enable NVMe spec 1.3 when it's not enabled by default Signed-off-by: dw035535 --- .../nvme_vhba_device_ops_spec13.yml | 19 ++------------ windows/vhba_hot_add_remove/vhba_test.yml | 25 +++++++++++++++++++ .../vhba_hot_add_remove/vhba_test_prepare.yml | 4 +-- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/windows/vhba_hot_add_remove/nvme_vhba_device_ops_spec13.yml b/windows/vhba_hot_add_remove/nvme_vhba_device_ops_spec13.yml index 49b11d026..89b0aa3d6 100644 --- a/windows/vhba_hot_add_remove/nvme_vhba_device_ops_spec13.yml +++ b/windows/vhba_hot_add_remove/nvme_vhba_device_ops_spec13.yml @@ -10,9 +10,8 @@ # https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/ # release-notes/esxi-update-and-patch-release-notes/vsphere-esxi-802-release-notes.html # Default NVMe version 1.3 for Windows virtual machines: -# Starting with vSphere 8.0 Update 2, the NVMe version of Windows Server 2022 -# or Windows 11 and later virtual machines with hardware version 21 and later, -# and a virtual NVMe controller, is set to 1.3 by default. +# Starting with vSphere 8.0 Update 2, the NVMe version is set to 1.3 by default for +# Windows Server 2022 or Windows 11 and later VMs with hardware version 21 and later. # Set this test case result to "Not Applicable" in above situation. # - name: nvme_vhba_device_ops_spec13 @@ -47,20 +46,6 @@ - guest_os_product_type == 'server' - guest_os_ansible_kernel is version('10.0.20348.0', '<') - - name: "Skip test case" - include_tasks: ../../common/skip_test_case.yml - vars: - skip_msg: >- - Skip testing on this guest OS '{{ guest_os_ansible_distribution }}' with VM hardware version - '{{ vm_hardware_version_num }}', since NVMe version is 1.3 by default for Windows Server 2022, - Windows 11 and later VMs with hardware version 21 on ESXi 8.0.2 and later. - So skip this test case and only run test case 'nvme_vhba_device_ops' with default NVMe v1.3. - skip_reason: "Not Applicable" - when: - - vm_hardware_version_num | int >= 21 - - (guest_os_product_type == 'server' and guest_os_build_num | int >= 20348) or - (guest_os_product_type == 'client' and guest_os_build_num | int >= 22000) - - name: "Test run" include_tasks: vhba_test.yml vars: diff --git a/windows/vhba_hot_add_remove/vhba_test.yml b/windows/vhba_hot_add_remove/vhba_test.yml index d00ef06c9..bca2f0528 100755 --- a/windows/vhba_hot_add_remove/vhba_test.yml +++ b/windows/vhba_hot_add_remove/vhba_test.yml @@ -6,6 +6,31 @@ # - lsilogic: no inbox driver in Windows guest OS now, so no testing. # - buslogic: not supported in 64bit Windows guest OS, so no testing. # +- name: "Set fact of whether VM NVMe version 1.3 is enabled by default" + ansible.builtin.set_fact: + vm_nvme_spec13_enabled: >- + {{ + vm_hardware_version_num | int >= 21 and + ((guest_os_product_type == 'server' and guest_os_build_num | int >= 20348) or + (guest_os_product_type == 'client' and guest_os_build_num | int >= 22000)) + }} + when: + - test_disk_ctrl_type == 'nvme' + - vm_nvme_spec13_enabled is undefined + +- name: "Skip test case" + include_tasks: ../../common/skip_test_case.yml + vars: + skip_msg: >- + Skip testing on this guest OS '{{ guest_os_ansible_distribution }}' with VM hardware version + '{{ vm_hardware_version_num }}', since NVMe version is 1.3 by default for Windows Server 2022, + Windows 11 and later VMs with hardware version 21 on ESXi 8.0.2 and later. + So skip this test case and only run test case 'nvme_vhba_device_ops' with default NVMe v1.3. + skip_reason: "Not Applicable" + when: + - vm_nvme_spec13_enabled is defined and vm_nvme_spec13_enabled + - test_purpose == "hot-add-spec13" + - name: "Get VM current disk controller info" include_tasks: get_vm_disk_ctrl_info.yml diff --git a/windows/vhba_hot_add_remove/vhba_test_prepare.yml b/windows/vhba_hot_add_remove/vhba_test_prepare.yml index 48ff0d459..02a6e232e 100644 --- a/windows/vhba_hot_add_remove/vhba_test_prepare.yml +++ b/windows/vhba_hot_add_remove/vhba_test_prepare.yml @@ -16,8 +16,8 @@ disk_controller_facts_data: "{{ disk_ctrls_before_hotadd }}" new_vhba_type: "{{ disk_controller }}" -- name: "Enable NVMe spec 1.3" +- name: "Enable NVMe spec 1.3 for NVMe '{{ test_purpose }}' testing" include_tasks: enable_vm_nvme_spec13.yml when: - test_disk_ctrl_type == 'nvme' - - test_purpose in ["hot-add-spec13", "hot-extend"] + - test_purpose == "hot-add-spec13" or (test_purpose == "hot-extend" and not vm_nvme_spec13_enabled) From 0b9c57dfbfd0a10247c36c0ac28316c378aec901 Mon Sep 17 00:00:00 2001 From: dw035535 Date: Wed, 7 May 2025 06:29:57 +0000 Subject: [PATCH 03/10] change when conditions Signed-off-by: dw035535 --- windows/vhba_hot_add_remove/vhba_test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/windows/vhba_hot_add_remove/vhba_test.yml b/windows/vhba_hot_add_remove/vhba_test.yml index bca2f0528..ffa665919 100755 --- a/windows/vhba_hot_add_remove/vhba_test.yml +++ b/windows/vhba_hot_add_remove/vhba_test.yml @@ -28,8 +28,9 @@ So skip this test case and only run test case 'nvme_vhba_device_ops' with default NVMe v1.3. skip_reason: "Not Applicable" when: - - vm_nvme_spec13_enabled is defined and vm_nvme_spec13_enabled + - test_disk_ctrl_type == 'nvme' - test_purpose == "hot-add-spec13" + - vm_nvme_spec13_enabled - name: "Get VM current disk controller info" include_tasks: get_vm_disk_ctrl_info.yml From 07c5bbfcb5f01708227ec10341bb48e8ab187fee Mon Sep 17 00:00:00 2001 From: dw035535 Date: Thu, 15 May 2025 03:36:36 +0000 Subject: [PATCH 04/10] add get nvme spec Signed-off-by: dw035535 --- windows/utils/win_get_nvme_spec_version.yml | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 windows/utils/win_get_nvme_spec_version.yml diff --git a/windows/utils/win_get_nvme_spec_version.yml b/windows/utils/win_get_nvme_spec_version.yml new file mode 100644 index 000000000..c475b1669 --- /dev/null +++ b/windows/utils/win_get_nvme_spec_version.yml @@ -0,0 +1,27 @@ +# Copyright 2025 VMware, Inc. +# SPDX-License-Identifier: BSD-2-Clause +--- +# Get implemented NVMe spec version in Windows guest OS. +# Return: +# win_nvme_spec_version: the NVMe spec version got in guest OS. +# +- name: "Initialize the NVMe spec version in Windows guest OS" + ansible.builtin.set_fact: + win_nvme_spec_version: '' + +- name: "Get NVMe spec version in Windows guest OS" + include_tasks: win_execute_cmd.yml + vars: + win_powershell_cmd: >- + Get-Physicaldisk | where-object {$_.Friendlyname -like '*NVMe*'} | + Get-StorageFirmwareInformation).FirmwareVersionInSlot + +- name: "Set fact of NVMe spec version" + ansible.builtin.set_fact: + win_nvme_spec_version: "{{ win_powershell_cmd_output.stdout_lines[0] }}" + when: + - win_powershell_cmd_output.stdout_lines is defined + - win_powershell_cmd_output.stdout_lines | length != 0 + +- name: "Print NVMe spec version in Windows guest OS" + ansible.builtin.debug: var=win_nvme_spec_version From a6727a417954f1f99e7c2f01e7b753429b515692 Mon Sep 17 00:00:00 2001 From: dw035535 Date: Thu, 15 May 2025 06:43:14 +0000 Subject: [PATCH 05/10] add get nvme spec version Signed-off-by: dw035535 --- windows/utils/win_get_nvme_spec_version.yml | 2 +- windows/vhba_hot_add_remove/check_disk_after_adding.yml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/windows/utils/win_get_nvme_spec_version.yml b/windows/utils/win_get_nvme_spec_version.yml index c475b1669..f7ec53138 100644 --- a/windows/utils/win_get_nvme_spec_version.yml +++ b/windows/utils/win_get_nvme_spec_version.yml @@ -13,7 +13,7 @@ include_tasks: win_execute_cmd.yml vars: win_powershell_cmd: >- - Get-Physicaldisk | where-object {$_.Friendlyname -like '*NVMe*'} | + (Get-Physicaldisk | where-object {$_.Friendlyname -like '*NVMe*'} | Get-StorageFirmwareInformation).FirmwareVersionInSlot - name: "Set fact of NVMe spec version" diff --git a/windows/vhba_hot_add_remove/check_disk_after_adding.yml b/windows/vhba_hot_add_remove/check_disk_after_adding.yml index e7dcd728e..17fa388a7 100644 --- a/windows/vhba_hot_add_remove/check_disk_after_adding.yml +++ b/windows/vhba_hot_add_remove/check_disk_after_adding.yml @@ -41,6 +41,10 @@ the same as the expected value {{ ctrl_num_guest_before | int + 1 }}. when: on_new_controller +- name: "Get NVMe spec version in guest OS" + include_tasks: ../utils/win_get_nvme_spec_version.yml + when: test_disk_ctrl_type == "nvme" + - name: "Initialize new disk and create disk partition in guest OS" include_tasks: create_partition_raw_disk.yml vars: From 65f31ec55b56e6758fcf91f24ce2d9c2abe08569 Mon Sep 17 00:00:00 2001 From: dw035535 Date: Thu, 15 May 2025 06:52:09 +0000 Subject: [PATCH 06/10] also add for hot extend Signed-off-by: dw035535 --- windows/vhba_hot_add_remove/hot_extend_disk_test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/windows/vhba_hot_add_remove/hot_extend_disk_test.yml b/windows/vhba_hot_add_remove/hot_extend_disk_test.yml index 1e083d212..98aa0250a 100755 --- a/windows/vhba_hot_add_remove/hot_extend_disk_test.yml +++ b/windows/vhba_hot_add_remove/hot_extend_disk_test.yml @@ -91,3 +91,6 @@ that: - win_disk_volume_size_after | int == 2 fail_msg: "Got disk volume '{{ drive_letter_new }}' size '{{ win_disk_volume_size_after }}' GB after extend, not 2GB." + +- name: "Get NVMe spec version in guest OS" + include_tasks: ../utils/win_get_nvme_spec_version.yml From 286c253f3fcfef8d98cd1c119ae89e077cc3aa73 Mon Sep 17 00:00:00 2001 From: dw035535 Date: Tue, 20 May 2025 05:35:06 +0000 Subject: [PATCH 07/10] change to check guest ID Signed-off-by: dw035535 --- windows/vhba_hot_add_remove/vhba_test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/windows/vhba_hot_add_remove/vhba_test.yml b/windows/vhba_hot_add_remove/vhba_test.yml index ffa665919..79bcadb58 100755 --- a/windows/vhba_hot_add_remove/vhba_test.yml +++ b/windows/vhba_hot_add_remove/vhba_test.yml @@ -11,8 +11,10 @@ vm_nvme_spec13_enabled: >- {{ vm_hardware_version_num | int >= 21 and - ((guest_os_product_type == 'server' and guest_os_build_num | int >= 20348) or - (guest_os_product_type == 'client' and guest_os_build_num | int >= 22000)) + ((guest_os_product_type == 'server' and + (vm_guest_id | regex_search('windows(\\d+)srvNext', '\\1'))[0] | int >= 2019) or + (guest_os_product_type == 'client' and + (vm_guest_id | regex_search('windows(\\d+)_', '\\1'))[0] | int >= 11)) }} when: - test_disk_ctrl_type == 'nvme' From 924b432052af7eeca9978ea3848851510a895a9e Mon Sep 17 00:00:00 2001 From: dw035535 Date: Tue, 20 May 2025 07:18:30 +0000 Subject: [PATCH 08/10] fix syntax issue Signed-off-by: dw035535 --- windows/vhba_hot_add_remove/vhba_test.yml | 22 ++++++++++--------- .../vhba_hot_add_remove/vhba_test_prepare.yml | 3 ++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/windows/vhba_hot_add_remove/vhba_test.yml b/windows/vhba_hot_add_remove/vhba_test.yml index 79bcadb58..9c668ce9f 100755 --- a/windows/vhba_hot_add_remove/vhba_test.yml +++ b/windows/vhba_hot_add_remove/vhba_test.yml @@ -7,18 +7,20 @@ # - buslogic: not supported in 64bit Windows guest OS, so no testing. # - name: "Set fact of whether VM NVMe version 1.3 is enabled by default" - ansible.builtin.set_fact: - vm_nvme_spec13_enabled: >- - {{ - vm_hardware_version_num | int >= 21 and - ((guest_os_product_type == 'server' and - (vm_guest_id | regex_search('windows(\\d+)srvNext', '\\1'))[0] | int >= 2019) or - (guest_os_product_type == 'client' and - (vm_guest_id | regex_search('windows(\\d+)_', '\\1'))[0] | int >= 11)) - }} when: + - vm_hardware_version_num | int >= 21 - test_disk_ctrl_type == 'nvme' - vm_nvme_spec13_enabled is undefined + block: + - name: "For Windows {{ guest_os_product_type }} with guest ID {{ vm_guest_id }}" + ansible.builtin.set_fact: + vm_nvme_spec13_enabled: "{{ vm_guest_id | regex_search('windows(\\d+)srvNext', '\\1') | first | int >= 2019 }}" + when: guest_os_product_type == 'server' + + - name: "For Windows {{ guest_os_product_type }} with guest ID {{ vm_guest_id }}" + ansible.builtin.set_fact: + vm_nvme_spec13_enabled: "{{ vm_guest_id | regex_search('windows(\\d+)_', '\\1') | first | int >= 11 }}" + when: guest_os_product_type == 'client' - name: "Skip test case" include_tasks: ../../common/skip_test_case.yml @@ -32,7 +34,7 @@ when: - test_disk_ctrl_type == 'nvme' - test_purpose == "hot-add-spec13" - - vm_nvme_spec13_enabled + - vm_nvme_spec13_enabled is defined and vm_nvme_spec13_enabled - name: "Get VM current disk controller info" include_tasks: get_vm_disk_ctrl_info.yml diff --git a/windows/vhba_hot_add_remove/vhba_test_prepare.yml b/windows/vhba_hot_add_remove/vhba_test_prepare.yml index 02a6e232e..4957fea5a 100644 --- a/windows/vhba_hot_add_remove/vhba_test_prepare.yml +++ b/windows/vhba_hot_add_remove/vhba_test_prepare.yml @@ -20,4 +20,5 @@ include_tasks: enable_vm_nvme_spec13.yml when: - test_disk_ctrl_type == 'nvme' - - test_purpose == "hot-add-spec13" or (test_purpose == "hot-extend" and not vm_nvme_spec13_enabled) + - test_purpose == "hot-add-spec13" or (test_purpose == "hot-extend" and + (vm_nvme_spec13_enabled is undefined or not vm_nvme_spec13_enabled)) From dfa4bc333eb7bf6d35b620fdf1fa4bcca59e9792 Mon Sep 17 00:00:00 2001 From: dw035535 Date: Thu, 22 May 2025 06:31:05 +0000 Subject: [PATCH 09/10] address comments Signed-off-by: dw035535 --- windows/vhba_hot_add_remove/vhba_test.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/windows/vhba_hot_add_remove/vhba_test.yml b/windows/vhba_hot_add_remove/vhba_test.yml index 9c668ce9f..89ae2daea 100755 --- a/windows/vhba_hot_add_remove/vhba_test.yml +++ b/windows/vhba_hot_add_remove/vhba_test.yml @@ -15,12 +15,16 @@ - name: "For Windows {{ guest_os_product_type }} with guest ID {{ vm_guest_id }}" ansible.builtin.set_fact: vm_nvme_spec13_enabled: "{{ vm_guest_id | regex_search('windows(\\d+)srvNext', '\\1') | first | int >= 2019 }}" - when: guest_os_product_type == 'server' + when: + - guest_os_product_type == 'server' + - vm_guest_id | regex_search('windows(\\d+)srvNext') - name: "For Windows {{ guest_os_product_type }} with guest ID {{ vm_guest_id }}" ansible.builtin.set_fact: vm_nvme_spec13_enabled: "{{ vm_guest_id | regex_search('windows(\\d+)_', '\\1') | first | int >= 11 }}" - when: guest_os_product_type == 'client' + when: + - guest_os_product_type == 'client' + - vm_guest_id | regex_search('windows(\\d+)_') - name: "Skip test case" include_tasks: ../../common/skip_test_case.yml From f70c78d74352d5f03fc71f9b78681bbb0f4a565a Mon Sep 17 00:00:00 2001 From: dw035535 Date: Fri, 23 May 2025 07:18:18 +0000 Subject: [PATCH 10/10] remove guest os type check Signed-off-by: dw035535 --- windows/vhba_hot_add_remove/vhba_test.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/windows/vhba_hot_add_remove/vhba_test.yml b/windows/vhba_hot_add_remove/vhba_test.yml index 89ae2daea..808028905 100755 --- a/windows/vhba_hot_add_remove/vhba_test.yml +++ b/windows/vhba_hot_add_remove/vhba_test.yml @@ -15,16 +15,12 @@ - name: "For Windows {{ guest_os_product_type }} with guest ID {{ vm_guest_id }}" ansible.builtin.set_fact: vm_nvme_spec13_enabled: "{{ vm_guest_id | regex_search('windows(\\d+)srvNext', '\\1') | first | int >= 2019 }}" - when: - - guest_os_product_type == 'server' - - vm_guest_id | regex_search('windows(\\d+)srvNext') + when: vm_guest_id | regex_search('windows(\\d+)srvNext') - name: "For Windows {{ guest_os_product_type }} with guest ID {{ vm_guest_id }}" ansible.builtin.set_fact: vm_nvme_spec13_enabled: "{{ vm_guest_id | regex_search('windows(\\d+)_', '\\1') | first | int >= 11 }}" - when: - - guest_os_product_type == 'client' - - vm_guest_id | regex_search('windows(\\d+)_') + when: vm_guest_id | regex_search('windows(\\d+)_') - name: "Skip test case" include_tasks: ../../common/skip_test_case.yml