From b0f8d4fb7753a58be44402fb43866ea7b0505092 Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Thu, 5 Oct 2023 12:39:42 +0200 Subject: [PATCH 1/4] Remove upgrade jobs following Xena EOL The stable/xena branch was deleted with the end of life of the Xena release [1], which will cause Yoga upgrade jobs to fail. Also re-enable Ubuntu jobs which were disabled due to RabbitMQ packaging issues. [1] https://review.opendev.org/c/openstack/releases/+/894630 Change-Id: I5e662323febe4a1363212d19f57afde4aa35ac6a --- zuul.d/project.yaml | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 006772dcd..fdf0035de 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -15,8 +15,8 @@ - kayobe-overcloud-centos9s - kayobe-overcloud-rocky8 - kayobe-overcloud-rocky9 - # - kayobe-overcloud-ubuntu-focal Note(mattcrees): Job temporarily disabled until fix is merged, see: https://review.opendev.org/c/openstack/kolla/+/885857 - # - kayobe-overcloud-ubuntu-jammy + - kayobe-overcloud-ubuntu-focal + - kayobe-overcloud-ubuntu-jammy - kayobe-overcloud-host-configure-centos8s - kayobe-overcloud-host-configure-centos9s - kayobe-overcloud-host-configure-rocky8 @@ -25,15 +25,11 @@ - kayobe-overcloud-host-configure-ubuntu-jammy - kayobe-overcloud-tls-centos8s - kayobe-overcloud-tls-rocky9 - - kayobe-overcloud-upgrade-centos8s - # - kayobe-overcloud-upgrade-ubuntu-focal Note(mattcrees): Job temporarily disabled until fix is merged, see: https://review.opendev.org/c/openstack/kolla/+/885857 - kayobe-seed-centos8s - kayobe-seed-rocky8 - kayobe-seed-rocky9 - kayobe-seed-ubuntu-focal - kayobe-seed-ubuntu-jammy - - kayobe-seed-upgrade-centos8s - - kayobe-seed-upgrade-ubuntu-focal - kayobe-seed-vm-centos8s - kayobe-seed-vm-rocky8 - kayobe-seed-vm-rocky9 @@ -54,8 +50,8 @@ - kayobe-overcloud-centos8s - kayobe-overcloud-rocky8 - kayobe-overcloud-rocky9 - # - kayobe-overcloud-ubuntu-focal Note(mattcrees): Job temporarily disabled until fix is merged, see: https://review.opendev.org/c/openstack/kolla/+/885857 - # - kayobe-overcloud-ubuntu-jammy + - kayobe-overcloud-ubuntu-focal + - kayobe-overcloud-ubuntu-jammy - kayobe-overcloud-host-configure-centos8s - kayobe-overcloud-host-configure-rocky8 - kayobe-overcloud-host-configure-rocky9 @@ -63,15 +59,11 @@ - kayobe-overcloud-host-configure-ubuntu-jammy - kayobe-overcloud-tls-centos8s - kayobe-overcloud-tls-rocky9 - - kayobe-overcloud-upgrade-centos8s - # - kayobe-overcloud-upgrade-ubuntu-focal Note(mattcrees): Job temporarily disabled until fix is merged, see: https://review.opendev.org/c/openstack/kolla/+/885857 - kayobe-seed-centos8s - kayobe-seed-rocky8 - kayobe-seed-rocky9 - kayobe-seed-ubuntu-focal - kayobe-seed-ubuntu-jammy - - kayobe-seed-upgrade-centos8s - - kayobe-seed-upgrade-ubuntu-focal - kayobe-seed-vm-centos8s - kayobe-seed-vm-rocky8 - kayobe-seed-vm-rocky9 From 390fbf1d416f64d9e75856ef17632c9ccd71483d Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Wed, 4 Oct 2023 22:23:47 +0200 Subject: [PATCH 2/4] Fix data file path detection with new pip Using an editable installation of Kayobe fails on Rocky Linux 9 or Ubuntu with an error such as: ERROR! The requirements file '/home/rocky/kayobe/kayobe/requirements.yml' does not exist. Failed to install Ansible roles from /home/rocky/kayobe/kayobe/utils.py/../requirements.yml via Ansible Galaxy: returncode 1 Control host bootstrap failed - likely Ansible Galaxy flakiness. Sleeping 5 seconds before retrying This is caused by recent changes to how pip manages editable installations. The egg-link file that Kayobe was using to find the source path does not exist anymore. Instead, there is a direct_url.json file under the kayobe dist-info directory that can be parsed. This also includes Ic53efd03cecbd53ad3e3b64b664e084f4e25be0e to work around mocking issues in unit tests and an amended version of Iecf1d469caaa777c5b253eb0e44dc00692197ef7 to import importlib.metadata or importlib_metadata depending on the Python version. Change-Id: I9dd5b97dec93c0e5393a1e7d9640f85003651b56 Closes-Bug: #2020135 (cherry picked from commit 1847ad3f17a039f29e22f465508991fcb6e1cca7) --- kayobe/utils.py | 25 +++++++++++++++++++ ...stall-data-file-path-743b7a85a5f5db6d.yaml | 5 ++++ requirements.txt | 1 + 3 files changed, 31 insertions(+) create mode 100644 releasenotes/notes/editable-install-data-file-path-743b7a85a5f5db6d.yaml diff --git a/kayobe/utils.py b/kayobe/utils.py index 727fd783a..5864cfff4 100644 --- a/kayobe/utils.py +++ b/kayobe/utils.py @@ -14,6 +14,11 @@ import base64 import glob +try: + from importlib.metadata import Distribution +except ImportError: # for Python<3.8 + from importlib_metadata import Distribution +import json import logging import os import shutil @@ -48,10 +53,30 @@ def _detect_install_prefix(path): return prefix_path +def _get_direct_url(dist): + direct_url = os.path.join(dist._path, 'direct_url.json') + if os.path.isfile(direct_url): + with open(direct_url, 'r') as f: + direct_url_content = json.loads(f.readline().strip()) + url = direct_url_content['url'] + prefix = 'file://' + if url.startswith(prefix): + return url[len(prefix):] + + return None + + def _get_base_path(): override = os.environ.get("KAYOBE_DATA_FILES_PATH") if override: return os.path.join(override) + + kayobe_dist = list(Distribution.discover(name="kayobe")) + if kayobe_dist: + direct_url = _get_direct_url(kayobe_dist[0]) + if direct_url: + return direct_url + egg_glob = os.path.join( sys.prefix, 'lib*', 'python*', '*-packages', 'kayobe.egg-link' ) diff --git a/releasenotes/notes/editable-install-data-file-path-743b7a85a5f5db6d.yaml b/releasenotes/notes/editable-install-data-file-path-743b7a85a5f5db6d.yaml new file mode 100644 index 000000000..dac75efa8 --- /dev/null +++ b/releasenotes/notes/editable-install-data-file-path-743b7a85a5f5db6d.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixes detection of data file path when using editable installations with a + recent pip. diff --git a/requirements.txt b/requirements.txt index bab4725ed..c5be19e9d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ pbr>=2.0 # Apache-2.0 Jinja2>3 # BSD ansible>=4,<6.0 # GPLv3 cliff>=3.1.0 # Apache +importlib-metadata;python_version<'3.8' # Apache-2.0 netaddr!=0.7.16,>=0.7.13 # BSD PyYAML>=3.10.0 # MIT selinux # MIT From 8e93ecc986b65e73e728f4050f0635023b79c093 Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Tue, 10 Oct 2023 13:09:12 +0200 Subject: [PATCH 3/4] Add introspection rule to update deploy kernel location Back in the Ussuri release, we changed the Bifrost kernel location to use ipa.kernel instead of ipa.vmlinuz. While this works fine for newly discovered nodes, any node added to Bifrost in Train or earlier will have kept ipa.vmlinuz as its deploy kernel. This can cause issues since upgrading Bifrost or building new deployment images will update ipa.kernel, but not ipa.vmlinuz, resulting in nodes booting with an old kernel and a new ramdisk. Fix by adding a new rule updating the legacy kernel location and documenting how to update node information. Change-Id: I6ae44dcae78424b4638762d015cf24336444707f (cherry picked from commit 44af704836799e9b211e3eccfa5efa72f9713f32) --- ansible/group_vars/all/bifrost | 5 ++++- ansible/group_vars/all/inspector | 12 +++++++++++ ansible/seed-introspection-rules.yml | 1 + etc/kayobe/bifrost.yml | 3 +++ ...update-deploy-kernel-6943f3ad3cb82c51.yaml | 20 +++++++++++++++++++ 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/update-deploy-kernel-6943f3ad3cb82c51.yaml diff --git a/ansible/group_vars/all/bifrost b/ansible/group_vars/all/bifrost index d780cfb10..788dddd12 100644 --- a/ansible/group_vars/all/bifrost +++ b/ansible/group_vars/all/bifrost @@ -99,7 +99,7 @@ kolla_bifrost_inspector_port_addition: "{{ inspector_add_ports }}" kolla_bifrost_inspector_extra_kernel_options: "{{ inspector_extra_kernel_options }}" # List of introspection rules for Bifrost's Ironic Inspector service. -kolla_bifrost_inspector_rules: "{{ inspector_rules }}" +kolla_bifrost_inspector_rules: "{{ inspector_rules + [inspector_rule_legacy_deploy_kernel] }}" # Ironic inspector IPMI username to set. kolla_bifrost_inspector_ipmi_username: "{{ ipmi_username }}" @@ -117,6 +117,9 @@ kolla_bifrost_inspector_deploy_kernel: "http://{{ provision_oc_net_name | net_ip # Ironic inspector deployment ramdisk location. kolla_bifrost_inspector_deploy_ramdisk: "http://{{ provision_oc_net_name | net_ip }}:8080/ipa.initramfs" +# Ironic inspector legacy deployment kernel location. +kolla_bifrost_inspector_legacy_deploy_kernel: "http://{{ provision_oc_net_name | net_ip }}:8080/ipa.vmlinuz" + # Timeout of hardware inspection on overcloud nodes, in seconds. Default is # {{ inspector_inspection_timeout }}. kolla_bifrost_inspection_timeout: "{{ inspector_inspection_timeout }}" diff --git a/ansible/group_vars/all/inspector b/ansible/group_vars/all/inspector index a84a98a49..61bc01236 100644 --- a/ansible/group_vars/all/inspector +++ b/ansible/group_vars/all/inspector @@ -119,6 +119,18 @@ inspector_rule_deploy_kernel: path: "driver_info/deploy_kernel" value: "{{ inspector_rule_var_deploy_kernel }}" +# Ironic inspector rule to update deployment kernel from legacy location. +inspector_rule_legacy_deploy_kernel: + description: "Update deploy kernel from legacy" + conditions: + - field: "node://driver_info.deploy_kernel" + op: "eq" + value: "{{ inspector_rule_var_legacy_deploy_kernel }}" + actions: + - action: "set-attribute" + path: "driver_info/deploy_kernel" + value: "{{ inspector_rule_var_deploy_kernel }}" + # Deployment ramdisk referenced by inspector rule. inspector_rule_var_deploy_ramdisk: diff --git a/ansible/seed-introspection-rules.yml b/ansible/seed-introspection-rules.yml index 6c826150b..2b5b0bfab 100644 --- a/ansible/seed-introspection-rules.yml +++ b/ansible/seed-introspection-rules.yml @@ -20,3 +20,4 @@ inspector_rule_var_lldp_switch_port_interface: "{{ kolla_bifrost_inspector_lldp_switch_port_interface }}" inspector_rule_var_deploy_kernel: "{{ kolla_bifrost_inspector_deploy_kernel }}" inspector_rule_var_deploy_ramdisk: "{{ kolla_bifrost_inspector_deploy_ramdisk }}" + inspector_rule_var_legacy_deploy_kernel: "{{ kolla_bifrost_inspector_legacy_deploy_kernel }}" diff --git a/etc/kayobe/bifrost.yml b/etc/kayobe/bifrost.yml index a9eba19dd..d15d18613 100644 --- a/etc/kayobe/bifrost.yml +++ b/etc/kayobe/bifrost.yml @@ -116,6 +116,9 @@ # Ironic inspector deployment ramdisk location. #kolla_bifrost_inspector_deploy_ramdisk: +# Ironic inspector legacy deployment kernel location. +#kolla_bifrost_inspector_legacy_deploy_kernel: + # Timeout of hardware inspection on overcloud nodes, in seconds. Default is # {{ inspector_inspection_timeout }}. #kolla_bifrost_inspection_timeout: diff --git a/releasenotes/notes/update-deploy-kernel-6943f3ad3cb82c51.yaml b/releasenotes/notes/update-deploy-kernel-6943f3ad3cb82c51.yaml new file mode 100644 index 000000000..c098aec70 --- /dev/null +++ b/releasenotes/notes/update-deploy-kernel-6943f3ad3cb82c51.yaml @@ -0,0 +1,20 @@ +--- +upgrade: + - | + Adds an introspection rule to update the location of the deployment kernel + registered in existing Ironic nodes. Nodes discovered on a deployment + running the Train release or earlier may still be using the ``ipa.vmlinuz`` + kernel, which stays unchanged when deployment images get updated. If only + default introspection rules are in use, existing nodes may be updated from + the Bifrost container with the following command: + + ``OS_CLOUD=bifrost baremetal introspection reprocess $NODE_UUID_OR_NAME`` + + If non-default rules are used, reprocessing may revert any customisation + done by the operator. In this case, a more cautious approach is to update + the deployment kernel location manually: + + ``OS_CLOUD=bifrost baremetal node set --driver-info deploy_kernel= $NODE_UUID_OR_NAME`` + + If the ``kolla_bifrost_inspector_rules`` list is customised, the rule + ``inspector_rule_legacy_deploy_kernel`` should be added to it. From f609ae27a073aac351e703751b7731df9230cc20 Mon Sep 17 00:00:00 2001 From: Michal Nasiadka Date: Tue, 10 Oct 2023 08:03:47 +0200 Subject: [PATCH 4/4] bifrost: Populate bifrost host vars on deprovision Closes-Bug: #2038889 Change-Id: I4609494d009c6e1f97d833a9a11529d107b3216f (cherry picked from commit 672d6fa24a978009588e66dd19c623ee244a8f8e) --- kayobe/cli/commands.py | 3 ++- kayobe/tests/unit/cli/test_commands.py | 2 ++ .../bifrost-host-vars-deprovision-525c450cf20f7f71.yaml | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/bifrost-host-vars-deprovision-525c450cf20f7f71.yaml diff --git a/kayobe/cli/commands.py b/kayobe/cli/commands.py index 110bc9b3d..5b98adc88 100644 --- a/kayobe/cli/commands.py +++ b/kayobe/cli/commands.py @@ -1080,7 +1080,8 @@ class OvercloudDeprovision(KayobeAnsibleMixin, VaultMixin, Command): def take_action(self, parsed_args): self.app.LOG.debug("Deprovisioning overcloud") - playbooks = _build_playbook_list("overcloud-deprovision") + playbooks = _build_playbook_list("kolla-bifrost-hostvars", + "overcloud-deprovision") self.run_kayobe_playbooks(parsed_args, playbooks) diff --git a/kayobe/tests/unit/cli/test_commands.py b/kayobe/tests/unit/cli/test_commands.py index 7e4f440dd..a2442e9f8 100644 --- a/kayobe/tests/unit/cli/test_commands.py +++ b/kayobe/tests/unit/cli/test_commands.py @@ -1241,6 +1241,8 @@ def test_overcloud_deprovision(self, mock_run): mock.call( mock.ANY, [ + utils.get_data_files_path( + "ansible", "kolla-bifrost-hostvars.yml"), utils.get_data_files_path( "ansible", "overcloud-deprovision.yml"), ], diff --git a/releasenotes/notes/bifrost-host-vars-deprovision-525c450cf20f7f71.yaml b/releasenotes/notes/bifrost-host-vars-deprovision-525c450cf20f7f71.yaml new file mode 100644 index 000000000..4b866b30f --- /dev/null +++ b/releasenotes/notes/bifrost-host-vars-deprovision-525c450cf20f7f71.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixes failure to run ``kayobe overcloud deprovision`` after Bifrost is + redeployed. + `LP#2038889 `__ +