Commit c66332db authored by Giuseppe Lo Presti's avatar Giuseppe Lo Presti
Browse files

migration: added warning about repack and fixed the "doit" part

of the script after validation in castorpps
parent 97d2fe47
......@@ -25,6 +25,8 @@ The tools are designed to work as follows, for any given VO:
1. Initiate the export from CASTOR by running the `begin_vo_export_to_cta.sh` script. Example:
* `bash begin_vo_export_to_cta.sh --doit /atlas /grid/atlas`
This script blocks user access to the given top-level directories in CASTOR.
Alternatively, for a test import without blocking access to CASTOR, import all relevant directories one by one using `eos-import-dirs`. Example:
* `eos-import-dirs /atlas`
* `eos-import-dirs /grid/atlas`
......@@ -35,6 +37,10 @@ The tools are designed to work as follows, for any given VO:
* `bash export_production_tapepool_to_cta.sh r_atlas_raw atlas eosctaatlas --doit`
* `bash export_production_tapepool_to_cta.sh r_atlas_user atlas eosctaatlas --doit`
This script looks for ongoing tape migrations in CASTOR and stops if it finds any.
> [warning] Please note that the script does **NOT** check against the CASTOR Repack instance, therefore the operator **must ensure** that there's no submitted or ongoing repack for the targeted tapepool!
> [warning] In order to efficiently import tape pools holding dual tape copies, and avoid a double pass over the EOS metadata import, such tape pools are imported in a single operation: assuming that a tape pool holding the 1st copies is requested to be exported, the corresponding tape pool holding the 2nd copies is **also exported**. Furthermore, to protect CTA, `tapepool_castor_to_cta.py` will abort if some files are found having their 1st tape copy and other files having their 2nd tape copy, all in the given tape pool. The process will also abort if 2nd copies exist but a single tape pool holding them cannot be identified (e.g. because there are two, or it was not found).
3. At the end of all VO's tapepool, perform the 0-byte files migration. Example:
......
......@@ -24,6 +24,11 @@
# * @author Castor Dev team, castor-dev@cern.ch
# *****************************************************************************/
fail() {
echo $@
exit 2
}
# check arguments
if [[ $# != 4 || "$4" != "--dryrun" && "$4" != "--doit" ]]; then
echo Starts the export of a tapepool to CTA.
......@@ -36,19 +41,24 @@ fi
if [[ "$4" == "--doit" ]]; then
# check that the tapepool exists for this stager
printtapepool $1 > /dev/null
[[ $? -gt 0 ]] && echo 'Tape pool' $1 'not found or not configured on this stager' && exit 1
printtapepool $1 > /dev/null || fail 'Tape pool' $1 'not found or not configured on this stager'
# check that no migrations are pending/ongoing for this tapepool
printmigrationstatus | grep $1 && echo 'Migrations still ongoing, aborting' && exit 1
mig=`printmigrationstatus | grep -c $1`
[[ $mig -gt 0 ]] && fail 'Migrations still ongoing, aborting'
# check that all tapes are good for export, that is no BUSY tape; RDONLY is OK
busytapes=`vmgrlisttape -P $1 | grep -c BUSY`
[[ $busytapes -gt 0 ]] && echo 'Found' $busytapes 'tape(s) in BUSY state, aborting' && exit 1
[[ $busytapes -gt 0 ]] && fail 'Found' $busytapes 'tape(s) in BUSY state, aborting'
# on the stager, make the tapepool unusable (the tapepool metadata can stay)
[[ ! -x migrationroute_$1 ]] && printmigrationroute | grep -w $1 > ~/ctaexport/migrationroutes_$1
echo "No ongoing tape migration found, backing up and removing migration routes"
mkdir -p ~/ctaexport
[[ ! -x ~/ctaexport/migrationroutes_$1 ]] && printmigrationroute | grep -w $1 > ~/ctaexport/migrationroutes_$1
printmigrationroute | grep -w $1 | awk '{print $1}' | xargs -i deletemigrationroute {}
# all right, still warn user about repack
echo "Moving on ASSUMING no repack operation has been submitted concerning tapepool" $1
fi
# from now on, exit for any error from any command
......@@ -63,4 +73,3 @@ eos-import-files
# terminate the export
complete_tapepool_export.py -t $1
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment