Commit 1ab64314 authored by Eric Cano's avatar Eric Cano
Browse files

Create new packages for system test. Added a doc package.

Simplified code with regular expression by declaring a variable later.
parent 4f3d6af2
......@@ -4,3 +4,5 @@ INPUTS ProgrammersManual.tex AdministratorsManual.tex
IMAGE_DIRS images
NO_DEFAULT USE_INDEX MANGLE_TARGET_NAMES)
INSTALL(FILES ${CMAKE_BINARY_DIR}/Documentation/TapeServer.pdf
DESTINATION /usr/share/doc/tape-server/)
......@@ -96,8 +96,6 @@ SCSI::DeviceInfo::DeviceFile SCSI::DeviceVector::statDeviceFile(std::string path
*/
void SCSI::DeviceVector::getTapeInfo(DeviceInfo & devinfo) {
/* Find the st and nst devices for this SCSI device */
Tape::Utils::regex *st_re;
Tape::Utils::regex *nst_re;
DIR * dirp;
/* SLC6 default tapeDir and scsiPrefix */
std::string tapeDir="/scsi_tape"; /* The name of the tape dir inside of
......@@ -123,13 +121,13 @@ void SCSI::DeviceVector::getTapeInfo(DeviceInfo & devinfo) {
}
}
st_re = new Tape::Utils::regex((scsiPrefix+"(st[[:digit:]]+)$").c_str());
nst_re = new Tape::Utils::regex((scsiPrefix+"(nst[[:digit:]]+)$").c_str());
Tape::Utils::regex st_re((scsiPrefix+"(st[[:digit:]]+)$").c_str());
Tape::Utils::regex nst_re((scsiPrefix+"(nst[[:digit:]]+)$").c_str());
while (struct dirent * dent = m_sysWrapper.readdir(dirp)) {
std::vector<std::string> res;
/* Check if it's the st information */
res = st_re->exec(dent->d_name);
res = st_re.exec(dent->d_name);
if (res.size()) {
if (!devinfo.st_dev.size()) {
devinfo.st_dev = std::string("/dev/") + res[1];
......@@ -151,7 +149,7 @@ void SCSI::DeviceVector::getTapeInfo(DeviceInfo & devinfo) {
}
}
/* Check if it's the nst information */
res = nst_re->exec(dent->d_name);
res = nst_re.exec(dent->d_name);
if (res.size()) {
if (!devinfo.nst_dev.size()) {
devinfo.nst_dev = std::string("/dev/") + res[1];
......@@ -173,8 +171,6 @@ void SCSI::DeviceVector::getTapeInfo(DeviceInfo & devinfo) {
}
}
}
delete st_re;
delete nst_re;
m_sysWrapper.closedir(dirp);
}
......
......@@ -33,6 +33,27 @@ Group: Applications/File
%description -n tape-server-utils
The CERN tape server utilities
#######################################################################################
%package -n tape-server-docs
#######################################################################################
Summary: The CERN tape server documentation
Group: Applications/File
%description -n tape-server-docs
The CERN tape server documentation
#######################################################################################
%package -n tape-server-system-tests
#######################################################################################
Summary: The CERN tape server system tests
Group: Applications/File
Requires: kmod-st-driver
Requires: kmod-mhvtl-1.4.4
Requires: mhvtl-utils-1.4.4
%description -n tape-server-system-tests
The CERN tape server system tests. Those tests are potentially destructive and should be used with care.
%prep
%setup -n %{name}-%{version}-%{release}
......@@ -63,4 +84,17 @@ rm -rf $RPM_BUILD_ROOT
%files -n tape-server-utils
%defattr(-,root,root)
/usr/local/bin/*
/usr/local/bin/TapeDriveInfo
/usr/local/bin/unitTest
%files -n tape-server-docs
%defattr(-,root,root)
/usr/share/doc/*
%files -n tape-server-system-tests
%defattr(-,root,root)
/etc/*
/usr/local/bin/tape-server-system-test.sh
......@@ -15,4 +15,15 @@ target_link_libraries(unitTest TapeDrive Exception SCSI System Utils File ${GTES
install(TARGETS unitTest
RUNTIME DESTINATION bin)
install(FILES
SystemTest/device.conf
SystemTest/library_contents.10
SystemTest/library_contents.30
SystemTest/mhvtl.conf
DESTINATION /etc/mhvtl)
install(FILES
SystemTest/tape-server-system-test.sh
DESTINATION bin)
VERSION: 5
# VPD page format:
# <page #> <Length> <x> <x+1>... <x+n>
# NAA format is an 8 hex byte value seperated by ':'
# Note: NAA is part of inquiry VPD 0x83
#
# Each 'record' is separated by one (or more) blank lines.
# Each 'record' starts at column 1
# Serial num max len is 10.
# Compression: factor X enabled 0|1
# Where X is zlib compression factor 1 = Fastest compression
# 9 = Best compression
# enabled 0 == off, 1 == on
Library: 10 CHANNEL: 00 TARGET: 00 LUN: 00
Vendor identification: STK
Product identification: L700
Unit serial number: XYZZY_A
NAA: 10:22:33:44:ab:00:00:00
Drive: 11 CHANNEL: 00 TARGET: 01 LUN: 00
Library ID: 10 Slot: 01
Vendor identification: IBM
Product identification: ULT3580-TD5
Unit serial number: XYZZY_A1
NAA: 10:22:33:44:ab:00:01:00
Compression: factor 1 enabled 1
Drive: 12 CHANNEL: 00 TARGET: 02 LUN: 00
Library ID: 10 Slot: 02
Vendor identification: IBM
Product identification: ULT3580-TD5
Unit serial number: XYZZY_A2
NAA: 10:22:33:44:ab:00:02:00
Compression: factor 1 enabled 1
Drive: 13 CHANNEL: 00 TARGET: 03 LUN: 00
Library ID: 10 Slot: 03
Vendor identification: IBM
Product identification: ULT3580-TD4
Unit serial number: XYZZY_A3
NAA: 10:22:33:44:ab:00:03:00
Compression: factor 1 enabled 1
Drive: 14 CHANNEL: 00 TARGET: 04 LUN: 00
Library ID: 10 Slot: 04
Vendor identification: IBM
Product identification: ULT3580-TD4
Unit serial number: XYZZY_A4
NAA: 10:22:33:44:ab:00:04:00
Compression: factor 1 enabled 1
Library: 30 CHANNEL: 00 TARGET: 08 LUN: 00
Vendor identification: STK
Product identification: L80
Unit serial number: XYZZY_B
NAA: 30:22:33:44:ab:00:08:00
Drive: 31 CHANNEL: 00 TARGET: 09 LUN: 00
Library ID: 30 Slot: 01
Vendor identification: STK
Product identification: T10000B
Unit serial number: XYZZY_B1
NAA: 30:22:33:44:ab:00:09:00
Compression: factor 1 enabled 1
Drive: 32 CHANNEL: 00 TARGET: 10 LUN: 00
Library ID: 30 Slot: 02
Vendor identification: STK
Product identification: T10000B
Unit serial number: XYZZY_B2
NAA: 30:22:33:44:ab:00:10:00
Compression: factor 1 enabled 1
Drive: 33 CHANNEL: 00 TARGET: 11 LUN: 00
Library ID: 30 Slot: 03
Vendor identification: STK
Product identification: T10000B
Unit serial number: XYZZY_B3
NAA: 30:22:33:44:ab:00:11:00
Compression: factor 1 enabled 1
Drive: 34 CHANNEL: 00 TARGET: 12 LUN: 00
Library ID: 30 Slot: 04
Vendor identification: STK
Product identification: T10000B
Unit serial number: XYZZY_B4
NAA: 30:22:33:44:ab:00:12:00
Compression: factor 1 enabled 1
Drive 1:
Drive 2:
Drive 3:
Drive 4:
Picker 1:
MAP 1:
MAP 2:
MAP 3:
MAP 4:
# Slot 1 - ?, no gaps
# Slot N: [barcode]
# [barcode]
# a barcode is comprised of three fields: [Leading] [identifier] [Trailing]
# Leading "CLN" -- cleaning tape
# Leading "W" -- WORM tape
# Leading "NOBAR" -- will appear to have no barcode
# If the barcode is at least 8 character long, then the last two characters are Trailing
# Trailing "S3" - SDLT600
# Trailing "X4" - AIT-4
# Trailing "L1" - LTO 1, "L2" - LTO 2, "L3" - LTO 3, "L4" - LTO 4, "L5" - LTO 5
# Training "LT" - LTO 3 WORM, "LU" LTO 4 WORM, "LV" LTO 5 WORM
# Trailing "TA" - T10000+
# Trailing "JA" - 3592+
# Trailing "JB" - 3592E05+
# Trailing "JW" - WORM 3592+
# Trailing "JX" - WORM 3592E05+
#
Slot 1: E01001L4
Slot 2: E01002L4
Slot 3: E01003L4
Slot 4: E01004L4
Slot 5: E01005L4
Slot 6: E01006L4
Slot 7: E01007L4
Slot 8: E01008L4
Slot 9: E01009L4
Slot 10: E01010L4
Slot 11: E01011L4
Slot 12: E01012L4
Slot 13: E01013L4
Slot 14: E01014L4
Slot 15: E01015L4
Slot 16: E01016L4
Slot 17: E01017L4
Slot 18: E01018L4
Slot 19: E01019L4
Slot 20: E01020L4
Slot 21:
Slot 22: CLN101L4
Slot 23: CLN102L5
Slot 24:
Slot 25:
Slot 26:
Slot 27:
Slot 28:
Slot 29:
Slot 30: F01030L5
Slot 31: F01031L5
Slot 32: F01032L5
Slot 33: F01033L5
Slot 34: F01034L5
Slot 35: F01035L5
Slot 36: F01036L5
Slot 37: F01037L5
Slot 38: F01038L5
Slot 39: F01039L5
Drive 1:
Drive 2:
Drive 3:
Drive 4:
Picker 1:
MAP 1:
MAP 2:
MAP 3:
MAP 4:
# Slot 1 - ?, no gaps
# Slot N: [barcode]
# [barcode]
# a barcode is comprised of three fields: [Leading] [identifier] [Trailing]
# Leading "CLN" -- cleaning tape
# Leading "W" -- WORM tape
# Leading "NOBAR" -- will appear to have no barcode
# If the barcode is at least 8 character long, then the last two characters are Trailing
# Trailing "S3" - SDLT600
# Trailing "X4" - AIT-4
# Trailing "L1" - LTO 1, "L2" - LTO 2, "L3" - LTO 3, "L4" - LTO 4, "L5" - LTO 5
# Training "LT" - LTO 3 WORM, "LU" LTO 4 WORM, "LV" LTO 5 WORM
# Trailing "TA" - T10000+
# Trailing "JA" - 3592+
# Trailing "JB" - 3592E05+
# Trailing "JW" - WORM 3592+
# Trailing "JX" - WORM 3592E05+
#
Slot 1: G03001TA
Slot 2: G03002TA
Slot 3: G03003TA
Slot 4: G03004TA
Slot 5: G03005TA
Slot 6: G03006TA
Slot 7: G03007TA
Slot 8: G03008TA
Slot 9: G03009TA
Slot 10: G03010TA
Slot 11: G03011TA
Slot 12: G03012TA
Slot 13: G03013TA
Slot 14: G03014TA
Slot 15: G03015TA
Slot 16: G03016TA
Slot 17: G03017TA
Slot 18: G03018TA
Slot 19: G03019TA
Slot 20: G03020TA
Slot 21: G03021TA
Slot 22: G03022TA
Slot 23: G03023TA
Slot 24: G03024TA
Slot 25: G03025TA
Slot 26: G03026TA
Slot 27: G03027TA
Slot 28: G03028TA
Slot 29: G03029TA
Slot 30: G03030TA
Slot 31: G03031TA
Slot 32: G03032TA
Slot 33: G03033TA
Slot 34: G03034TA
Slot 35: G03035TA
Slot 36: G03036TA
Slot 37: G03037TA
Slot 38: G03038TA
Slot 39: G03039TA
Slot 40: CLN303TA
# Home directory for config file(s)
MHVTL_CONFIG_PATH=/etc/mhvtl
# Media capacity (20 M)
CAPACITY=20
# Set default verbosity [0|1|2|3]
VERBOSE=1
# Set kernel module debuging [0|1]
VTL_DEBUG=0
#!/bin/bash
echo "## Attempting to stop mhvtl"
service mhvtl stop
echo "## Remonving old mhvtl configuration"
rm -rf /etc/mhvtl
rm -rf /opt/mhvtl
echo "## Re-creting /opt/mhvtl"
mkdir /opt/mhvtl
chown vtl.vtl /opt/mhvtl
echo "## Populating mhvtl configuration"
mkdir /etc/mhvtl
cp /root/etc-mhvtl/{mhvtl.conf,library_contents.10,library_contents.30,device.conf} /etc/mhvtl
echo "## Starting mhvtl."
service mhvtl start
echo "## Waiting 5 seconds as the generic scsi devices do not appear instantly"
sleep 5
echo "## Mounting tapes"
# find the list of media changers. We expect 4 tape drives per library
echo -n "### Detecting media changers..."
SCSI_DEVS=`ls -d /sys/bus/scsi/devices/*`
# Media changer scsi type is "8"
MC_DEVS=`for i in ${SCSI_DEVS}; do if [ -e $i/type ] && grep -q 8 $i/type; then ls $i/scsi_generic; fi; done`
echo ${MC_DEVS}
for i in $MC_DEVS; do
mtx -f /dev/$i load 10 0
mtx -f /dev/$i load 1 1
mtx -f /dev/$i load 2 2
mtx -f /dev/$i load 3 3
mtx -f /dev/$i status | grep Transfer
done
echo "## Starting system test program"
/usr/local/bin/TapeDriveInfo
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