Skip to content

Commit

Permalink
must-gather: some improvements in snapshot info collection
Browse files Browse the repository at this point in the history
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 <muagarwa@redhat.com>
  • Loading branch information
agarwal-mudit committed Oct 30, 2020
1 parent 4afb46f commit dc796b1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions must-gather/collection-scripts/gather_ceph_resources
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit dc796b1

Please sign in to comment.