From 39f4eb7b57e699163fa6d29c0a0a4efd6daa161e Mon Sep 17 00:00:00 2001 From: Michael Davis <michael.davis@cern.ch> Date: Thu, 16 Jan 2020 17:17:57 +0100 Subject: [PATCH] [ci] Deletes repack_generate_report.sh --- .../tests/multiple_repack_wrapper.sh | 3 +- .../tests/repack_generate_report.sh | 143 ------------------ .../orchestration/tests/repack_systemtest.sh | 6 - .../tests/repack_systemtest_wrapper.sh | 1 - 4 files changed, 1 insertion(+), 152 deletions(-) delete mode 100755 continuousintegration/orchestration/tests/repack_generate_report.sh diff --git a/continuousintegration/orchestration/tests/multiple_repack_wrapper.sh b/continuousintegration/orchestration/tests/multiple_repack_wrapper.sh index b601751ad2..40e789c580 100755 --- a/continuousintegration/orchestration/tests/multiple_repack_wrapper.sh +++ b/continuousintegration/orchestration/tests/multiple_repack_wrapper.sh @@ -43,7 +43,6 @@ kubectl -n ${NAMESPACE} cp client_helper.sh client:/root/client_helper.sh kubectl -n ${NAMESPACE} cp client_ar.sh client:/root/client_ar.sh kubectl -n ${NAMESPACE} cp multiple_repack.sh client:/root/multiple_repack.sh kubectl -n ${NAMESPACE} cp repack_systemtest.sh client:/root/repack_systemtest.sh -kubectl -n ${NAMESPACE} cp repack_generate_report.sh client:/root/repack_generate_report.sh NB_FILES_PER_TAPE=1000 @@ -57,4 +56,4 @@ kubectl -n ${NAMESPACE} exec ctaeos -- eos chmod 1777 ${REPACK_BUFFER_URL} echo "Enabling all drives" kubectl -n ${NAMESPACE} exec ctacli -- cta-admin dr up ".*" -kubectl -n ${NAMESPACE} exec client -- bash /root/multiple_repack.sh -n ${NB_FILES_PER_TAPE} -s ${SIZE_OF_TAPES} -b ${REPACK_BUFFER_URL} || exit 1 \ No newline at end of file +kubectl -n ${NAMESPACE} exec client -- bash /root/multiple_repack.sh -n ${NB_FILES_PER_TAPE} -s ${SIZE_OF_TAPES} -b ${REPACK_BUFFER_URL} || exit 1 diff --git a/continuousintegration/orchestration/tests/repack_generate_report.sh b/continuousintegration/orchestration/tests/repack_generate_report.sh deleted file mode 100755 index ad537eff78..0000000000 --- a/continuousintegration/orchestration/tests/repack_generate_report.sh +++ /dev/null @@ -1,143 +0,0 @@ -#!/bin/bash - -REPORT_DIRECTORY=/var/log -ADD_COPIES_ONLY=0 - -die() { - echo "$@" 1>&2 - test -z $TAILPID || kill ${TAILPID} &> /dev/null - exit 1 -} - -usage() { cat <<EOF 1>&2 -Usage: $0 -v <vid> [-r <report_directory>] [-a] -Default report_directory = ${REPORT_DIRECTORY} --a: Specify if the repack is add copies only or not -EOF -exit 1 -} - -if [ $# -lt 1 ] -then - usage -fi; - -while getopts "v:r:a" o; do - case "${o}" in - v) - VID=${OPTARG} - ;; - r) - REPORT_DIRECTORY=${OPTARG} - ;; - a) - ADD_COPIES_ONLY=1 - ;; - *) - usage - ;; - esac -done -shift $((OPTIND-1)) - -# get some common useful helpers for krb5 -. /root/client_helper.sh - -# Get kerberos credentials for user1 -admin_kinit -admin_klist > /dev/null 2>&1 || die "Cannot get kerberos credentials for user ${USER}" - -repackRequest=`admin_cta --json repack ls --vid ${VID}` - -if [ "$repackRequest" == "" ]; -then - die "No repack request for this VID." -fi; - -echo "Creating the report directory ${REPORT_DIRECTORY}" -mkdir -p ${REPORT_DIRECTORY} || die "Unable to create the directory for report generation" - -echo "Generation of a repack report of the vid ${VID}" - -DATE=`date +%d-%m-%y-%H:%M:%S` - -ARCHIVE_FILE_LS_RESULT_PATH=${REPORT_DIRECTORY}/af_ls_${DATE}.json -ARCHIVE_FILE_LS_VID_RESULT_PATH=${REPORT_DIRECTORY}/${VID}_af_ls_${DATE}.json -NOT_REPACKED_JSON_PATH=${REPORT_DIRECTORY}/${VID}_report_not_repacked_${DATE}.json -SELF_REPACKED_JSON_PATH=${REPORT_DIRECTORY}/${VID}_report_self_repacked_${DATE}.json -REPACKED_MOVE_JSON_PATH=${REPORT_DIRECTORY}/${VID}_report_repacked_move_${DATE}.json -REPACK_ADD_COPIES_JSON_PATH=${REPORT_DIRECTORY}/${VID}_report_repack_add_copies_${DATE}.json -STDOUT_REPORT_PATH=${REPORT_DIRECTORY}/${VID}_stdout_report.txt - - -echo "1. Generate archive file ls result into ${ARCHIVE_FILE_LS_RESULT_PATH} file..." -admin_cta --json archivefile ls --all > ${ARCHIVE_FILE_LS_RESULT_PATH} -echo "OK" - -echo "2. Generate all the archive files that are on vid ${VID} into ${ARCHIVE_FILE_LS_VID_RESULT_PATH} file..." -jq -r "[.[] | select (.tf.vid == \"${VID}\")]" ${ARCHIVE_FILE_LS_RESULT_PATH} > ${ARCHIVE_FILE_LS_VID_RESULT_PATH} -echo "OK" - -echo "3. Generate the non-repacked files report into ${NOT_REPACKED_JSON_PATH} file..." -jq -r "[.[] | select (.tf.supersededByVid == \"\" and .tf.vid == \"${VID}\")]" ${ARCHIVE_FILE_LS_VID_RESULT_PATH} > ${NOT_REPACKED_JSON_PATH} -echo "OK" - -echo "4. Generating the self-repacked files report into ${SELF_REPACKED_JSON_PATH} file..." -jq -r '[.[] | select((.tf.supersededByVid == .tf.vid) and (.tf.fSeq < .tf.supersededByFSeq))]' ${ARCHIVE_FILE_LS_VID_RESULT_PATH} > ${SELF_REPACKED_JSON_PATH} -echo "OK" - -echo "5. Generate the repacked (moved) files report into ${REPACKED_MOVE_JSON_PATH} file..." -jq -r '[.[] | select((.tf.supersededByVid != "") and (.tf.supersededByVid != .tf.vid))]' ${ARCHIVE_FILE_LS_VID_RESULT_PATH} > ${REPACKED_MOVE_JSON_PATH} -echo "OK" - -echo "6. Generate the repack \"just add copies\" report into ${REPACK_ADD_COPIES_JSON_PATH} file..." -storageClass=`jq ".[0] | .af.storageClass" ${ARCHIVE_FILE_LS_VID_RESULT_PATH}` -copyNbToExclude=`jq -r ".[0] | .copyNb" ${ARCHIVE_FILE_LS_VID_RESULT_PATH}` -copyNbs=`admin_cta --json archiveroute ls | jq -r ".[] | select(.storageClass == $storageClass and .copyNumber != $copyNbToExclude) | .copyNumber"` - -jq -r "[.[] | select(.copyNb == (\"$copyNbs\" | split(\"\n\")[]))]" ${ARCHIVE_FILE_LS_RESULT_PATH} > ${REPACK_ADD_COPIES_JSON_PATH} -echo "OK" - -echo "7. Report of the repacked tape" - -if [ ${ADD_COPIES_ONLY} -eq 0 ]; -then - echo - NB_NON_REPACKED_FILES=$(jq '[.[]] | length' ${NOT_REPACKED_JSON_PATH} || 0) - echo "Number of non repacked files : ${NB_NON_REPACKED_FILES}" - if [ ${NB_NON_REPACKED_FILES} -ne 0 ] - then - header="ArchiveID\tFSeq\tSize" - { echo -e $header; jq -r '.[] | [.af.archiveId,.tf.fSeq, .af.size] | @tsv' ${NOT_REPACKED_JSON_PATH}; } | column -t | tee --append ${STDOUT_REPORT_PATH} - fi; -fi; - -echo -NB_SELF_REPACKED_FILES=$(jq '[.[]] | length' ${SELF_REPACKED_JSON_PATH} || 0) -echo "Number of self-repacked files : ${NB_SELF_REPACKED_FILES}" -if [ ${NB_SELF_REPACKED_FILES} -ne 0 ] -then - header="ArchiveID\tFSeq\tSize" - { echo -e $header; jq -r '.[] | [.af.archiveId, .tf.fSeq, .af.size] | @tsv' ${SELF_REPACKED_JSON_PATH}; } | column -t | tee --append ${STDOUT_REPORT_PATH} -fi; -echo - -NB_REPACKED_MOVE_FILES=$(jq '[.[]] | length' ${REPACKED_MOVE_JSON_PATH} || 0) -echo "Number of repacked (moved) files : ${NB_REPACKED_MOVE_FILES}" -if [ ${NB_REPACKED_MOVE_FILES} -ne 0 ] -then - header="DestinationVID\tNbFiles\ttotalSize\n" - { echo -e $header; jq -r 'group_by(.tf.supersededByVid)[] | [(.[0].tf.supersededByVid),([.[] | .tf.supersededByFSeq] | length),(reduce [.[] | .af.size | tonumber][] as $currentSize (0; . + $currentSize))] | @tsv' ${REPACKED_MOVE_JSON_PATH}; } | column -t | tee --append ${STDOUT_REPORT_PATH} -fi; -echo - -NB_COPIED_FILES=$(jq '[.[]] | length' ${REPACK_ADD_COPIES_JSON_PATH} || 0) -echo "Number of copied files : $NB_COPIED_FILES" -if [ ${NB_COPIED_FILES} -ne 0 ] -then - header="DestinationVID\tNbFiles\ttotalSize\n" - { echo -e $header; jq -r 'group_by(.tf.vid)[] | [(.[0].tf.vid),([.[] | .tf.fSeq] | length),(reduce [.[] | .af.size | tonumber][] as $currentSize (0; . + $currentSize))] | @tsv' ${REPACK_ADD_COPIES_JSON_PATH}; } | column -t | tee --append ${STDOUT_REPORT_PATH} -fi; - -echo "End of the repack report" -exit 0 \ No newline at end of file diff --git a/continuousintegration/orchestration/tests/repack_systemtest.sh b/continuousintegration/orchestration/tests/repack_systemtest.sh index a7df0ffccb..4b24b2a085 100755 --- a/continuousintegration/orchestration/tests/repack_systemtest.sh +++ b/continuousintegration/orchestration/tests/repack_systemtest.sh @@ -168,8 +168,6 @@ while test 0 = `admin_cta --json repack ls --vid ${VID_TO_REPACK} | jq -r '.[0] header="DestinationVID\tNbFiles\ttotalSize\n" { echo -e $header; echo $destinationInfos | jq -r ".[] | [(.vid),(.files),(.bytes)] | @tsv"; } | column -t fi - exec /root/repack_generate_report.sh -v ${VID_TO_REPACK} -r ${REPORT_DIRECTORY} ${ADD_COPIES_ONLY} & - wait $! exit 1 fi done @@ -182,8 +180,6 @@ if test 1 = `admin_cta --json repack ls --vid ${VID_TO_REPACK} | jq -r '[.[0] | header="DestinationVID\tNbFiles\ttotalSize\n" { echo -e $header; echo $destinationInfos | jq -r ".[] | [(.vid),(.files),(.bytes)] | @tsv"; } | column -t fi - exec /root/repack_generate_report.sh -v ${VID_TO_REPACK} -r ${REPORT_DIRECTORY} ${ADD_COPIES_ONLY} & - wait $! exit 1 fi @@ -199,6 +195,4 @@ echo echo "Repack request on VID ${VID_TO_REPACK} succeeded." echo -exec /root/repack_generate_report.sh -v ${VID_TO_REPACK} -r ${REPORT_DIRECTORY} ${ADD_COPIES_ONLY} & -wait $! exit 0 diff --git a/continuousintegration/orchestration/tests/repack_systemtest_wrapper.sh b/continuousintegration/orchestration/tests/repack_systemtest_wrapper.sh index 343602ecef..56e715d196 100755 --- a/continuousintegration/orchestration/tests/repack_systemtest_wrapper.sh +++ b/continuousintegration/orchestration/tests/repack_systemtest_wrapper.sh @@ -55,7 +55,6 @@ kubectl -n ${NAMESPACE} exec ctaeos -- eos chmod 1777 ${REPACK_BUFFER_URL} source ./repack_helper.sh kubectl -n ${NAMESPACE} cp repack_systemtest.sh client:/root/repack_systemtest.sh -kubectl -n ${NAMESPACE} cp repack_generate_report.sh client:/root/repack_generate_report.sh roundTripRepack() { echo -- GitLab