From dc796b158bb107aae99554dc0ccc7ccffa4ff122 Mon Sep 17 00:00:00 2001 From: Mudit Agarwal Date: Fri, 30 Oct 2020 12:57:50 +0530 Subject: [PATCH] must-gather: some improvements in snapshot info collection 1. change log file names to rbd_vol_and_snap_info & cephfs_subvol_and_snap_info 2. add subvolumegroup name (csi) 3. add snapshot count for cephFS subvolumes Signed-off-by: Mudit Agarwal --- .../collection-scripts/gather_ceph_resources | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/must-gather/collection-scripts/gather_ceph_resources b/must-gather/collection-scripts/gather_ceph_resources index 7d743cc783..57be3fd190 100755 --- a/must-gather/collection-scripts/gather_ceph_resources +++ b/must-gather/collection-scripts/gather_ceph_resources @@ -143,8 +143,7 @@ for ns in $namespaces; do # Collecting snapshot info for ceph rbd volumes printf "collecting snapshot info for ceph rbd volumes \n" | tee -a "${BASE_COLLECTION_PATH}"/gather-debug.log - COMMAND_OUTPUT_FILE=${COMMAND_OUTPUT_DIR}/rbd_snap_info.log - JSON_COMMAND_OUTPUT_FILE=${COMMAND_JSON_OUTPUT_DIR}/rbd_snap_info_format_json-pretty.log + COMMAND_OUTPUT_FILE=${COMMAND_OUTPUT_DIR}/rbd_vol_and_snap_info # Inspecting ceph block pools for ceph rbd blockpools=$(oc get cephblockpools.ceph.rook.io -n openshift-storage -o jsonpath="{range .items[*]}{@.metadata.name}{'\n'}{end}") for bp in $blockpools; do @@ -156,20 +155,22 @@ for ns in $namespaces; do done # Collecting snapshot information for ceph subvolumes - printf "collecting snapshot info for ceph subvolumes \n" | tee -a "${BASE_COLLECTION_PATH}"/gather-debug.log - COMMAND_OUTPUT_FILE=${COMMAND_OUTPUT_DIR}/cephfs_snap_info.log + printf "collecting snapshot info for cephFS subvolumes \n" | tee -a "${BASE_COLLECTION_PATH}"/gather-debug.log + COMMAND_OUTPUT_FILE=${COMMAND_OUTPUT_DIR}/cephfs_subvol_and_snap_info # Inspecting CephFS filesystems filesystems=$(oc get cephfilesystems.ceph.rook.io -n openshift-storage -o jsonpath="{range .items[*]}{@.metadata.name}{'\n'}{end}") for fs in $filesystems; do - subvols=$(oc -n openshift-storage exec "${HOSTNAME}"-helper -- bash -c "ceph fs subvolume ls $fs | jq --raw-output '.[].name' ") + subvols=$(oc -n openshift-storage exec "${HOSTNAME}"-helper -- bash -c "ceph fs subvolume ls $fs csi | jq --raw-output '.[].name' ") for subvol in $subvols; do { printf "Information for subvolume: %s\n" "${subvol}" >> "${COMMAND_OUTPUT_FILE}"; } - { timeout 120 oc -n "${ns}" exec "${HOSTNAME}"-helper -- bash -c "ceph fs subvolume info $fs $subvol --connect-timeout=15" >> "${COMMAND_OUTPUT_FILE}"; } >> "${BASE_COLLECTION_PATH}"/gather-debug.log 2>&1 - snaps=$(oc -n openshift-storage exec "${HOSTNAME}"-helper -- bash -c "ceph fs subvolume snapshot ls $fs $subvol | jq --raw-output '.[].name'") + { timeout 120 oc -n "${ns}" exec "${HOSTNAME}"-helper -- bash -c "ceph fs subvolume info $fs $subvol csi --connect-timeout=15" >> "${COMMAND_OUTPUT_FILE}"; } >> "${BASE_COLLECTION_PATH}"/gather-debug.log 2>&1 + snaps=$(oc -n openshift-storage exec "${HOSTNAME}"-helper -- bash -c "ceph fs subvolume snapshot ls $fs $subvol csi | jq --raw-output '.[].name'") + count=$(oc -n openshift-storage exec "${HOSTNAME}"-helper -- bash -c "ceph fs subvolume snapshot ls $fs $subvol csi | jq --raw-output '.[].name' | wc -l") + { printf "Snapshot count in subvolume: %s=%s\n" "${subvol}" "${count}" >> "${COMMAND_OUTPUT_FILE}"; } for snap in $snaps; do { printf "Information for snapshot: %s\n" "${snap}" >> "${COMMAND_OUTPUT_FILE}"; } - { timeout 120 oc -n "${ns}" exec "${HOSTNAME}"-helper -- bash -c "ceph fs subvolume snapshot info $fs $subvol $snap --connect-timeout=15" >> "${COMMAND_OUTPUT_FILE}"; } >> "${BASE_COLLECTION_PATH}"/gather-debug.log 2>&1 + { timeout 120 oc -n "${ns}" exec "${HOSTNAME}"-helper -- bash -c "ceph fs subvolume snapshot info $fs $subvol $snap csi --connect-timeout=15" >> "${COMMAND_OUTPUT_FILE}"; } >> "${BASE_COLLECTION_PATH}"/gather-debug.log 2>&1 done done done