From 999a9e1bd379fc794ea0f3d408891436dc9bc5b9 Mon Sep 17 00:00:00 2001 From: sfulmer Date: Wed, 15 Apr 2026 12:08:09 -0400 Subject: [PATCH 1/7] fix(vm_collect, vm_hot_plug): fix copy-paste bugs breaking label selector queries and memory hotplug Three bugs fixed: 1. vm_collect: task name referenced vm_backup_restore_collect_obj and collect_obj_default_kind (leftover from backup_restore role), causing undefined variable errors when using label_selectors. Fixed to use vm_collect_obj and vm_collect_obj_default_kind. 2. vm_collect: set_fact in the label_selectors block referenced vm_collect_no_label_selectors_response (the loop_var from the other block) instead of vm_collect_label_selectors_response. This caused VMs queried via label_selectors to never be added to the collection, resulting in an empty VM list downstream. 3. vm_hot_plug: compute_patch.yml.j2 checked for 'cpu' instead of 'memory' when deciding whether to patch domain/memory/guest. Memory- only hotplug was silently skipped; cpu-only hotplug would fail trying to render an undefined memory value. Co-Authored-By: Claude Opus 4.6 --- roles/vm_collect/tasks/main.yml | 4 ++-- roles/vm_hot_plug/templates/compute_patch.yml.j2 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/vm_collect/tasks/main.yml b/roles/vm_collect/tasks/main.yml index bf8b45f..0a3dfcb 100644 --- a/roles/vm_collect/tasks/main.yml +++ b/roles/vm_collect/tasks/main.yml @@ -45,7 +45,7 @@ - "(lookup('ansible.builtin.vars', vm_collect_vms_var, default=[]) | map(attribute='response_obj') | list) | selectattr('metadata.namespace', 'equalto', vm_collect_no_label_selectors_response.metadata.namespace) | list | selectattr('metadata.name', 'equalto', vm_collect_no_label_selectors_response.metadata.name) | list | length == 0" # noqa: yaml[line-length] - "('namespace' in vm_collect_request_instance and 'names' in vm_collect_request_instance and vm_collect_no_label_selectors_response.metadata.name in vm_collect_request_instance['names']) or ('namespace' in vm_collect_request_instance and 'names' not in vm_collect_request_instance) or ('namespace' not in vm_collect_request_instance)" # noqa: yaml[line-length] -- name: "Query Using Label Selector - {{ vm_backup_restore_collect_obj | default(collect_obj_default_kind) }}" +- name: "Query Using Label Selector - {{ vm_collect_obj | default(vm_collect_obj_default_kind) }}" when: "'label_selectors' in vm_collect_request_instance" block: - name: "Query (With Label Selector) - {{ vm_collect_obj | default(vm_collect_obj_default_kind) }}" @@ -61,7 +61,7 @@ - name: "Add (With Label Selector) - {{ vm_collect_obj | default(vm_collect_obj_default_kind) }}" ansible.builtin.set_fact: - "{{ vm_collect_vms_var }}": "{{ lookup('ansible.builtin.vars', vm_collect_vms_var, default=[]) + [{'response_obj': vm_collect_no_label_selectors_response} | ansible.builtin.combine(vm_collect_request_instance, recursive=True)] }}" # noqa: var-naming[no-jinja] # noqa: yaml[line-length] + "{{ vm_collect_vms_var }}": "{{ lookup('ansible.builtin.vars', vm_collect_vms_var, default=[]) + [{'response_obj': vm_collect_label_selectors_response} | ansible.builtin.combine(vm_collect_request_instance, recursive=True)] }}" # noqa: var-naming[no-jinja] # noqa: yaml[line-length] loop: "{{ vm_collect_label_selectors_responses['resources'] if 'resources' in vm_collect_label_selectors_responses else [] }}" # noqa: yaml[line-length] loop_control: loop_var: vm_collect_label_selectors_response diff --git a/roles/vm_hot_plug/templates/compute_patch.yml.j2 b/roles/vm_hot_plug/templates/compute_patch.yml.j2 index bcc24ec..5015fc7 100644 --- a/roles/vm_hot_plug/templates/compute_patch.yml.j2 +++ b/roles/vm_hot_plug/templates/compute_patch.yml.j2 @@ -10,7 +10,7 @@ path: /spec/template/spec/domain/cpu value: {{ vm_hot_plug_vm.response_obj.spec.template.spec.domain.cpu | ansible.builtin.combine((vm_hot_plug_compute['cpu']), recursive=true) | from_yaml }} {% endif %} -{% if 'cpu' in vm_hot_plug_compute and vm_hot_plug_compute['cpu'] is not none %} +{% if 'memory' in vm_hot_plug_compute and vm_hot_plug_compute['memory'] is not none %} - op: replace path: /spec/template/spec/domain/memory/guest value: {{ vm_hot_plug_compute['memory'] }} From 3eca18adbddb92019000b81c6faf029c2df5e92d Mon Sep 17 00:00:00 2001 From: sfulmer Date: Sat, 2 May 2026 09:51:55 -0400 Subject: [PATCH 2/7] fix: add missing allowlist_externals for tox-ansible environments --- tox-ansible.ini | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tox-ansible.ini b/tox-ansible.ini index 89248d9..d694f8d 100644 --- a/tox-ansible.ini +++ b/tox-ansible.ini @@ -31,6 +31,14 @@ allowlist_externals = mkdir ln bash + echo + git + ansible-galaxy + ansible-test + ansible-doc + pytest + mkdir + ln commands = mkdir -p "{env:HOME}/.ansible/collections/ansible_collections" ansible-galaxy collection install "{toxinidir}" -p '{env:HOME}/.ansible/collections/ansible_collections' --force From 86646f44de17157210702bdbbaff0b1388d75b54 Mon Sep 17 00:00:00 2001 From: sfulmer Date: Sat, 2 May 2026 10:00:35 -0400 Subject: [PATCH 3/7] fix: let tox-ansible manage test commands instead of overriding --- tox-ansible.ini | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tox-ansible.ini b/tox-ansible.ini index d694f8d..c0fc043 100644 --- a/tox-ansible.ini +++ b/tox-ansible.ini @@ -46,15 +46,13 @@ commands = [testenv] set_env = - COLLECTIONS_PATH = "{env:HOME}/.ansible/collections/ansible_collections" + COLLECTIONS_PATH = {env:HOME}/.ansible/collections/ansible_collections FORCE_COLOR = 1 passenv = HOME ANSIBLE_COLLECTIONS_PATH + ANSIBLE_GALAXY_* no_package = true -deps = - -r tests/integration/requirements.txt -change_dir = {env:HOME}/.ansible/collections/ansible_collections/infra/openshift_virtualization_ops skip_install = false allowlist_externals = bash @@ -68,6 +66,5 @@ allowlist_externals = ansible-doc pytest ln -commands = - bash -c 'git init --initial-branch=main .' - bash -c 'ansible-test integration' + sh + ade From 68401a92950e92976f29cb0d009f4475717e8c09 Mon Sep 17 00:00:00 2001 From: sfulmer Date: Sat, 2 May 2026 10:22:22 -0400 Subject: [PATCH 4/7] fix: add distlib to testenv deps for galaxy/sanity manifest support --- tox-ansible.ini | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tox-ansible.ini b/tox-ansible.ini index c0fc043..4d47a9a 100644 --- a/tox-ansible.ini +++ b/tox-ansible.ini @@ -31,14 +31,6 @@ allowlist_externals = mkdir ln bash - echo - git - ansible-galaxy - ansible-test - ansible-doc - pytest - mkdir - ln commands = mkdir -p "{env:HOME}/.ansible/collections/ansible_collections" ansible-galaxy collection install "{toxinidir}" -p '{env:HOME}/.ansible/collections/ansible_collections' --force @@ -54,6 +46,8 @@ passenv = ANSIBLE_GALAXY_* no_package = true skip_install = false +deps = + distlib allowlist_externals = bash echo From d92e006fc0148ece82a16f9620753b9e3465e28e Mon Sep 17 00:00:00 2001 From: sfulmer Date: Sat, 2 May 2026 10:26:53 -0400 Subject: [PATCH 5/7] =?UTF-8?q?fix:=20remove=20testenv=20overrides=20?= =?UTF-8?q?=E2=80=94=20only=20set=20allowlist=5Fexternals,=20let=20tox-ans?= =?UTF-8?q?ible=20manage=20deps/commands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tox-ansible.ini | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tox-ansible.ini b/tox-ansible.ini index 4d47a9a..983c63f 100644 --- a/tox-ansible.ini +++ b/tox-ansible.ini @@ -37,17 +37,6 @@ commands = ansible-galaxy collection install -r "{toxinidir}/requirements-dev.yml" [testenv] -set_env = - COLLECTIONS_PATH = {env:HOME}/.ansible/collections/ansible_collections - FORCE_COLOR = 1 -passenv = - HOME - ANSIBLE_COLLECTIONS_PATH - ANSIBLE_GALAXY_* -no_package = true -skip_install = false -deps = - distlib allowlist_externals = bash echo From 8c2e177084cf0b3b9d5994cd5ef2ebff38e6fb25 Mon Sep 17 00:00:00 2001 From: sfulmer Date: Sat, 2 May 2026 10:37:44 -0400 Subject: [PATCH 6/7] fix: add distlib to galaxy tox env for manifest support --- tox-ansible.ini | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tox-ansible.ini b/tox-ansible.ini index 983c63f..38bb999 100644 --- a/tox-ansible.ini +++ b/tox-ansible.ini @@ -51,3 +51,8 @@ allowlist_externals = ln sh ade + +[testenv:galaxy] +deps = + galaxy-importer>=0.4.31 + distlib From 1942a6e0027e6bef98f3c74cf57e6ca88a3bf038 Mon Sep 17 00:00:00 2001 From: sfulmer Date: Mon, 4 May 2026 08:23:40 -0400 Subject: [PATCH 7/7] fix: restore original testenv config, only add allowlist_externals --- tox-ansible.ini | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tox-ansible.ini b/tox-ansible.ini index 38bb999..89248d9 100644 --- a/tox-ansible.ini +++ b/tox-ansible.ini @@ -37,6 +37,17 @@ commands = ansible-galaxy collection install -r "{toxinidir}/requirements-dev.yml" [testenv] +set_env = + COLLECTIONS_PATH = "{env:HOME}/.ansible/collections/ansible_collections" + FORCE_COLOR = 1 +passenv = + HOME + ANSIBLE_COLLECTIONS_PATH +no_package = true +deps = + -r tests/integration/requirements.txt +change_dir = {env:HOME}/.ansible/collections/ansible_collections/infra/openshift_virtualization_ops +skip_install = false allowlist_externals = bash echo @@ -49,10 +60,6 @@ allowlist_externals = ansible-doc pytest ln - sh - ade - -[testenv:galaxy] -deps = - galaxy-importer>=0.4.31 - distlib +commands = + bash -c 'git init --initial-branch=main .' + bash -c 'ansible-test integration'