43
43
BASE_DIR=" " # current directory
44
44
fi
45
45
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} '
46
+ # The update_event.sh is created ci-framework update role.
47
+ update_event () {
48
+ local event=" ${@:- Unknown Event} "
49
+ local event_script=" ${UPDATE_ARTIFACT_DIR} /update_event.sh"
50
+ if [ -e " ${event_script} " ]; then
51
+ " ${event_script} " " ${event} "
61
52
fi
62
53
}
63
54
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
-
85
55
OPENSTACK_OPERATOR_CSV=$( oc get csv -n $OPERATOR_NAMESPACE -o name | grep openstack-operator)
86
56
OPENSTACK_VERSION_CR=$( oc get openstackversion -n $NAMESPACE -o name)
87
57
@@ -91,6 +61,8 @@ if [ "${FAKE_UPDATE}" != "false" ]; then
91
61
OPENSTACK_DEPLOYED_VERSION=$( oc get -n $NAMESPACE $OPENSTACK_VERSION_CR --template={{.spec.targetVersion}})
92
62
sed -i $OUTFILE -e " s|value: $OPENSTACK_DEPLOYED_VERSION |value: $OPENSTACK_VERSION |"
93
63
64
+ update_event Applying Fake Update CR
65
+
94
66
oc apply -f $OUTFILE
95
67
fi
96
68
@@ -107,12 +79,14 @@ cat <<EOF >openstackversionpatch.yaml
107
79
}
108
80
EOF
109
81
82
+ update_event Patching the Openstack Version
83
+
110
84
oc patch $OPENSTACK_VERSION_CR --type=merge --patch-file openstackversionpatch.yaml
111
85
112
86
# wait for ovn update on control plane
113
87
oc wait $OPENSTACK_VERSION_CR --for=condition=MinorUpdateOVNControlplane --timeout=$TIMEOUT
114
88
115
- get_current_state " 02_after_ovn_controlplane_update "
89
+ update_event MinorUpdateOVNControlplane Completed
116
90
117
91
# start ovn update on data plane
118
92
nodes_with_ovn=()
@@ -145,20 +119,22 @@ $OVN_NODE_SETS
145
119
- ovn
146
120
EOF
147
121
122
+ update_event Applying the OVN CRD
123
+
148
124
oc create -f edpm-deployment-ovn-update.yaml
149
125
150
126
oc get openstackdataplanedeployment ${DATAPLANE_DEPLOYMENT} -ovn-update -o yaml
151
127
# wait for ovn dataplane completes
152
128
oc wait $OPENSTACK_VERSION_CR --for=condition=MinorUpdateOVNDataplane --timeout=$TIMEOUT
153
129
echo " MinorUpdateOVNDataplane completed"
154
130
155
- get_current_state " 03_after_ovn_dataplane_update "
131
+ update_event MinorUpdateOVNDataplane Completed
156
132
157
133
# wait for control plane update to complete
158
134
oc wait $OPENSTACK_VERSION_CR --for=condition=MinorUpdateControlplane --timeout=$TIMEOUT
159
- echo " MinorUpdateControlplane completed"
160
135
161
- get_current_state " 04_after_controlplane_update"
136
+ update_event MinorUpdateControlplane Completed
137
+ echo " MinorUpdateControlplane completed"
162
138
163
139
# start data plane plane update for rest of edpm services
164
140
DATAPLANE_NODESETS=$( oc get openstackdataplanenodeset -o name | awk -F' /' ' {print " - " $2}' )
@@ -175,13 +151,14 @@ $DATAPLANE_NODESETS
175
151
- update
176
152
EOF
177
153
154
+ update_event Applying the UPDATE CRD
155
+
178
156
oc create -f edpm-deployment-update.yaml
179
157
180
158
# wait for completion of minor update
181
159
oc wait $OPENSTACK_VERSION_CR --for=condition=MinorUpdateDataplane --timeout=$TIMEOUT
182
160
echo " MinorUpdate completed"
183
-
184
- get_current_state " 05_after_update"
161
+ update_event MinorUpdateDataplane Completed
185
162
186
163
# check for the status of edpm update
187
164
oc get openstackdataplanedeployment ${DATAPLANE_DEPLOYMENT} -update -o yaml
0 commit comments