Skip to content

Commit

Permalink
Merge pull request #751 from hjensas/ironic-pre-launch-conditions
Browse files Browse the repository at this point in the history
Add conditions on ironic node enroll and chrony restart
  • Loading branch information
jistr authored Dec 5, 2024
2 parents 5c5bfd6 + bbe2cf1 commit be47939
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions tests/playbooks/test_with_ironic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/roles/development_environment/defaults/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 12 additions & 8 deletions tests/roles/development_environment/files/pre_launch_ironic.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected] systemctl restart chronyd.service
ssh -i $EDPM_PRIVATEKEY_PATH [email protected] chronyc -a makestep
if [[ "${PRE_LAUNCH_IRONIC_RESTART_CHRONY,,}" != "false" ]]; then
ssh -i $EDPM_PRIVATEKEY_PATH [email protected] systemctl restart chronyd.service
ssh -i $EDPM_PRIVATEKEY_PATH [email protected] 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 [email protected]:/root/ironic_nodes.yaml
ssh -i $EDPM_PRIVATEKEY_PATH [email protected] 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 [email protected]:/root/ironic_nodes.yaml
ssh -i $EDPM_PRIVATEKEY_PATH [email protected] 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)
Expand Down
2 changes: 2 additions & 0 deletions tests/roles/development_environment/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit be47939

Please sign in to comment.