Commit 7c91738a authored by Jorge Camarero Vera's avatar Jorge Camarero Vera Committed by Michael Davis
Browse files

Replaces CASTOR licence agreement comments with those of CTA.

parent bcae7f74
# The CERN Tape Archive (CTA) project # @project The CERN Tape Archive (CTA)
# Copyright (C) 2015 CERN # @copyright Copyright(C) 2015-2021 CERN
# @license 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 3 of the License, or
# (at your option) any later version.
# #
# This program is free software: you can redistribute it and/or modify # This program is distributed in the hope that it will be useful,
# it under the terms of the GNU General Public License as published by # but WITHOUT ANY WARRANTY; without even the implied warranty of
# the Free Software Foundation, either version 3 of the License, or # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# (at your option) any later version. # GNU General Public License for more details.
# #
# This program is distributed in the hope that it will be useful, # You should have received a copy of the GNU General Public License
# but WITHOUT ANY WARRANTY; without even the implied warranty of # along with this program. If not, see <http://www.gnu.org/licenses/>.
# 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, see <http://www.gnu.org/licenses/>.
cmake_minimum_required (VERSION 2.6) cmake_minimum_required (VERSION 2.6)
project(cta) project(cta)
...@@ -74,7 +73,7 @@ include(cmake/CTAVersions.cmake) ...@@ -74,7 +73,7 @@ include(cmake/CTAVersions.cmake)
IF(DEFINED PackageOnly) IF(DEFINED PackageOnly)
message (STATUS "Running CMake in package-only mode") message (STATUS "Running CMake in package-only mode")
set(COMPILE_PACKAGING "1") set(COMPILE_PACKAGING "1")
ELSE(DEFINED PackageOnly) ELSE(DEFINED PackageOnly)
message (STATUS "Running in full configuration mode.") message (STATUS "Running in full configuration mode.")
message (STATUS "Override with -DPackageOnly:Bool=true") message (STATUS "Override with -DPackageOnly:Bool=true")
...@@ -94,7 +93,7 @@ ELSE(DEFINED PackageOnly) ...@@ -94,7 +93,7 @@ ELSE(DEFINED PackageOnly)
ELSE() ELSE()
# log choosen default (RelWithDebInfo) and set it # log choosen default (RelWithDebInfo) and set it
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.") message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
message (STATUS "Override with -DCMAKE_BUILD_TYPE:STRING=Debug") message (STATUS "Override with -DCMAKE_BUILD_TYPE:STRING=Debug")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui # Set the possible values of build type for cmake-gui
# this command is not yet available in SLC6's cmake 2.6 # this command is not yet available in SLC6's cmake 2.6
...@@ -149,7 +148,7 @@ ELSE(DEFINED PackageOnly) ...@@ -149,7 +148,7 @@ ELSE(DEFINED PackageOnly)
add_subdirectory(rdbms) add_subdirectory(rdbms)
add_subdirectory(scheduler) add_subdirectory(scheduler)
add_subdirectory(tapeserver) add_subdirectory(tapeserver)
add_subdirectory(statistics) add_subdirectory(statistics)
add_subdirectory(continuousintegration/orchestration/tests) add_subdirectory(continuousintegration/orchestration/tests)
...@@ -205,7 +204,7 @@ add_custom_target(fullunittests ...@@ -205,7 +204,7 @@ add_custom_target(fullunittests
COMMAND tests/cta-unitTests-multiProcess COMMAND tests/cta-unitTests-multiProcess
COMMAND ${VALGRIND} ${VALGRIND_OPTS_W_SUPPR} --child-silent-after-fork=yes tests/cta-unitTests-multiProcess COMMAND ${VALGRIND} ${VALGRIND_OPTS_W_SUPPR} --child-silent-after-fork=yes tests/cta-unitTests-multiProcess
COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} tests/cta-unitTests-multiProcess COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} tests/cta-unitTests-multiProcess
DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/valgrind.suppr tests/helgrind.suppr DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/valgrind.suppr tests/helgrind.suppr
COMMENT "Running unit tests with memory leak and race conditions detection" VERBATIM) COMMENT "Running unit tests with memory leak and race conditions detection" VERBATIM)
...@@ -223,7 +222,7 @@ add_custom_target(helgrind ...@@ -223,7 +222,7 @@ add_custom_target(helgrind
COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} tests/cta-unitTests COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} tests/cta-unitTests
COMMAND echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} tests/cta-unitTests-multiProcess COMMAND echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} tests/cta-unitTests-multiProcess
COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} tests/cta-unitTests-multiProcess COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} tests/cta-unitTests-multiProcess
DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr
COMMENT "Running unit tests with race conditions detection" VERBATIM) COMMENT "Running unit tests with race conditions detection" VERBATIM)
...@@ -239,39 +238,39 @@ add_custom_target(helgrindBase ...@@ -239,39 +238,39 @@ add_custom_target(helgrindBase
COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=-OStoreDBPlusMockSchedulerTestVFS*:OStoreTestVFS*:OStoreDBPlusMockSchedulerTestVFS*:InMemory* COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=-OStoreDBPlusMockSchedulerTestVFS*:OStoreTestVFS*:OStoreDBPlusMockSchedulerTestVFS*:InMemory*
COMMAND echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests-multiProcess COMMAND echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests-multiProcess
COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests-multiProcess COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests-multiProcess
DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr
COMMENT "Running unit tests with race conditions detection (except slow sections)" VERBATIM) COMMENT "Running unit tests with race conditions detection (except slow sections)" VERBATIM)
add_custom_target(helgrindScheduler add_custom_target(helgrindScheduler
echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreDBPlusMockSchedulerTestVFS/Scheduler* echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreDBPlusMockSchedulerTestVFS/Scheduler*
COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreDBPlusMockSchedulerTestVFS/Scheduler* COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreDBPlusMockSchedulerTestVFS/Scheduler*
DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr
COMMENT "Running unit tests with race conditions detection (Mock scheduler section)" VERBATIM) COMMENT "Running unit tests with race conditions detection (Mock scheduler section)" VERBATIM)
add_custom_target(helgrindOStoreDB add_custom_target(helgrindOStoreDB
echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreTestVFS* echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreTestVFS*
COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreTestVFS* COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreTestVFS*
DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr
COMMENT "Running unit tests with race conditions detection (Object store DB section)" VERBATIM) COMMENT "Running unit tests with race conditions detection (Object store DB section)" VERBATIM)
add_custom_target(helgrindDataTransfer add_custom_target(helgrindDataTransfer
echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreDBPlusMockSchedulerTestVFS/DataTransferSessionTest* echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreDBPlusMockSchedulerTestVFS/DataTransferSessionTest*
COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreDBPlusMockSchedulerTestVFS/DataTransferSessionTest* COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=OStoreDBPlusMockSchedulerTestVFS/DataTransferSessionTest*
DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr
COMMENT "Running unit tests with race conditions detection (Data transfer section)" VERBATIM) COMMENT "Running unit tests with race conditions detection (Data transfer section)" VERBATIM)
add_custom_target(helgrindInMemoryCatalogue add_custom_target(helgrindInMemoryCatalogue
echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=InMemory/* echo ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=InMemory/*
COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=InMemory/* COMMAND ${VALGRIND} --tool=helgrind ${HELGRIND_OPTS_W_SUPPR} -q tests/cta-unitTests --gtest_filter=InMemory/*
DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr DEPENDS tests/cta-unitTests tests/cta-unitTests-multiProcess tests/helgrind.suppr
COMMENT "Running unit tests with race conditions detection (In memory catalogue section)" VERBATIM) COMMENT "Running unit tests with race conditions detection (In memory catalogue section)" VERBATIM)
add_custom_target(parallelHelgrind add_custom_target(parallelHelgrind
echo echo
DEPENDS helgrindBase helgrindMockSechduler helgrindOStoreDB helgrindDataTransfer helgrindInMemoryCatalogue) DEPENDS helgrindBase helgrindMockSechduler helgrindOStoreDB helgrindDataTransfer helgrindInMemoryCatalogue)
#!/bin/sh #!/bin/sh
# @project The CERN Tape Archive (CTA)
# @copyright Copyright(C) 2021 CERN
# @license 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 3 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, see <http://www.gnu.org/licenses/>.
VID=L80013 VID=L80013
FILES=`nslisttape -sV $VID | cut -f1 -d' '` FILES=`nslisttape -sV $VID | cut -f1 -d' '`
......
#!/bin/bash #!/bin/bash
# @project The CERN Tape Archive (CTA)
# @copyright Copyright(C) 2021 CERN
# @license 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 3 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, see <http://www.gnu.org/licenses/>.
VID=`/usr/bin/tpstat | /bin/grep @ | /bin/awk '{print $7}'` VID=`/usr/bin/tpstat | /bin/grep @ | /bin/awk '{print $7}'`
STDEVICE=`/bin/readlink --canonicalize /dev/tape | /bin/sed -e 's;^/dev/nst;/dev/st;'` STDEVICE=`/bin/readlink --canonicalize /dev/tape | /bin/sed -e 's;^/dev/nst;/dev/st;'`
......
#!/bin/sh #!/bin/sh
# @project The CERN Tape Archive (CTA)
# @copyright Copyright(C) 2021 CERN
# @license 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 3 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, see <http://www.gnu.org/licenses/>.
VID=$1 VID=$1
INCREMENT=3 INCREMENT=3
......
#!/usr/bin/perl -w # @project The CERN Tape Archive (CTA)
# @copyright Copyright(C) 2010-2021 CERN
# @license 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 3 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.
# #
# tape-verify # You should have received a copy of the GNU General Public License
# # along with this program. If not, see <http://www.gnu.org/licenses/>.
# German Cancio <German.Cancio@cern.ch>
#
#
# Copyright (c) 2010-2018 CERN
#
=pod =pod
...@@ -26,7 +29,7 @@ read CASTOR tapes and verify consistency ...@@ -26,7 +29,7 @@ read CASTOR tapes and verify consistency
=head1 DESCRIPTION =head1 DESCRIPTION
The tape-verify tool allows to read a CASTOR tape and to verify its contents against the stored metadata in the name server. The tape-verify tool allows to read a CASTOR tape and to verify its contents against the stored metadata in the name server.
=head1 OPTIONS =head1 OPTIONS
...@@ -158,7 +161,7 @@ sub app_options() { ...@@ -158,7 +161,7 @@ sub app_options() {
{ NAME => 'usephysmap=s', { NAME => 'usephysmap=s',
HELP => 'use physical mapping file if available (for tape positioning optimisation)', HELP => 'use physical mapping file if available (for tape positioning optimisation)',
DEFAULT => 'yes'}, DEFAULT => 'yes'},
{ NAME => 'notracks=f', { NAME => 'notracks=f',
HELP => 'Number of tracks actually written on that tape (for tape positioning optimisation, if --usephysmap=no); accepts fractions to indicate occupancy of last track', HELP => 'Number of tracks actually written on that tape (for tape positioning optimisation, if --usephysmap=no); accepts fractions to indicate occupancy of last track',
...@@ -171,7 +174,7 @@ sub app_options() { ...@@ -171,7 +174,7 @@ sub app_options() {
{ NAME => 'totalbands=i', { NAME => 'totalbands=i',
HELP => 'Number of physical bands for this media.', HELP => 'Number of physical bands for this media.',
DEFAULT => 4}, DEFAULT => 4},
{ NAME => 'lastblockid=i', { NAME => 'lastblockid=i',
HELP => 'last block ID on tape. If not specified, approximates it by using name server information (last known file blockID + length in blocks + 50% of flush size)', HELP => 'last block ID on tape. If not specified, approximates it by using name server information (last known file blockID + length in blocks + 50% of flush size)',
DEFAULT => undef}, DEFAULT => undef},
...@@ -182,7 +185,7 @@ sub app_options() { ...@@ -182,7 +185,7 @@ sub app_options() {
{ NAME => 'noaction', { NAME => 'noaction',
HELP => 'dry run: do not launch actual verification.'}, HELP => 'dry run: do not launch actual verification.'},
); );
return \@array; return \@array;
...@@ -263,7 +266,7 @@ $EC=LC::Exception::Context->new->will_store_all; ...@@ -263,7 +266,7 @@ $EC=LC::Exception::Context->new->will_store_all;
#my $EC=LC::Exception::Context->new->will_report_all; #my $EC=LC::Exception::Context->new->will_report_all;
# #
# load_ns_info: retrieve file and segment information for a given VID: # load_ns_info: retrieve file and segment information for a given VID:
# segment: fseq, size, checksum # segment: fseq, size, checksum
# file: size, checksum # file: size, checksum
...@@ -328,7 +331,7 @@ sub load_ns_info { ...@@ -328,7 +331,7 @@ sub load_ns_info {
$warnings++; $warnings++;
} }
# now read this into $self->{'FILEINFO'} with the following structure: # now read this into $self->{'FILEINFO'} with the following structure:
# $self->{'INFO_FSEQ'}{<fseq>}{'CHKSUM'} # $self->{'INFO_FSEQ'}{<fseq>}{'CHKSUM'}
# {'BLOCKID'} # {'BLOCKID'}
# {'SIZE'} # {'SIZE'}
...@@ -368,7 +371,7 @@ sub load_ns_info { ...@@ -368,7 +371,7 @@ sub load_ns_info {
if (defined $chksum) { if (defined $chksum) {
$chksum =~ s%^0+(\S+)$%$1%; $chksum =~ s%^0+(\S+)$%$1%;
} }
$self->{'INFO_FSEQ'}{$fseq}{'CHKSUM'}=$chksum; $self->{'INFO_FSEQ'}{$fseq}{'CHKSUM'}=$chksum;
$self->{'INFO_FSEQ'}{$fseq}{'SIZE'}=$size; $self->{'INFO_FSEQ'}{$fseq}{'SIZE'}=$size;
$self->{'INFO_FSEQ'}{$fseq}{'FILENAME'}=$fname; $self->{'INFO_FSEQ'}{$fseq}{'FILENAME'}=$fname;
...@@ -395,7 +398,7 @@ sub load_ns_info { ...@@ -395,7 +398,7 @@ sub load_ns_info {
# (XXXXX TODO: move all this into a different method. It has nothing to do with the name server initialisation) # (XXXXX TODO: move all this into a different method. It has nothing to do with the name server initialisation)
# #
# #
# two alternatives: # two alternatives:
# a) a mapping is provided containing the physical wrap and LPOS information for each FSEQ # a) a mapping is provided containing the physical wrap and LPOS information for each FSEQ
# b) no mapping available, the physical layout is constructed deducing from name server and command line information (last block ID (optional), no wraps (required)) # b) no mapping available, the physical layout is constructed deducing from name server and command line information (last block ID (optional), no wraps (required))
# #
...@@ -431,11 +434,11 @@ sub load_ns_info { ...@@ -431,11 +434,11 @@ sub load_ns_info {
# #
# XXXX to be improved: assume end-to-end time is 105s # XXXX to be improved: assume end-to-end time is 105s
# #
$self->{'TOTALSEEKTIME'} = 105; $self->{'TOTALSEEKTIME'} = 105;
if (($this_app->option("usephysmap") eq 'yes') && (-e $this_app->option("physmapdir") . "/" . $self->{'VID'} . ".pmap")) { if (($this_app->option("usephysmap") eq 'yes') && (-e $this_app->option("physmapdir") . "/" . $self->{'VID'} . ".pmap")) {
# use map file # use map file
# format of map file: <fseq1> <wrap ID> <LPOS> <block id (dec)> separated by (one or more) spaces # format of map file: <fseq1> <wrap ID> <LPOS> <block id (dec)> separated by (one or more) spaces
...@@ -452,7 +455,7 @@ sub load_ns_info { ...@@ -452,7 +455,7 @@ sub load_ns_info {
$self->{'POSPERTRACK'}=171144; $self->{'POSPERTRACK'}=171144;
my $physmapfile = $this_app->option("physmapdir") . "/" . $self->{'VID'} . ".pmap"; my $physmapfile = $this_app->option("physmapdir") . "/" . $self->{'VID'} . ".pmap";
$self->verbose ("using physical map file: " . $physmapfile); $self->verbose ("using physical map file: " . $physmapfile);
my $handle; my $handle;
...@@ -475,7 +478,7 @@ sub load_ns_info { ...@@ -475,7 +478,7 @@ sub load_ns_info {
$self->error($line); $self->error($line);
return undef; return undef;
} }
if (uc($fseq) ne 'EOD') { # EOD is special and only is for the last segment if (uc($fseq) ne 'EOD') { # EOD is special and only is for the last segment
$self->{'INFO_FSEQ'}{$fseq}{'START_TRACK'} = $wrap; $self->{'INFO_FSEQ'}{$fseq}{'START_TRACK'} = $wrap;
$self->{'INFO_FSEQ'}{$fseq}{'START_POS_TRACK'} = ($wrap %2 ? $self->{'POSPERTRACK'} - $lpos : $lpos); $self->{'INFO_FSEQ'}{$fseq}{'START_POS_TRACK'} = ($wrap %2 ? $self->{'POSPERTRACK'} - $lpos : $lpos);
...@@ -501,11 +504,11 @@ sub load_ns_info { ...@@ -501,11 +504,11 @@ sub load_ns_info {
} }
$prevfseq = $fseq ; $prevfseq = $fseq ;
} }
} else { } else {
# no mapfile, construct physical layout # no mapfile, construct physical layout
$self->verbose ("not using (or not found) physical map file.."); $self->verbose ("not using (or not found) physical map file..");
my ($lastfseq) = @{$self->get_last_fseq(1)}; my ($lastfseq) = @{$self->get_last_fseq(1)};
my $totalblocks = $this_app->option("lastblockid"); my $totalblocks = $this_app->option("lastblockid");
if (defined $totalblocks) { if (defined $totalblocks) {
...@@ -513,7 +516,7 @@ sub load_ns_info { ...@@ -513,7 +516,7 @@ sub load_ns_info {
} else { } else {
# total blocks not provided as option, take it from name server information # total blocks not provided as option, take it from name server information
# assume it's the blockID of the last file on nslisttape + its size + 3 trailer blocks + 16GB worth of uncommitted written space (32GB / 2) # assume it's the blockID of the last file on nslisttape + its size + 3 trailer blocks + 16GB worth of uncommitted written space (32GB / 2)
# this of course won't work on tapes where the last file has been deleted from ns (the more files deleted at the end without gaps, the more inaccurate) # this of course won't work on tapes where the last file has been deleted from ns (the more files deleted at the end without gaps, the more inaccurate)
$totalblocks = $self->{INFO_FSEQ}{$lastfseq}{'BLOCKID'} + int(($self->{'INFO_FSEQ'}{$lastfseq}{'SIZE'} + 16 * 1000 ** 3) / ($DATABLOCKSIZE)) + 3; $totalblocks = $self->{INFO_FSEQ}{$lastfseq}{'BLOCKID'} + int(($self->{'INFO_FSEQ'}{$lastfseq}{'SIZE'} + 16 * 1000 ** 3) / ($DATABLOCKSIZE)) + 3;
} }
...@@ -561,18 +564,18 @@ sub check_file_metadata { ...@@ -561,18 +564,18 @@ sub check_file_metadata {
} else { } else {
$shout='warn'; $shout='warn';
} }
my $tmpfile="/tmp/tape-verify_nsls.".$$; my $tmpfile="/tmp/tape-verify_nsls.".$$;
my @files; my @files;
foreach (@fseq) { foreach (@fseq) {
push (@files,"'".$self->get_fname_by_fseq($_)."'"); push (@files,"'".$self->get_fname_by_fseq($_)."'");
# quote the files - protect against spaces etc in the file name # quote the files - protect against spaces etc in the file name
} }
unless (file_contents($tmpfile,join("\n",@files))) { unless (file_contents($tmpfile,join("\n",@files))) {
$this_app->error("cannot write $tmpfile"); $this_app->error("cannot write $tmpfile");
return undef; return undef;
} }
my $cmd = "/bin/cat $tmpfile | /usr/bin/xargs $NSLSCMD"; my $cmd = "/bin/cat $tmpfile | /usr/bin/xargs $NSLSCMD";
...@@ -603,7 +606,7 @@ sub check_file_metadata { ...@@ -603,7 +606,7 @@ sub check_file_metadata {
foreach my $f (split(/\n/,$err)) { foreach my $f (split(/\n/,$err)) {
if ($f =~ m/No such file or directory/) { if ($f =~ m/No such file or directory/) {
# means that a file has been renamed or deleted during the time window between # means that a file has been renamed or deleted during the time window between
# nslisstape and nsls. This is unfrequent but can (and does) happen, in particular # nslisstape and nsls. This is unfrequent but can (and does) happen, in particular
# when checking "fresh" tapes (eg. containing active data). # when checking "fresh" tapes (eg. containing active data).
# just report a complaint (warning,error) in this case. # just report a complaint (warning,error) in this case.
$self->$shout($f); $self->$shout($f);
...@@ -617,11 +620,11 @@ sub check_file_metadata { ...@@ -617,11 +620,11 @@ sub check_file_metadata {
} }
} }
# now iterate over the files (or fseqs) and obtain the file checksum, and compare it to the segment checksum # now iterate over the files (or fseqs) and obtain the file checksum, and compare it to the segment checksum
# nsls -l --checksum <file> format: # nsls -l --checksum <file> format:
# mrw-r--r-- 1 gcancio c3 104857647 Nov 11 2009 AD 8d81e820 /castor/cern.ch/user/g/gcancio/gwtest-100MBfile/91d8b729-2088-4c28-a8c7-f834511ea501-lxbrb1314 # mrw-r--r-- 1 gcancio c3 104857647 Nov 11 2009 AD 8d81e820 /castor/cern.ch/user/g/gcancio/gwtest-100MBfile/91d8b729-2088-4c28-a8c7-f834511ea501-lxbrb1314
my ($size,$chksum,$fname); my ($size,$chksum,$fname);
foreach my $f (split(/\n/,$qryout)) { foreach my $f (split(/\n/,$qryout)) {
if ($f =~ m%^\S+\s+\S+\s+\S+\s+\S+\s+(\S+)\s+\S+\s+\S+\s+\S+\s+\S+\s+(\S+)\s+(/castor/.+)$%) { if ($f =~ m%^\S+\s+\S+\s+\S+\s+\S+\s+(\S+)\s+\S+\s+\S+\s+\S+\s+\S+\s+(\S+)\s+(/castor/.+)$%) {
...@@ -732,7 +735,7 @@ sub get_list_fnames { ...@@ -732,7 +735,7 @@ sub get_list_fnames {
my $self=shift; my $self=shift;
return [(sort (keys %{$self->{'INFO_FNAM'}}))]; return [(sort (keys %{$self->{'INFO_FNAM'}}))];
} }
sub get_fname_by_fseq { sub get_fname_by_fseq {
my ($self,$fseq)=@_; my ($self,$fseq)=@_;
...@@ -742,7 +745,7 @@ sub get_fname_by_fseq { ...@@ -742,7 +745,7 @@ sub get_fname_by_fseq {
} }
return $self->{'INFO_FSEQ'}{$fseq}{'FILENAME'}; return $self->{'INFO_FSEQ'}{$fseq}{'FILENAME'};
} }
sub get_fseq_by_fname { sub get_fseq_by_fname {
my ($self,$fname)=@_; my ($self,$fname)=@_;
unless (exists $self->{'INFO_FNAM'}{$fname}) { unless (exists $self->{'INFO_FNAM'}{$fname}) {
...@@ -870,12 +873,12 @@ sub physical_distance_pos { ...@@ -870,12 +873,12 @@ sub physical_distance_pos {
# opposite direction # opposite direction
return abs($self->{'POSPERTRACK'} - $self->get_end_pos_track_by_fseq($fseq1) - $self->get_start_pos_track_by_fseq($fseq2)); return abs($self->{'POSPERTRACK'} - $self->get_end_pos_track_by_fseq($fseq1) - $self->get_start_pos_track_by_fseq($fseq2));
} }
} }
# check if two segments fseq1, fseq2 do physically overlap in the track direction requiring the drive to step back. # check if two segments fseq1, fseq2 do physically overlap in the track direction requiring the drive to step back.
# the third parameter (margin) specifies the margin (in terms of position units) to be applied to both fseqs # the third parameter (margin) specifies the margin (in terms of position units) to be applied to both fseqs
# eg. is there a physical overlap in the ranges fseq1[start, end+margin] and fseq2[start-margin, end]? # eg. is there a physical overlap in the ranges fseq1[start, end+margin] and fseq2[start-margin, end]?
# to be useful, tracks should be in the same direction. Returns 0 (no overlap) if tracks are in different directions. # to be useful, tracks should be in the same direction. Returns 0 (no overlap) if tracks are in different directions.
sub have_overlap { sub have_overlap {
my ($self, $fseq1, $fseq2,$margin) = @_; my ($self, $fseq1, $fseq2,$margin) = @_;
...@@ -893,47 +896,47 @@ sub have_overlap { ...@@ -893,47 +896,47 @@ sub have_overlap {
return 0; return 0;
} }
} }
# compute the cost of moving from fseq1 to fseq2 in terms of seconds. # compute the cost of moving from fseq1 to fseq2 in terms of seconds.
sub position_cost { sub position_cost {
my ($self, $fseq1, $fseq2) = @_; my ($self, $fseq1, $fseq2) = @_;
my $phys_distance = $self->physical_distance_pos($fseq1,$fseq2); my $phys_distance = $self->physical_distance_pos($fseq1,$fseq2);
return -1 if ($phys_distance == -1); # obvious case return -1 if ($phys_distance == -1); # obvious case
# #
# parameters below calculated using multi-Linear Regression analysis of ~380K file positions on LTO-7M # parameters below calculated using multi-Linear Regression analysis of ~380K file positions on LTO-7M
# these are unconfirmed for other media types (in particular LTO-8) but according to IBM, should be very similar if not identical # these are unconfirmed for other media types (in particular LTO-8) but according to IBM, should be very similar if not identical
# #
my $penalty = 4.357; # changing fseq to non-contiguous one base overhead my $penalty = 4.357; # changing fseq to non-contiguous one base overhead
# is it the same track? # is it the same track?
if ($self->get_end_track_by_fseq($fseq1) != $self->get_start_track_by_fseq($fseq2)) { if ($self->get_end_track_by_fseq($fseq1) != $self->get_start_track_by_fseq($fseq2)) {