From bbe2cf1156c878664c43df14a735adef1f3b9c7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Mon, 2 Dec 2024 10:56:25 +0100 Subject: [PATCH] Add conditions on ironic node enroll and chrony restart The node enroll is depending on install_yamls makefile targets, these cannot be used when adopting ci-framework deployed virtual infrastructure. Also add a condition on the chrony restart which is required when a snapshot of standalone OSP VM. Jira: OSPRH-12093 --- tests/playbooks/test_with_ironic.yaml | 1 + .../defaults/main.yaml | 2 ++ .../files/pre_launch_ironic.bash | 20 +++++++++++-------- .../development_environment/tasks/main.yaml | 2 ++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/tests/playbooks/test_with_ironic.yaml b/tests/playbooks/test_with_ironic.yaml index 35cf5bd81..472f249bd 100644 --- a/tests/playbooks/test_with_ironic.yaml +++ b/tests/playbooks/test_with_ironic.yaml @@ -26,6 +26,7 @@ vars: ironic_adoption: true nova_libvirt_backend: local + prelaunch_test_instance_script: pre_launch_ironic.bash roles: - role: development_environment - role: backend_services diff --git a/tests/roles/development_environment/defaults/main.yaml b/tests/roles/development_environment/defaults/main.yaml index 2ff4ca304..3f1c9206e 100644 --- a/tests/roles/development_environment/defaults/main.yaml +++ b/tests/roles/development_environment/defaults/main.yaml @@ -24,3 +24,5 @@ supported_backup_backends: [] # override var for openstack command to use on the source cloud openstack_command: >- ssh -i {{ edpm_privatekey_path }} -o StrictHostKeyChecking=no {{ source_osp_ssh_user }}@{{ standalone_ip | default(edpm_node_ip) }} OS_CLOUD={{ os_cloud_name }} openstack +enroll_ironic_bmaas_nodes: true +pre_launch_ironic_restart_chrony: true diff --git a/tests/roles/development_environment/files/pre_launch_ironic.bash b/tests/roles/development_environment/files/pre_launch_ironic.bash index 8431ca9b1..0860b3d48 100644 --- a/tests/roles/development_environment/files/pre_launch_ironic.bash +++ b/tests/roles/development_environment/files/pre_launch_ironic.bash @@ -37,16 +37,20 @@ function wait_image_active() { # If the snapshot was reverted, and time is way off we get SSL issues in agent<->ironic connection # Workaround by restarting chronyd.service -ssh -i $EDPM_PRIVATEKEY_PATH root@192.168.122.100 systemctl restart chronyd.service -ssh -i $EDPM_PRIVATEKEY_PATH root@192.168.122.100 chronyc -a makestep +if [[ "${PRE_LAUNCH_IRONIC_RESTART_CHRONY,,}" != "false" ]]; then + ssh -i $EDPM_PRIVATEKEY_PATH root@192.168.122.100 systemctl restart chronyd.service + ssh -i $EDPM_PRIVATEKEY_PATH root@192.168.122.100 chronyc -a makestep +fi # Enroll baremetal nodes -pushd ${INSTALL_YAMLS_PATH}/devsetup -make --silent bmaas_generate_nodes_yaml | tail -n +2 | tee /tmp/ironic_nodes.yaml -popd - -scp -i $EDPM_PRIVATEKEY_PATH /tmp/ironic_nodes.yaml root@192.168.122.100:/root/ironic_nodes.yaml -ssh -i $EDPM_PRIVATEKEY_PATH root@192.168.122.100 OS_CLOUD=standalone openstack baremetal create /root/ironic_nodes.yaml +if [[ "${ENROLL_BMAAS_IRONIC_NODES,,}" != "false" ]]; then + pushd ${INSTALL_YAMLS_PATH}/devsetup + make --silent bmaas_generate_nodes_yaml | tail -n +2 | tee /tmp/ironic_nodes.yaml + popd + + scp -i $EDPM_PRIVATEKEY_PATH /tmp/ironic_nodes.yaml root@192.168.122.100:/root/ironic_nodes.yaml + ssh -i $EDPM_PRIVATEKEY_PATH root@192.168.122.100 OS_CLOUD=standalone openstack baremetal create /root/ironic_nodes.yaml +fi export IRONIC_PYTHON_AGENT_RAMDISK_ID=$(${BASH_ALIASES[openstack]} image show deploy-ramdisk -c id -f value) export IRONIC_PYTHON_AGENT_KERNEL_ID=$(${BASH_ALIASES[openstack]} image show deploy-kernel -c id -f value) diff --git a/tests/roles/development_environment/tasks/main.yaml b/tests/roles/development_environment/tasks/main.yaml index ddd85d393..544c0c28a 100644 --- a/tests/roles/development_environment/tasks/main.yaml +++ b/tests/roles/development_environment/tasks/main.yaml @@ -10,6 +10,8 @@ export OPENSTACK_COMMAND="{{ openstack_command }}" export CINDER_VOLUME_BACKEND_CONFIGURED={{ cinder_volume_backend_configured | string | lower }} export CINDER_BACKUP_BACKEND_CONFIGURED={{ cinder_backup_backend_configured | string | lower }} + export ENROLL_BMAAS_IRONIC_NODES={{ enroll_ironic_bmaas_nodes | string | lower }} + export PRE_LAUNCH_IRONIC_RESTART_CHRONY={{ pre_launch_ironic_restart_chrony | string | lower }} {{ lookup('ansible.builtin.file', prelaunch_test_instance_script) }} - name: Start and setup ping test