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
This commit is contained in:
Juan Pablo Martí 2022-08-30 14:27:55 -03:00
parent 514f6c496c
commit 477aaa9877
1 changed files with 14 additions and 2 deletions

View File

@ -5,10 +5,12 @@
xpath: /domain/numatune/memory
content: attribute
register: xml_instance_node
when: '"numatune" in instance_xml_data'
- name: Get instance associated numa nodes
set_fact:
instance_numa: "{{ xml_instance_node.matches[0].memory.nodeset }}"
when: '"numatune" in instance_xml_data'
# Validates the instance vcpus list.
- name: Get vcpu list from xml string
@ -17,6 +19,7 @@
xpath: /domain/cputune/vcpupin
content: attribute
register: xml_vcpus
when: '"vcpupin" in instance_xml_data'
- name: Get instance vcpus list
set_fact:
@ -25,6 +28,7 @@
loop: "{{ xml_vcpus.matches }}"
loop_control:
loop_var: vcpu
when: '"vcpupin" in instance_xml_data'
- name: Check vcpu's aligned with DPDK NIC's NUMA
become: true
@ -33,11 +37,13 @@
numa_node: "{{ instance_numa | int }}"
dpdk_nics_numa_info: "{{ dpdk_nics_numa_info }}"
register: valid_cpus
when: '"vcpupin" in instance_xml_data'
- name: Check vcpu's valid or not
set_fact:
validation_msg: "{{ validation_msg }} + {{ [valid_cpus.message] }}"
when:
- '"vcpupin" in instance_xml_data'
- not valid_cpus.valid_cpus
# Validates instance emulatorpin threads
@ -47,12 +53,15 @@
xpath: /domain/cputune/emulatorpin
content: attribute
register: xml_emulatorpin
when: '"emulatorpin" in instance_xml_data'
- name: Check emulatorpin valid or not
set_fact:
validation_msg: "{{ validation_msg }} + {{ ['Invalid emulatorpin configured for instance ' \
+ 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_control:
loop_var: emulatorpin
@ -64,12 +73,15 @@
xpath: /domain/memoryBacking/hugepages/page
content: attribute
register: xmlhugepages
when: '"memoryBacking" in instance_xml_data and "hugepages" in instance_xml_data'
- name: Set instance {{ instance_name }} hugepages details
set_fact:
msg: |-
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.
- name: Get {{ instance_name }} libvirt tx | rx queue sizes from xml string