From 0a2d57bb4da0ba8c38687caf67728ea13524ad6a Mon Sep 17 00:00:00 2001 From: yati1998 Date: Wed, 21 Feb 2024 09:07:07 +0530 Subject: [PATCH 01/15] collect csidriver details for odf-client this commit includes csidriver details in odfclient collection Signed-off-by: yati1998 --- collection-scripts/gather_odf_client | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/collection-scripts/gather_odf_client b/collection-scripts/gather_odf_client index 326daef..090dc07 100755 --- a/collection-scripts/gather_odf_client +++ b/collection-scripts/gather_odf_client @@ -10,6 +10,7 @@ CLIENT_OPERATOR_NAMESPACE=$(oc get subscriptions -A --no-headers | grep ocs-clie # collection path for OC commands mkdir -p "${BASE_COLLECTION_PATH}/odf-client/oc_output/" +mkdir -p "${BASE_COLLECTION_PATH}/csidriver" # Command List commands_get=() @@ -109,3 +110,8 @@ for INSTALL_NAMESPACE in $STORAGE_CLIENT_NAMESPACE ; do { oc describe ${command_desc} -n ${INSTALL_NAMESPACE}; } >>"${COMMAND_OUTPUT_FILE}" done done + +# collect csidriver details +{ oc get csidriver; } >"${BASE_COLLECTION_PATH}/csidriver/get_csidriver" 2>&1 +{ oc describe csidriver -o yaml; } >"${BASE_COLLECTION_PATH}/csidriver/desc_csidriver" 2>&1 +{ oc get csidriver -o yaml; } >"${BASE_COLLECTION_PATH}/csidriver/csidriver.yaml" 2>&1 From f86bbe4dd8bc7230094705dfbb518390dbe055df Mon Sep 17 00:00:00 2001 From: black-dragon74 Date: Wed, 21 Feb 2024 14:27:22 +0530 Subject: [PATCH 02/15] Add arg for collecting ODF logs Supposed to be used in conjunction with other args as it makes no sense to use it standalone. Passing `-o` or `--odf` will include the data from `deafult` op mode along with other data requested by the remaining args. Signed-off-by: black-dragon74 --- collection-scripts/gather | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/collection-scripts/gather b/collection-scripts/gather index 9d28255..8b0fe25 100755 --- a/collection-scripts/gather +++ b/collection-scripts/gather @@ -1,6 +1,7 @@ #!/usr/bin/env bash # Predefined operating modes +odf=false dr=false pc=false nooba=false @@ -16,6 +17,11 @@ pids=() while [[ $# -gt 0 ]]; do case "$1" in + -o | --odf) + odf=true + default=false + shift + ;; -d | --dr) dr=true default=false @@ -79,6 +85,7 @@ display_help() { Usage: $0 [OPTIONS] Options: + -o, --odf Collect ODF logs (default operation mode) -d, --dr Collect DR logs -p, --provider Collect logs for provider/consumer cluster -n, --nooba Collect nooba logs @@ -129,6 +136,12 @@ if [ "$help" = true ]; then fi # Process the options +if [ "$odf" == true ]; then + echo "Collect ODF logs..." + gather_main & + pids+=($!) +fi + if [ "$dr" == true ]; then echo "Collect DR logs..." gather_dr_resources ${BASE_COLLECTION_PATH} & @@ -183,7 +196,7 @@ fi # No args, normal op mode if [ "$default" = true ]; then - echo "Gather will start in default op mode" + echo "No args detected, must-gather will start in default op mode" gather_main fi From 65eeda29e22cdd9e384c776511ac015b542b5cad Mon Sep 17 00:00:00 2001 From: black-dragon74 Date: Wed, 21 Feb 2024 14:41:15 +0530 Subject: [PATCH 03/15] Rename arg `-p` to `-pc` Signed-off-by: black-dragon74 --- collection-scripts/gather | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collection-scripts/gather b/collection-scripts/gather index 9d28255..6534fd5 100755 --- a/collection-scripts/gather +++ b/collection-scripts/gather @@ -21,7 +21,7 @@ while [[ $# -gt 0 ]]; do default=false shift ;; - -p | --provider*) + -pc | --provider*) pc=true default=false shift @@ -80,7 +80,7 @@ Usage: $0 [OPTIONS] Options: -d, --dr Collect DR logs - -p, --provider Collect logs for provider/consumer cluster + -pc, --provider Collect logs for provider/consumer cluster -n, --nooba Collect nooba logs -c, --ceph Collect ceph commands and pod logs -cl, --ceph-logs Collect ceph daemon, kernel, journal logs and crash reports From 768e87407267d15ee3a8203a750cc9d9d95408c6 Mon Sep 17 00:00:00 2001 From: black-dragon74 Date: Wed, 21 Feb 2024 16:28:56 +0530 Subject: [PATCH 04/15] Update help text for the new arg Signed-off-by: black-dragon74 --- collection-scripts/gather | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collection-scripts/gather b/collection-scripts/gather index 6534fd5..6da39b0 100755 --- a/collection-scripts/gather +++ b/collection-scripts/gather @@ -80,7 +80,7 @@ Usage: $0 [OPTIONS] Options: -d, --dr Collect DR logs - -pc, --provider Collect logs for provider/consumer cluster + -pc, --provider Collect openshift-storage-client logs from a provider/consumer cluster -n, --nooba Collect nooba logs -c, --ceph Collect ceph commands and pod logs -cl, --ceph-logs Collect ceph daemon, kernel, journal logs and crash reports From 448c91d49e9e9e820f6e9ba8c6741c9a6db317cd Mon Sep 17 00:00:00 2001 From: black-dragon74 Date: Wed, 21 Feb 2024 16:37:13 +0530 Subject: [PATCH 05/15] Update help text for ODF arg Signed-off-by: black-dragon74 --- collection-scripts/gather | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collection-scripts/gather b/collection-scripts/gather index 8b0fe25..cd870e3 100755 --- a/collection-scripts/gather +++ b/collection-scripts/gather @@ -85,7 +85,7 @@ display_help() { Usage: $0 [OPTIONS] Options: - -o, --odf Collect ODF logs (default operation mode) + -o, --odf Collect ODF logs -d, --dr Collect DR logs -p, --provider Collect logs for provider/consumer cluster -n, --nooba Collect nooba logs From 3517902d24ff10a33333c22eb5468300054bb471 Mon Sep 17 00:00:00 2001 From: oviner Date: Wed, 21 Feb 2024 16:26:05 +0200 Subject: [PATCH 06/15] Fix Readme file Signed-off-by: oviner --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5138e47..0886fd3 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,13 @@ from your cluster. This might take longer on some environments. Note: Provide each arg separately and do not chain them like: ``` -$ /usr/bin/gather -dpnc # Wrong -$ /usr/bin/gather -d -p -n -c # Correct +$ oc adm must-gather --image= -- /usr/bin/gather -dpnc # Wrong +$ oc adm must-gather --image= -- /usr/bin/gather -d -p -n -c # Correct ``` Examples: ``` -$ /usr/bin/gather -d -n --ceph # Collect DR, nooba and ceph logs only. -$ /usr/bin/gather -h # Print help +$ oc adm must-gather --image= -d -n --ceph # Collect DR, nooba and ceph logs only. +$ oc adm must-gather --image= -h # Print help ``` The command above will create a local directory with a dump of the ODF state. From 5b473b9b3c68d18af741902f7e9e874a0ee740b3 Mon Sep 17 00:00:00 2001 From: oviner Date: Wed, 21 Feb 2024 16:38:01 +0200 Subject: [PATCH 07/15] fix code Signed-off-by: oviner --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0886fd3..3351990 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,8 @@ $ oc adm must-gather --image= -- /usr/bin/gather -d -p -n -c # Correc ``` Examples: ``` -$ oc adm must-gather --image= -d -n --ceph # Collect DR, nooba and ceph logs only. -$ oc adm must-gather --image= -h # Print help +$ oc adm must-gather --image= -- /usr/bin/gather -d -n --ceph # Collect DR, nooba and ceph logs only. +$ oc adm must-gather --image= -h # Print help ``` The command above will create a local directory with a dump of the ODF state. From 3be2619459fe2df29a824c053853e422f81b3132 Mon Sep 17 00:00:00 2001 From: oviner Date: Wed, 21 Feb 2024 16:39:26 +0200 Subject: [PATCH 08/15] fix annotations Signed-off-by: oviner --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3351990..f66b38f 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ $ oc adm must-gather --image= -- /usr/bin/gather -d -p -n -c # Correc Examples: ``` $ oc adm must-gather --image= -- /usr/bin/gather -d -n --ceph # Collect DR, nooba and ceph logs only. -$ oc adm must-gather --image= -h # Print help +$ oc adm must-gather --image= -h # Print help ``` The command above will create a local directory with a dump of the ODF state. From 82178cc1bd2225a7e542c173c2028579fd74eedd Mon Sep 17 00:00:00 2001 From: oviner Date: Wed, 21 Feb 2024 17:19:46 +0200 Subject: [PATCH 09/15] No need to call pre-install script for help flag Signed-off-by: oviner --- collection-scripts/gather | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/collection-scripts/gather b/collection-scripts/gather index bf2b648..4c045da 100755 --- a/collection-scripts/gather +++ b/collection-scripts/gather @@ -112,6 +112,11 @@ Examples: EOF } +# If help is requested, we print it out and do nothing else (exit 0) +if [ "$help" = true ]; then + display_help && exit 0 +fi + export BASE_COLLECTION_PATH="must-gather" mkdir -p ${BASE_COLLECTION_PATH} @@ -130,11 +135,6 @@ dbglog "collection started at: ${START_TIME}" # Call pre-install.sh, see commit msg pre-install.sh ${BASE_COLLECTION_PATH} -# If help is requested, we print it out and do nothing else (exit 0) -if [ "$help" = true ]; then - display_help && exit 0 -fi - # Process the options if [ "$odf" == true ]; then echo "Collect ODF logs..." From a6e0c0b6eff8e6c47f49ebf48197c32b1501ad76 Mon Sep 17 00:00:00 2001 From: oviner Date: Wed, 21 Feb 2024 17:45:01 +0200 Subject: [PATCH 10/15] fix code Signed-off-by: oviner --- README.md | 2 +- collection-scripts/gather | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f66b38f..95e79b3 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ $ oc adm must-gather --image= -- /usr/bin/gather -d -p -n -c # Correc Examples: ``` $ oc adm must-gather --image= -- /usr/bin/gather -d -n --ceph # Collect DR, nooba and ceph logs only. -$ oc adm must-gather --image= -h # Print help +$ oc adm must-gather --image= -- /usr/bin/gather -h # Print help ``` The command above will create a local directory with a dump of the ODF state. diff --git a/collection-scripts/gather b/collection-scripts/gather index bf2b648..2a52e3f 100755 --- a/collection-scripts/gather +++ b/collection-scripts/gather @@ -103,12 +103,12 @@ Description: from your cluster. This might take longer on some environments. Note: Provide each arg separately and do not chain them like: - $ $0 -dpnc # Wrong - $ $0 -d -p -n -c # Correct + $ oc adm must-gather --image= -- /usr/bin/gather -dpnc # Wrong + $ oc adm must-gather --image= -- /usr/bin/gather -d -p -n -c # Correct Examples: - $ $0 -d -n --ceph # Collect DR, nooba and ceph logs only. - $ $0 -h # Print help + $ oc adm must-gather --image= -- /usr/bin/gather -d -n --ceph # Collect DR, nooba and ceph logs only. + $ oc adm must-gather --image= -h # Print help EOF } From 6572870e4605869ce7c4c8709d337ccc7cbcd316 Mon Sep 17 00:00:00 2001 From: oviner Date: Wed, 21 Feb 2024 17:45:55 +0200 Subject: [PATCH 11/15] fix code Signed-off-by: oviner --- collection-scripts/gather | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/collection-scripts/gather b/collection-scripts/gather index 2a52e3f..e8115f1 100755 --- a/collection-scripts/gather +++ b/collection-scripts/gather @@ -108,7 +108,7 @@ Description: Examples: $ oc adm must-gather --image= -- /usr/bin/gather -d -n --ceph # Collect DR, nooba and ceph logs only. - $ oc adm must-gather --image= -h # Print help + $ oc adm must-gather --image= -- /usr/bin/gather -h # Print help EOF } From 254b89b45d68f5e0f0f1500607ea0fa66617d011 Mon Sep 17 00:00:00 2001 From: oviner Date: Wed, 21 Feb 2024 17:49:08 +0200 Subject: [PATCH 12/15] change image name Signed-off-by: oviner --- README.md | 8 ++++---- collection-scripts/gather | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 95e79b3..45f5c5a 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,13 @@ from your cluster. This might take longer on some environments. Note: Provide each arg separately and do not chain them like: ``` -$ oc adm must-gather --image= -- /usr/bin/gather -dpnc # Wrong -$ oc adm must-gather --image= -- /usr/bin/gather -d -p -n -c # Correct +$ oc adm must-gather --image= -- /usr/bin/gather -dpnc # Wrong +$ oc adm must-gather --image= -- /usr/bin/gather -d -p -n -c # Correct ``` Examples: ``` -$ oc adm must-gather --image= -- /usr/bin/gather -d -n --ceph # Collect DR, nooba and ceph logs only. -$ oc adm must-gather --image= -- /usr/bin/gather -h # Print help +$ oc adm must-gather --image= -- /usr/bin/gather -d -n --ceph # Collect DR, nooba and ceph logs only. +$ oc adm must-gather --image= -- /usr/bin/gather -h # Print help ``` The command above will create a local directory with a dump of the ODF state. diff --git a/collection-scripts/gather b/collection-scripts/gather index e8115f1..47930f7 100755 --- a/collection-scripts/gather +++ b/collection-scripts/gather @@ -103,12 +103,12 @@ Description: from your cluster. This might take longer on some environments. Note: Provide each arg separately and do not chain them like: - $ oc adm must-gather --image= -- /usr/bin/gather -dpnc # Wrong - $ oc adm must-gather --image= -- /usr/bin/gather -d -p -n -c # Correct + $ oc adm must-gather --image= -- $0 -dpnc # Wrong + $ oc adm must-gather --image= -- $0 -d -p -n -c # Correct Examples: - $ oc adm must-gather --image= -- /usr/bin/gather -d -n --ceph # Collect DR, nooba and ceph logs only. - $ oc adm must-gather --image= -- /usr/bin/gather -h # Print help + $ oc adm must-gather --image= -- $0 -d -n --ceph # Collect DR, nooba and ceph logs only. + $ oc adm must-gather --image= -- $0 -h # Print help EOF } From 7c5f94d04e0b9233389f327ef1da164c8d11e462 Mon Sep 17 00:00:00 2001 From: black-dragon74 Date: Thu, 29 Feb 2024 10:53:10 +0530 Subject: [PATCH 13/15] Fix helptext formatting Signed-off-by: black-dragon74 --- collection-scripts/gather | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/collection-scripts/gather b/collection-scripts/gather index a538185..903eb25 100755 --- a/collection-scripts/gather +++ b/collection-scripts/gather @@ -102,9 +102,9 @@ Description: will run in FULL collection mode and will gather all the resources from your cluster. This might take longer on some environments. - Note: Provide each arg separately and do not chain them like: - $ oc adm must-gather --image= -- $0 -dpnc # Wrong - $ oc adm must-gather --image= -- $0 -d -p -n -c # Correct +Note: Provide each arg separately and do not chain them like: + $ oc adm must-gather --image= -- $0 -dpnc # Wrong + $ oc adm must-gather --image= -- $0 -d -p -n -c # Correct Examples: $ oc adm must-gather --image= -- $0 -d -n --ceph # Collect DR, nooba and ceph logs only. From 831cfa97776f39b170352e85c6f5399cf85c696a Mon Sep 17 00:00:00 2001 From: yati1998 Date: Thu, 29 Feb 2024 15:45:22 +0530 Subject: [PATCH 14/15] update readme to include correct flag recently the flag name for provider/consumer cluster was changed. Updating the same in the Readme file too. Signed-off-by: yati1998 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 45f5c5a..1b7dd2e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ oc adm must-gather --image=registry.redhat.io/odf4/odf-must-gather-rhel9:v4.13 - List of arguments that can be passed to the odf-must-gather are: ``` -d, --dr Collect DR logs --p, --provider Collect logs for provider/consumer cluster +-pc, --provider Collect openshift-storage-client logs from a provider/consumer cluster -n, --nooba Collect nooba logs -c, --ceph Collect ceph commands and pod logs -cl, --ceph-logs Collect ceph daemon, kernel, journal logs and crash reports From 4493297ac81053918d9583da55561a98b2b7c5f6 Mon Sep 17 00:00:00 2001 From: yati1998 Date: Fri, 1 Mar 2024 11:35:37 +0530 Subject: [PATCH 15/15] collect resources for openshift-storage-extended ns This commit collects crds and few resources for openshift-storage-extended namespace Signed-off-by: yati1998 --- collection-scripts/gather_ceph_resources | 2 ++ collection-scripts/gather_namespaced_resources | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/collection-scripts/gather_ceph_resources b/collection-scripts/gather_ceph_resources index e89fabb..d3bd3fd 100755 --- a/collection-scripts/gather_ceph_resources +++ b/collection-scripts/gather_ceph_resources @@ -88,8 +88,10 @@ for resource in "${ceph_resources[@]}"; do done namespaces=$(oc get deploy --all-namespaces -o go-template --template='{{range .items}}{{if .metadata.labels}}{{printf "%s %v" .metadata.namespace (index .metadata.labels "olm.owner")}} {{printf "\n"}}{{end}}{{end}}' | grep ocs-operator | awk '{print $1}' | uniq) +namespaces="openshift-storage-extended" # Inspecting the namespace where ocs-cluster is installed for ns in $namespaces; do + dblog "collecting details of ns ${ns}" ceph_collection() { COMMAND_OUTPUT_DIR=${CEPH_COLLECTION_PATH}/must_gather_commands COMMAND_JSON_OUTPUT_DIR=${CEPH_COLLECTION_PATH}/must_gather_commands_json_output diff --git a/collection-scripts/gather_namespaced_resources b/collection-scripts/gather_namespaced_resources index 9ea0052..6c2b5fb 100755 --- a/collection-scripts/gather_namespaced_resources +++ b/collection-scripts/gather_namespaced_resources @@ -54,6 +54,7 @@ commands_desc+=("pods") commands_desc+=("hpa") commands_desc+=("subscription") commands_desc+=("storagecluster") +commands_desc+=("storagesystem") commands_desc+=("storageconsumer") commands_desc+=("storageprofiles") commands_desc+=("storageclassrequest") @@ -100,13 +101,12 @@ for INSTALL_NAMESPACE in $PRODUCT_NAMESPACE $INSTALL_NAMESPACES $MANAGED_FUSION_ # shellcheck disable=SC2086 { oc describe ${command_desc} -n ${INSTALL_NAMESPACE}; } >>"${COMMAND_OUTPUT_FILE}" done + # NOTE: This is a temporary fix for collecting the storagecluster as we are not able to collect the storagecluster using the inspect command + { oc get storageclusters -n "${INSTALL_NAMESPACE}" -o yaml; } >"${BASE_COLLECTION_PATH}/namespaces/${INSTALL_NAMESPACE}/oc_output/storagecluster.yaml" 2>&1 + { oc get storagesystem -n "${INSTALL_NAMESPACE}" -o yaml; } >"${BASE_COLLECTION_PATH}/namespaces/${INSTALL_NAMESPACE}/oc_output/storagesystem.yaml" 2>&1 + { oc get storageconsumer -n "${INSTALL_NAMESPACE}" -o yaml; } >"${BASE_COLLECTION_PATH}/namespaces/${INSTALL_NAMESPACE}/oc_output/storageconsumer.yaml" 2>&1 done -# NOTE: This is a temporary fix for collecting the storagecluster as we are not able to collect the storagecluster using the inspect command -{ oc get storageclusters -n "${INSTALL_NAMESPACE}" -o yaml; } >"${BASE_COLLECTION_PATH}/namespaces/${INSTALL_NAMESPACE}/oc_output/storagecluster.yaml" 2>&1 -{ oc get storagesystem -n "${INSTALL_NAMESPACE}" -o yaml; } >"${BASE_COLLECTION_PATH}/namespaces/${INSTALL_NAMESPACE}/oc_output/storagesystem.yaml" 2>&1 -{ oc get storageconsumer -n "${INSTALL_NAMESPACE}" -o yaml; } >"${BASE_COLLECTION_PATH}/namespaces/${INSTALL_NAMESPACE}/oc_output/storageconsumer.yaml" 2>&1 - # Collect oc get events with sorted timestamp dbglog "collecting output of oc get events with sorted timestamp" { oc get event -o custom-columns="LAST SEEN:{lastTimestamp},FIRST SEEN:{firstTimestamp},COUNT:{count},NAME:{metadata.name},KIND:{involvedObject.kind},SUBOBJECT:{involvedObject.fieldPath},TYPE:{type},REASON:{reason},SOURCE:{source.component},MESSAGE:{message}" --sort-by=lastTimestamp -n openshift-storage; } >"${BASE_COLLECTION_PATH}/namespaces/${INSTALL_NAMESPACE}/oc_output/events_get" 2>&1