4343 BASE_DIR=" " # current directory
4444fi
4545
46- function get_current_compute_state {
47- local stage=" ${1:- } "
48- file_pre=" ${BASE_DIR}${stage: +${stage} -} "
49-
50- if [ -e " ${CI_INVENTORY} " ]; then
51- echo " Collecting compute state ${stage: +for $stage } in ${BASE_DIR:- ${PWD} } "
52-
53- # Collect all running containers an all compute nodes in ~/ci-framework-data/tests/update/ by default.
54- ansible -i " ${CI_INVENTORY} " -m shell -a \
55- " sudo podman ps -q --filter 'status=running' | xargs -I {} sudo podman inspect --format {% raw %} '{{.Name}} {{.Config.Image}} {{.State.StartedAt}}' {% endraw %} {}|sort" computes | \
56- awk -vfile_pre=" ${file_pre} " ' BEGIN {tp=strftime("%Y%m%d%H%M%S")} /^compute/ {if (s != "") {close(s)}; s = "containers-" $1 "_" tp ".txt"; next;}; s {print > file_pre s} '
57- # Collect packages list an all compute nodes in ~/ci-framework-data/tests/update/ by default.
58- ansible -i " ${CI_INVENTORY} " -m shell -a \
59- " sudo dnf list installed | sort" computes | \
60- awk -vfile_pre=" ${file_pre} " ' BEGIN {tp=strftime("%Y%m%d%H%M%S")} /^compute/ {if (s != "") {close(s)}; s = "packages-" $1 "_" tp ".txt"; next;}; s {print > file_pre s} '
61- fi
62- }
63-
64- function get_current_pod_state {
65- local stage=" ${1:- } "
66- file_pre=" ${BASE_DIR}${stage: +${stage} -} "
67-
68- echo " Collecting pod state ${stage: +for $stage } in ${BASE_DIR:- ${PWD} } "
69-
70- local openstack_state_file=" ${file_pre} pods_os_state_$( date +%Y%m%d_%H%M%S) .tsv"
71- local os_operator_state_file=" ${file_pre} pods_os_op_state_$( date +%Y%m%d_%H%M%S) .tsv"
72- oc get pods -n " ${OPERATOR_NAMESPACE} " -o json | jq -r ' .items[] | select(.status.phase == "Running") | . as $pod | .status.containerStatuses[] | [$pod.metadata.name, $pod.status.startTime, .image, .state.running.startedAt ] | @tsv' > $os_operator_state_file
73-
74- oc get pods -n " ${NAMESPACE} " -o json | jq -r ' .items[] | select(.status.phase == "Running") | . as $pod | .status.containerStatuses[] | [$pod.metadata.name, $pod.status.startTime, .image, .state.running.startedAt ] | @tsv' > $openstack_state_file
75- }
76-
77- function get_current_state {
78- local stage=" ${1:- } "
79- get_current_compute_state " ${stage} "
80- get_current_pod_state " ${stage} "
81- }
82-
83- get_current_state " 01_before_update"
84-
8546OPENSTACK_OPERATOR_CSV=$( oc get csv -n $OPERATOR_NAMESPACE -o name | grep openstack-operator)
8647OPENSTACK_VERSION_CR=$( oc get openstackversion -n $NAMESPACE -o name)
8748
@@ -91,6 +52,8 @@ if [ "${FAKE_UPDATE}" != "false" ]; then
9152 OPENSTACK_DEPLOYED_VERSION=$( oc get -n $NAMESPACE $OPENSTACK_VERSION_CR --template={{.spec.targetVersion}})
9253 sed -i $OUTFILE -e " s|value: $OPENSTACK_DEPLOYED_VERSION |value: $OPENSTACK_VERSION |"
9354
55+ ${UPDATE_ARTIFACT_DIR} /update_step.sh Applying Fake Update CR
56+
9457 oc apply -f $OUTFILE
9558fi
9659
@@ -107,12 +70,14 @@ cat <<EOF >openstackversionpatch.yaml
10770 }
10871EOF
10972
73+ ${UPDATE_ARTIFACT_DIR} /update_step.sh Patching the Openstack Version
74+
11075oc patch $OPENSTACK_VERSION_CR --type=merge --patch-file openstackversionpatch.yaml
11176
11277# wait for ovn update on control plane
11378oc wait $OPENSTACK_VERSION_CR --for=condition=MinorUpdateOVNControlplane --timeout=$TIMEOUT
11479
115- get_current_state " 02_after_ovn_controlplane_update "
80+ ${UPDATE_ARTIFACT_DIR} /update_step.sh MinorUpdateOVNControlplane Completed
11681
11782# start ovn update on data plane
11883DATAPLANE_NODESET=$( oc get openstackdataplanenodeset -o name | awk -F' /' ' {print " - " $2}' )
@@ -130,20 +95,22 @@ $DATAPLANE_NODESET
13095 - ovn
13196EOF
13297
98+ ${UPDATE_ARTIFACT_DIR} /update_step.sh Applying the OVN CRD
99+
133100oc create -f edpm-deployment-ovn-update.yaml
134101
135102oc get openstackdataplanedeployment
136103# wait for ovn dataplane completes
137104oc wait $OPENSTACK_VERSION_CR --for=condition=MinorUpdateOVNDataplane --timeout=$TIMEOUT
138105echo " MinorUpdateOVNDataplane completed"
139106
140- get_current_state " 03_after_ovn_dataplane_update "
107+ ${UPDATE_ARTIFACT_DIR} /update_step.sh MinorUpdateOVNDataplane Completed
141108
142109# wait for control plane update to complete
143110oc wait $OPENSTACK_VERSION_CR --for=condition=MinorUpdateControlplane --timeout=$TIMEOUT
144- echo " MinorUpdateControlplane completed"
145111
146- get_current_state " 04_after_controlplane_update"
112+ ${UPDATE_ARTIFACT_DIR} /update_step.sh MinorUpdateControlplane Completed
113+ echo " MinorUpdateControlplane completed"
147114
148115# start data plane plane update for rest of edpm services
149116cat << EOF >edpm-deployment-update.yaml
@@ -158,13 +125,14 @@ $DATAPLANE_NODESET
158125 - update
159126EOF
160127
128+ ${UPDATE_ARTIFACT_DIR} /update_step.sh Applying the UPDATE CRD
129+
161130oc create -f edpm-deployment-update.yaml
162131
163132# wait for completion of minor update
164133oc wait $OPENSTACK_VERSION_CR --for=condition=MinorUpdateDataplane --timeout=$TIMEOUT
165134echo " MinorUpdate completed"
166-
167- get_current_state " 05_after_update"
135+ ${UPDATE_ARTIFACT_DIR} /update_step.sh MinorUpdateDataplane Completed
168136
169137# check for the status of edpm update
170138oc get openstackdataplanedeployment ${DATAPLANE_DEPLOYMENT} -update -o yaml
0 commit comments