From 25255294cdca2fa17b3af7c0bacd3b8304e487dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Ciecierski?= Date: Fri, 12 Jul 2024 14:44:55 +0200 Subject: [PATCH] Change pattern for detecting pre-adopted versus edpm nodes Change edpm_reboot_old_tripleo_node_config_dir to check for tripleo files in /var/lib/config-data/puppet-generated instead of /var/lib/config-data. Path /var/lib/config-data is still being used in edpm for storing configs whereas puppet-generated is suppose to be used only in 17/wallaby. This will make sure for greenfield auto mode is back working, but reboot is skipped on tripleo nodes during adoption. Resolves: OSPRH-8415 --- roles/edpm_reboot/defaults/main.yaml | 2 +- roles/edpm_reboot/meta/argument_specs.yml | 2 +- .../molecule/pre-adoption/converge.yml | 35 ++++++++++++++++ .../molecule/pre-adoption/molecule.yml | 35 ++++++++++++++++ .../molecule/pre-adoption/prepare.yml | 41 +++++++++++++++++++ 5 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 roles/edpm_reboot/molecule/pre-adoption/converge.yml create mode 100644 roles/edpm_reboot/molecule/pre-adoption/molecule.yml create mode 100644 roles/edpm_reboot/molecule/pre-adoption/prepare.yml diff --git a/roles/edpm_reboot/defaults/main.yaml b/roles/edpm_reboot/defaults/main.yaml index 3c07ec9a6..37fe38ff1 100644 --- a/roles/edpm_reboot/defaults/main.yaml +++ b/roles/edpm_reboot/defaults/main.yaml @@ -18,7 +18,7 @@ # All variables intended for modification should be placed in this file. edpm_reboot_strategy: auto -edpm_reboot_old_tripleo_node_config_dir: /var/lib/config-data +edpm_reboot_old_tripleo_node_config_dir: /var/lib/config-data/puppet-generated edpm_reboot_edpm_node_config_dir: /var/lib/openstack/config edpm_reboot_timeout_reboot: 3600 edpm_reboot_post_reboot_delay: 60 diff --git a/roles/edpm_reboot/meta/argument_specs.yml b/roles/edpm_reboot/meta/argument_specs.yml index 00ddd256c..fa4a2418e 100644 --- a/roles/edpm_reboot/meta/argument_specs.yml +++ b/roles/edpm_reboot/meta/argument_specs.yml @@ -13,7 +13,7 @@ argument_specs: default: auto edpm_reboot_old_tripleo_node_config_dir: type: path - default: /var/lib/config-data + default: /var/lib/config-data/puppet-generated description: Path to check for tripleo pre-adopted nodes edpm_reboot_edpm_node_config_dir: type: path diff --git a/roles/edpm_reboot/molecule/pre-adoption/converge.yml b/roles/edpm_reboot/molecule/pre-adoption/converge.yml new file mode 100644 index 000000000..07cd211d8 --- /dev/null +++ b/roles/edpm_reboot/molecule/pre-adoption/converge.yml @@ -0,0 +1,35 @@ +--- +# Copyright 2024 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +- name: Converge + hosts: all + gather_facts: true + become: true + tasks: + - name: Create reboot_required directory + ansible.builtin.file: + path: /var/lib/openstack/reboot_required/ + state: directory + mode: '0755' + - name: Create sample file in /var/lib/openstack/reboot_required/ + ansible.builtin.file: + path: /var/lib/openstack/reboot_required/edpm_kernel + state: touch + mode: '0600' + - name: Run reboot role + ansible.builtin.include_role: + name: "osp.edpm.edpm_reboot" diff --git a/roles/edpm_reboot/molecule/pre-adoption/molecule.yml b/roles/edpm_reboot/molecule/pre-adoption/molecule.yml new file mode 100644 index 000000000..3f4f49198 --- /dev/null +++ b/roles/edpm_reboot/molecule/pre-adoption/molecule.yml @@ -0,0 +1,35 @@ +--- +dependency: + name: galaxy + options: + role-file: collections.yml +driver: + name: podman +platforms: +- command: /sbin/init + dockerfile: ../../../../molecule/common/Containerfile.j2 + image: ${EDPM_ANSIBLE_MOLECULE_IMAGE:-"ubi9/ubi-init"} + name: instance + privileged: true + registry: + url: ${EDPM_ANSIBLE_MOLECULE_REGISTRY:-"registry.access.redhat.com"} + ulimits: + - host +provisioner: + config_options: + defaults: + callbacks_enabled: profile_tasks, timer, yaml + interpreter_python: auto_silent + log: true + name: ansible +scenario: + test_sequence: + - dependency + - destroy + - create + - prepare + - converge + - verify + - destroy +verifier: + name: ansible diff --git a/roles/edpm_reboot/molecule/pre-adoption/prepare.yml b/roles/edpm_reboot/molecule/pre-adoption/prepare.yml new file mode 100644 index 000000000..079ac72cd --- /dev/null +++ b/roles/edpm_reboot/molecule/pre-adoption/prepare.yml @@ -0,0 +1,41 @@ +--- +# Copyright 2024 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +- name: Prepare test_deps + hosts: all + roles: + - role: ../../../../molecule/common/test_deps + +- name: Prepare + hosts: all + roles: + - role: osp.edpm.env_data + tasks: + - name: Create nova config directory + ansible.builtin.file: + path: /var/lib/config-data/puppet-generated + state: directory + mode: "0775" + + - name: Create nova_libvirt.md5sum file + ansible.builtin.copy: + dest: /var/lib/config-data/puppet-generated/nova_libvirt.md5sum + mode: "0644" + owner: root + group: root + content: | + 2b719b64bde94c1c5e8bd9445957asd2