Skip to content

Commit b53251e

Browse files
authored
Merge pull request #16 from Akrog/cinder
Gather cinder information, including Guru Meditation Report.
2 parents 90e866a + 1df7586 commit b53251e

File tree

4 files changed

+93
-0
lines changed

4 files changed

+93
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,26 @@ sh-5.1# gather
9494
sh-5.1# rm /tmp/rm-to-finish-gathering
9595
```
9696
97+
### Component specifics
98+
99+
Besides the generic OpenShift etcd objects that must-gather scripts are
100+
currently gathering there's also component specific code that gather other
101+
information, so when adding or improving a component we should look into:
102+
103+
- `collection-scripts/common.sh`: Services are in the `OSP_SERVICES` variable
104+
to indicate that the script must gather its config maps, secrets, additional
105+
information, trigger Guru Mediation Reports, etc.
106+
107+
- `collection-scripts/gather_services_status`: Runs OpenStack commands to
108+
gather additional information. For example for Cinder it gather state of the
109+
services, volume types, qos specs, volume transfer requests, summary of
110+
existing volumes, pool information, etc.
111+
112+
- `collection-scripts/gather_trigger_gmr`: Triggers Guru Meditation Reports on
113+
the services so they are present in the logs when those are gathered
114+
afterwards.
115+
116+
97117
## Example
98118
99119
(optional) Build and push the must-gather image to a registry:

collection-scripts/gather_run

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ source "${DIR_NAME}/common.sh"
2323
# if exist so we can gather resources about tests
2424
expand_ns "kuttl"
2525

26+
# Trigger Guru Meditation Reports so we then have then in the service logs
27+
/usr/bin/gather_trigger_gmr
28+
2629
for NS in "${DEFAULT_NAMESPACES[@]}"; do
2730
# get Services Config (CM)
2831
/usr/bin/gather_services_cm "$NS"

collection-scripts/gather_services_status

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ get_status() {
2222
"neutron")
2323
get_neutron_status
2424
;;
25+
"cinder")
26+
get_cinder_status
27+
;;
2528
*) ;;
2629
esac
2730
}
@@ -58,6 +61,19 @@ get_neutron_status() {
5861
${BASH_ALIASES[os]} security group list > "$NEUTRON_PATH"/security_group_list
5962
}
6063

64+
# Cinder service gathering - services, vol types, qos, transfers, pools,
65+
get_cinder_status() {
66+
local CINDER_PATH="$BASE_COLLECTION_PATH/ctlplane/cinder"
67+
mkdir -p "$CINDER_PATH"
68+
${BASH_ALIASES[os]} volume service list > "$CINDER_PATH"/service_list
69+
${BASH_ALIASES[os]} volume type list --long > "$CINDER_PATH"/type_list
70+
${BASH_ALIASES[os]} volume qos list > "$CINDER_PATH"/qos_list
71+
${BASH_ALIASES[os]} volume transfer request list --all-project > "$CINDER_PATH"/transfer_list
72+
${BASH_ALIASES[os]} --os-volume-api-version 3.12 volume summary --all-projects > "$CINDER_PATH"/total_volumes_list
73+
# Add --fit once we have https://review.opendev.org/c/openstack/python-openstackclient/+/895971
74+
${BASH_ALIASES[os]} volume backend pool list --long > "$CINDER_PATH"/pool_list
75+
}
76+
6177
# first we gather generic status of the openstack ctlplane
6278
# then we process the existing services (if an associated
6379
# function has been defined)

collection-scripts/gather_trigger_gmr

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
#
3+
# Trigger Guru Meditation Reports in the different services to have them in the
4+
# logs: https://github.com/openstack/oslo.reports
5+
#
6+
# Some services use signals and others use touching a file to trigger the
7+
# reporting.
8+
9+
DIR_NAME=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
10+
# shellcheck disable=SC1091
11+
source "${DIR_NAME}/common.sh"
12+
13+
oc="/usr/bin/oc -n openstack "
14+
oce="$oc exec "
15+
16+
17+
trigger_gmr() {
18+
service="$1"
19+
case "${service}" in
20+
"cinder")
21+
cinder_trigger_gmr
22+
;;
23+
*) ;;
24+
esac
25+
26+
}
27+
28+
29+
cinder_trigger_gmr() {
30+
# https://docs.openstack.org/cinder/latest/contributor/gmr.html
31+
echo "Trigger GMR for Cinder services"
32+
33+
# Get pod name and type of service for cinder pods
34+
svcs=`$oc get pod -l service=cinder -o=custom-columns=N:.metadata.name,T:metadata.labels.component --no-headers`
35+
36+
# Cinder uses files to trigger GMR because volume and backup share the PID
37+
# with the host so we don't know what PID the service has
38+
while read -r line; do
39+
podname="${line% *}"
40+
svctype="${line#* }"
41+
$oce $podname -c $svctype -- touch /etc/cinder
42+
done <<< "$svcs"
43+
}
44+
45+
46+
# get the list of existing ctlplane services (once) and
47+
# filter the whole list processing only services with an
48+
# associated function
49+
services=`$oce openstackclient -- openstack service list -c Name -f value`
50+
for svc in "${OSP_SERVICES[@]}"; do
51+
[[ "${services[*]}" =~ ${svc} ]] && trigger_gmr "$svc"
52+
done
53+
54+
exit 0

0 commit comments

Comments
 (0)