Skip to content

Commit

Permalink
[Windows] Skip VBS test for guest OS with lower hardware version (#562)
Browse files Browse the repository at this point in the history
Signed-off-by: Yanan Shen <[email protected]>
  • Loading branch information
123lzxm authored Mar 28, 2024
1 parent 4b1223a commit c77cfea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions common/esxi_get_model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
ansible.builtin.set_fact:
esxi_model_info: "{{ esxi_host_property_results.ansible_facts.summary.hardware.vendor }} {{ esxi_host_property_results.ansible_facts.summary.hardware.model }}"
esxi_cpu_model_info: "{{ esxi_host_property_results.ansible_facts.summary.hardware.cpuModel }}"
esxi_cpu_vendor: "{{ esxi_host_property_results.ansible_facts.hardware.cpuPkg[0].vendor | default('Unknown') }}"
esxi_cpu_vendor: "{{ esxi_host_property_results.ansible_facts.hardware.cpuPkg[0].vendor | default('Unknown') | lower }}"

- name: "Get ESXi server CPU code name"
when: esxi_cpu_vendor | lower == 'intel'
when: esxi_cpu_vendor == 'intel'
block:
- name: "Get ESXi server CPU code name"
ansible.builtin.script: "../tools/query_cpu.py -n '{{ cpu_name }}'"
Expand Down
20 changes: 12 additions & 8 deletions windows/vbs_enable_disable/vbs_enable_disable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@
skip_reason: "Not Applicable"
when: vm_firmware | lower != 'efi'

- name: "Set ESXi CPU model"
ansible.builtin.set_fact:
esxi_cpu_model: |-
{%- if 'AMD' in esxi_cpu_model_info -%}AMD
{%- elif 'Intel' in esxi_cpu_model_info -%}Intel
{%- else -%}Others
{%- endif -%}
- name: "Skip test case"
include_tasks: ../../common/skip_test_case.yml
vars:
skip_msg: >-
Skip test case due to using Intel CPUs for VBS requires hardware version 14 or higher and using AMD CPUs for VBS requires
hardware version 19 or higher. Current CPU is {{ esxi_cpu_vendor }} and hardware version is {{ vm_hardware_version_num }}.
Please refer to https://docs.vmware.com/en/VMware-vSphere/8.0/vsphere-security/GUID-CE292D3F-D4AC-4607-B262-DE19CE6E9F6B.html
skip_reason: "Not Supported"
when: >-
(vm_hardware_version_num | int < 14 and esxi_cpu_vendor == "intel") or
(vm_hardware_version_num | int < 19 and esxi_cpu_vendor == "amd")
- name: "Skip test case"
include_tasks: ../../common/skip_test_case.yml
Expand All @@ -45,7 +49,7 @@
build is {{ guest_os_build_num }}. Please refer to https://kb.vmware.com/s/article/2009916.
skip_reason: "Not Applicable"
when:
- esxi_cpu_model == "AMD"
- esxi_cpu_vendor == "amd"
- guest_os_build_num | int < 17763

- name: "VBS enable test"
Expand Down
6 changes: 3 additions & 3 deletions windows/vbs_enable_disable/vbs_enable_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
- name: "Set expected security properties"
ansible.builtin.set_fact:
expected_security_properties: >-
{%- if esxi_cpu_model == "Intel" and guest_os_build_num | int == 10240 -%}
{%- if esxi_cpu_vendor == "intel" and guest_os_build_num | int == 10240 -%}
{{ range(1, 4) | list }}
{%- elif (esxi_cpu_model == "AMD" and guest_os_build_num | int == 17763) or
(esxi_cpu_model == "Intel" and guest_os_build_num | int == 14393) -%}
{%- elif (esxi_cpu_vendor == "amd" and guest_os_build_num | int == 17763) or
(esxi_cpu_vendor == "intel" and guest_os_build_num | int == 14393) -%}
{{ range(1, 7) | list }}
{%- else -%}
{{ range(1, 8) | list }}
Expand Down

0 comments on commit c77cfea

Please sign in to comment.