Skip to content

Commit

Permalink
Add hook to wait for compute service
Browse files Browse the repository at this point in the history
This is a workaround.

The openstackdataplane deployment can be marked as complete even if nova
is not fully running yet.

Add a hook to run command ...
  openstack compute service list --service nova-compute -f value | wc -l
... and wait for the line count to match the expected number of compute
services.

This hook will allow us to insert a wait-and-check for compute services
being up before running `discover_hosts`.
  • Loading branch information
hjensas authored and openshift-merge-bot[bot] committed Oct 25, 2024
1 parent 7f04e08 commit 804ba12
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions hooks/playbooks/nova_wait_for_compute_service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
# This hook is a workaround
#
# The openstackdataplane deployment can be marked as complete even if nova is
# not fully running yet. Ideally edpm-ansible or the openstack dataplane
# deployment should be able to detect this, and only set Ready status when the
# compute service is fully up and registered.
#
# Until the operator/edpm-ansible can manage this, this hook can be used as a
# workaround.
#
- name: Run compute service list until exptected compute count present
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
gather_facts: false
vars:
_number_of_computes: 0
_retries: 25
_cell_conductor: null
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
tasks:
- name: Wait for expected compute services
cifmw.general.ci_script:
output_dir: "{{ cifmw_basedir }}/artifacts"
executable: "/bin/bash"
script: |
set -xe -o pipefail
COMPUTES={{ _number_of_computes }}
RETRIES={{ _retries }}
COUNTER=0
oc project {{ namespace }}
until [ $(oc rsh openstackclient openstack compute service list --service nova-compute -f value | wc -l) -eq "$COMPUTES" ]; do
if [[ "$COUNTER" -ge "$RETRIES" ]]; then
exit 1
fi
COUNTER=$[$COUNTER +1]
sleep 10
done
- name: Run nova-manage discover_hosts and wait for host records
cifmw.general.ci_script:
output_dir: "{{ cifmw_basedir }}/artifacts"
executable: "/bin/bash"
script: |
set -xe -o pipefail
COMPUTES={{ _number_of_computes | int + 4 }}
RETRIES={{ _retries }}
COUNTER=0
oc project {{ namespace }}
until [ $(oc rsh {{ _cell_conductor }} nova-manage cell_v2 list_hosts | wc -l) -eq "$COMPUTES" ]; do
if [[ "$COUNTER" -ge "$RETRIES" ]]; then
exit 1
fi
oc rsh {{ _cell_conductor }} nova-manage cell_v2 discover_hosts --verbose
COUNTER=$[$COUNTER +1]
sleep 10
done

0 comments on commit 804ba12

Please sign in to comment.