vmgr_reenable_tapepool.sh 1.86 KB
Newer Older
1
#!/bin/bash
2
#/******************************************************************************
Giuseppe Lo Presti's avatar
Giuseppe Lo Presti committed
3
# *                      vmgr_reenable_tapepool.sh
4
5
# *
# * This file is part of the Castor/CTA project.
Giuseppe Lo Presti's avatar
Giuseppe Lo Presti committed
6
7
# * See http://cern.ch/castor and http://cern.ch/eoscta
# * Copyright (C) 2019  CERN
8
9
10
11
12
13
14
15
16
17
18
19
20
# *
# * This program is free software; you can redistribute it and/or
# * modify it under the terms of the GNU General Public License
# * as published by the Free Software Foundation; either version 2
# * of the License, or (at your option) any later version.
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# * GNU General Public License for more details.
# * You should have received a copy of the GNU General Public License
# * along with this program; if not, write to the Free Software
# * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# *
Giuseppe Lo Presti's avatar
Giuseppe Lo Presti committed
21
22
23
# * command line tool to re-enable a tapepool in CASTOR along with the related
# * migration routes. The tapepool stays active also in CTA.
# *
24
25
26
27
# * @author Castor Dev team, castor-dev@cern.ch
# *****************************************************************************/

# check arguments
28
if [[ $# != 1 ]]; then
Giuseppe Lo Presti's avatar
Giuseppe Lo Presti committed
29
  echo Usage: $0 tapepool
30
31
32
  exit 1
fi

33
34
# check that the metadata exists for the given tapepool
[[ ! -x ~/ctaexport/migrationroutes_$1 ]] && echo 'Metadata from a previous export of tapepool' $1 'not found, aborting' && exit 1
35
36

# on the stager, restore the migration routes
37
cat ~/ctaexport/migrationroutes_$1 | grep -v FILECLASS | grep -v '---' | awk '{print "entermigrationroute " $1 " " $2 ":" $4}' | sh
38
39
40

# on the VMGR, mark all tapes back as available (but full == read-only) for the tape pool
vmgrlisttape -P $1 | awk '{print $1}' | xargs -i vmgrmodifytape -V {} --st TAPE_FULL
41