Avoid failure when non DPDK instances present

Avoid the validation failure when there are non DPDK instances. The playbook fails when there are instances not containing numatune, vcpupin or hugepages settings on the domain xml content.

Closes-Bug: #1988211

Signed-off-by: Juan Pablo Martí <jmarti@redhat.com>
Change-Id: I243f7781cd72827c0a1f9623a7e994e63d1561b0
(cherry picked from commit 477aaa9877)
This commit is contained in:
Juan Pablo Martí
2022-08-30 14:27:55 -03:00
committed by Jiri Podivin
parent 0ba58e88cf
commit 6be51cd366

View File

@@ -6,10 +6,12 @@
content: attribute content: attribute
attribute: nodeset attribute: nodeset
register: xml_instance_node register: xml_instance_node
when: '"numatune" in instance_xml_data'
- name: Get instance associated numa nodes - name: Get instance associated numa nodes
set_fact: set_fact:
instance_numa: "{{ xml_instance_node.matches[0].memory.nodeset }}" instance_numa: "{{ xml_instance_node.matches[0].memory.nodeset }}"
when: '"numatune" in instance_xml_data'
# Validates the instance vcpus list. # Validates the instance vcpus list.
- name: Get vcpu list from xml string - name: Get vcpu list from xml string
@@ -19,6 +21,7 @@
content: attribute content: attribute
attribute: cpuset attribute: cpuset
register: xml_vcpus register: xml_vcpus
when: '"vcpupin" in instance_xml_data'
- name: Get instance vcpus list - name: Get instance vcpus list
set_fact: set_fact:
@@ -27,6 +30,7 @@
loop: "{{ xml_vcpus.matches }}" loop: "{{ xml_vcpus.matches }}"
loop_control: loop_control:
loop_var: vcpu loop_var: vcpu
when: '"vcpupin" in instance_xml_data'
- name: Check vcpu's aligned with DPDK NIC's NUMA - name: Check vcpu's aligned with DPDK NIC's NUMA
become: true become: true
@@ -35,11 +39,13 @@
numa_node: "{{ instance_numa | int }}" numa_node: "{{ instance_numa | int }}"
dpdk_nics_numa_info: "{{ dpdk_nics_numa_info }}" dpdk_nics_numa_info: "{{ dpdk_nics_numa_info }}"
register: valid_cpus register: valid_cpus
when: '"vcpupin" in instance_xml_data'
- name: Check vcpu's valid or not - name: Check vcpu's valid or not
set_fact: set_fact:
validation_msg: "{{ validation_msg }} + {{ [valid_cpus.message] }}" validation_msg: "{{ validation_msg }} + {{ [valid_cpus.message] }}"
when: when:
- '"vcpupin" in instance_xml_data'
- not valid_cpus.valid_cpus - not valid_cpus.valid_cpus
# Validates instance emulatorpin threads # Validates instance emulatorpin threads
@@ -50,12 +56,15 @@
content: attribute content: attribute
attribute: cpuset attribute: cpuset
register: xml_emulatorpin register: xml_emulatorpin
when: '"emulatorpin" in instance_xml_data'
- name: Check emulatorpin valid or not - name: Check emulatorpin valid or not
set_fact: set_fact:
validation_msg: "{{ validation_msg }} + {{ ['Invalid emulatorpin configured for instance ' \ validation_msg: "{{ validation_msg }} + {{ ['Invalid emulatorpin configured for instance ' \
+ instance_name + ': ' + emulatorpin.emulatorpin.cpuset] }}" + instance_name + ': ' + emulatorpin.emulatorpin.cpuset] }}"
when: "{{ emulatorpin.emulatorpin.cpuset in vcpus_list | list }}" when:
- '"emulatorpin" in instance_xml_data'
- emulatorpin.emulatorpin.cpuset in vcpus_list | list
loop: "{{ xml_emulatorpin.matches }}" loop: "{{ xml_emulatorpin.matches }}"
loop_control: loop_control:
loop_var: emulatorpin loop_var: emulatorpin
@@ -68,12 +77,15 @@
content: attribute content: attribute
attribute: size attribute: size
register: xmlhugepages register: xmlhugepages
when: '"memoryBacking" in instance_xml_data and "hugepages" in instance_xml_data'
- name: Set instance {{ instance_name }} hugepages details - name: Set instance {{ instance_name }} hugepages details
set_fact: set_fact:
msg: |- msg: |-
Huge page size '{{ xmlhugepages.matches[0].page.size }}' Huge page size '{{ xmlhugepages.matches[0].page.size }}'
when: "{{ xmlhugepages.matches[0].page.size | length >= 6 }}" when:
- '"memoryBacking" in instance_xml_data and "hugepages" in instance_xml_data'
- 'xmlhugepages.matches[0].page.size | length >= 6'
# Validates instance tx rx queue sizes and should be greater than or equal to 1024. # Validates instance tx rx queue sizes and should be greater than or equal to 1024.
- name: Get {{ instance_name }} libvirt tx | rx queue sizes from xml string - name: Get {{ instance_name }} libvirt tx | rx queue sizes from xml string