Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
38c9a678
Commit
38c9a678
authored
May 28, 2019
by
Michael Davis
Browse files
Removes cta-admin shrink, test and verify commands
These commands are not implemented so I have removed them from the cta-admin interface.
parent
eb174c95
Changes
10
Hide whitespace changes
Inline
Side-by-side
catalogue/Catalogue.hpp
View file @
38c9a678
...
...
@@ -53,7 +53,6 @@
#include
"common/dataStructures/TapeFile.hpp"
#include
"common/dataStructures/UpdateFileInfoRequest.hpp"
#include
"common/dataStructures/UserIdentity.hpp"
#include
"common/dataStructures/VerifyInfo.hpp"
#include
"common/dataStructures/VidToTapeMap.hpp"
#include
"common/dataStructures/WriteTestResult.hpp"
#include
"common/exception/UserError.hpp"
...
...
cmdline/CtaAdminCmdParse.hpp
View file @
38c9a678
...
...
@@ -205,18 +205,12 @@ const cmdLookup_t cmdLookup = {
{
"rmr"
,
AdminCmd
::
CMD_REQUESTERMOUNTRULE
},
{
"showqueues"
,
AdminCmd
::
CMD_SHOWQUEUES
},
{
"sq"
,
AdminCmd
::
CMD_SHOWQUEUES
},
{
"shrink"
,
AdminCmd
::
CMD_SHRINK
},
{
"sh"
,
AdminCmd
::
CMD_SHRINK
},
{
"storageclass"
,
AdminCmd
::
CMD_STORAGECLASS
},
{
"sc"
,
AdminCmd
::
CMD_STORAGECLASS
},
{
"tape"
,
AdminCmd
::
CMD_TAPE
},
{
"ta"
,
AdminCmd
::
CMD_TAPE
},
{
"tapepool"
,
AdminCmd
::
CMD_TAPEPOOL
},
{
"tp"
,
AdminCmd
::
CMD_TAPEPOOL
},
{
"test"
,
AdminCmd
::
CMD_TEST
},
{
"te"
,
AdminCmd
::
CMD_TEST
},
{
"verify"
,
AdminCmd
::
CMD_VERIFY
},
{
"ve"
,
AdminCmd
::
CMD_VERIFY
}
};
...
...
@@ -236,9 +230,6 @@ const subcmdLookup_t subcmdLookup = {
{
"show"
,
AdminCmd
::
SUBCMD_SHOW
},
{
"up"
,
AdminCmd
::
SUBCMD_UP
},
{
"down"
,
AdminCmd
::
SUBCMD_DOWN
},
{
"read"
,
AdminCmd
::
SUBCMD_READ
},
{
"write"
,
AdminCmd
::
SUBCMD_WRITE
},
{
"write_auto"
,
AdminCmd
::
SUBCMD_WRITE_AUTO
}
};
...
...
@@ -351,16 +342,9 @@ const std::map<AdminCmd::Cmd, CmdHelp> cmdHelp = {
{
AdminCmd
::
CMD_REPACK
,
{
"repack"
,
"re"
,
{
"add"
,
"rm"
,
"ls"
,
"err"
}
}},
{
AdminCmd
::
CMD_REQUESTERMOUNTRULE
,
{
"requestermountrule"
,
"rmr"
,
{
"add"
,
"ch"
,
"rm"
,
"ls"
}
}},
{
AdminCmd
::
CMD_SHOWQUEUES
,
{
"showqueues"
,
"sq"
,
{
}
}},
{
AdminCmd
::
CMD_SHRINK
,
{
"shrink"
,
"sh"
,
{
}
}},
{
AdminCmd
::
CMD_STORAGECLASS
,
{
"storageclass"
,
"sc"
,
{
"add"
,
"ch"
,
"rm"
,
"ls"
}
}},
{
AdminCmd
::
CMD_TAPE
,
{
"tape"
,
"ta"
,
{
"add"
,
"ch"
,
"rm"
,
"reclaim"
,
"ls"
,
"label"
}
}},
{
AdminCmd
::
CMD_TAPEPOOL
,
{
"tapepool"
,
"tp"
,
{
"add"
,
"ch"
,
"rm"
,
"ls"
}
}},
{
AdminCmd
::
CMD_TEST
,
{
"test"
,
"te"
,
{
"read"
,
"write"
,
"write_auto"
},
"
\n
This is a synchronous command that returns performance stats and errors.
\n
"
" It should be run on an empty self-dedicated drive. All locations are local
\n
"
" to the tapeserver.
\n\n
"
}},
{
AdminCmd
::
CMD_VERIFY
,
{
"verify"
,
"ve"
,
{
"add"
,
"rm"
,
"ls"
,
"err"
}
}}
};
...
...
@@ -513,8 +497,6 @@ const std::map<cmd_key_t, cmd_val_t> cmdOptions = {
{{
AdminCmd
::
CMD_REQUESTERMOUNTRULE
,
AdminCmd
::
SUBCMD_RM
},
{
opt_instance
,
opt_username_alias
}},
{{
AdminCmd
::
CMD_REQUESTERMOUNTRULE
,
AdminCmd
::
SUBCMD_LS
},
{
opt_header
.
optional
()
}},
/*----------------------------------------------------------------------------------------------------*/
{{
AdminCmd
::
CMD_SHRINK
,
AdminCmd
::
SUBCMD_NONE
},
{
opt_tapepool
}},
/*----------------------------------------------------------------------------------------------------*/
{{
AdminCmd
::
CMD_SHOWQUEUES
,
AdminCmd
::
SUBCMD_NONE
},
{
opt_header
.
optional
()
}},
/*----------------------------------------------------------------------------------------------------*/
{{
AdminCmd
::
CMD_STORAGECLASS
,
AdminCmd
::
SUBCMD_ADD
},
...
...
@@ -546,19 +528,6 @@ const std::map<cmd_key_t, cmd_val_t> cmdOptions = {
{
opt_tapepool_alias
,
opt_vo
.
optional
(),
opt_partialtapes
.
optional
(),
opt_encrypted
.
optional
(),
opt_comment
.
optional
()
}},
{{
AdminCmd
::
CMD_TAPEPOOL
,
AdminCmd
::
SUBCMD_RM
},
{
opt_tapepool_alias
}},
{{
AdminCmd
::
CMD_TAPEPOOL
,
AdminCmd
::
SUBCMD_LS
},
{
opt_header
.
optional
()
}},
/*----------------------------------------------------------------------------------------------------*/
{{
AdminCmd
::
CMD_TEST
,
AdminCmd
::
SUBCMD_READ
},
{
opt_drivename
,
opt_vid
,
opt_firstfseq
,
opt_lastfseq
,
opt_checkchecksum
,
opt_output
}},
{{
AdminCmd
::
CMD_TEST
,
AdminCmd
::
SUBCMD_WRITE
},
{
opt_drivename
,
opt_vid
,
opt_filename
}},
{{
AdminCmd
::
CMD_TEST
,
AdminCmd
::
SUBCMD_WRITE_AUTO
},
{
opt_drivename
,
opt_vid
,
opt_number_of_files_alias
,
opt_size
,
opt_input
}},
/*----------------------------------------------------------------------------------------------------*/
{{
AdminCmd
::
CMD_VERIFY
,
AdminCmd
::
SUBCMD_ADD
},
{
opt_vid
,
opt_number_of_files
.
optional
()
}},
{{
AdminCmd
::
CMD_VERIFY
,
AdminCmd
::
SUBCMD_RM
},
{
opt_vid
}},
{{
AdminCmd
::
CMD_VERIFY
,
AdminCmd
::
SUBCMD_LS
},
{
opt_header
.
optional
(),
opt_vid
.
optional
()
}},
{{
AdminCmd
::
CMD_VERIFY
,
AdminCmd
::
SUBCMD_ERR
},
{
opt_vid
}},
};
...
...
common/CMakeLists.txt
View file @
38c9a678
...
...
@@ -66,7 +66,6 @@ set (COMMON_LIB_SRC_FILES
dataStructures/UpdateFileInfoRequest.cpp
dataStructures/UpdateFileStorageClassRequest.cpp
dataStructures/UserIdentity.cpp
dataStructures/VerifyInfo.cpp
dataStructures/WriteTestResult.cpp
dataStructures/utils.cpp
checksum/Checksum.cpp
...
...
common/dataStructures/VerifyInfo.cpp
deleted
100644 → 0
View file @
eb174c95
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* 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/>.
*/
#include
"common/dataStructures/VerifyInfo.hpp"
#include
"common/dataStructures/utils.hpp"
#include
"common/exception/Exception.hpp"
namespace
cta
{
namespace
common
{
namespace
dataStructures
{
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
VerifyInfo
::
VerifyInfo
()
:
totalFiles
(
0
),
totalSize
(
0
),
filesToVerify
(
0
),
filesFailed
(
0
),
filesVerified
(
0
)
{}
//------------------------------------------------------------------------------
// operator==
//------------------------------------------------------------------------------
bool
VerifyInfo
::
operator
==
(
const
VerifyInfo
&
rhs
)
const
{
return
vid
==
rhs
.
vid
&&
tag
==
rhs
.
tag
&&
totalFiles
==
rhs
.
totalFiles
&&
totalSize
==
rhs
.
totalSize
&&
filesToVerify
==
rhs
.
filesToVerify
&&
filesFailed
==
rhs
.
filesFailed
&&
filesVerified
==
rhs
.
filesVerified
&&
verifyStatus
==
rhs
.
verifyStatus
&&
creationLog
==
rhs
.
creationLog
&&
errors
==
rhs
.
errors
;
}
//------------------------------------------------------------------------------
// operator!=
//------------------------------------------------------------------------------
bool
VerifyInfo
::
operator
!=
(
const
VerifyInfo
&
rhs
)
const
{
return
!
operator
==
(
rhs
);
}
//------------------------------------------------------------------------------
// operator<<
//------------------------------------------------------------------------------
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
VerifyInfo
&
obj
)
{
os
<<
"(vid="
<<
obj
.
vid
<<
" tag="
<<
obj
.
tag
<<
" totalFiles="
<<
obj
.
totalFiles
<<
" totalSize="
<<
obj
.
totalSize
<<
" filesToVerify="
<<
obj
.
filesToVerify
<<
" filesFailed="
<<
obj
.
filesFailed
<<
" filesVerified="
<<
obj
.
filesVerified
<<
" verifyStatus="
<<
obj
.
verifyStatus
<<
" creationLog="
<<
obj
.
creationLog
<<
" errors="
<<
obj
.
errors
<<
")"
;
return
os
;
}
}
// namespace dataStructures
}
// namespace common
}
// namespace cta
common/dataStructures/VerifyInfo.hpp
deleted
100644 → 0
View file @
eb174c95
/*
* The CERN Tape Archive (CTA) project
* Copyright (C) 2015 CERN
*
* 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/>.
*/
#pragma once
#include
<list>
#include
<map>
#include
<stdint.h>
#include
<string>
#include
"common/dataStructures/EntryLog.hpp"
namespace
cta
{
namespace
common
{
namespace
dataStructures
{
/**
* This struct holds the information of a verify operation on a given tape
*/
struct
VerifyInfo
{
VerifyInfo
();
bool
operator
==
(
const
VerifyInfo
&
rhs
)
const
;
bool
operator
!=
(
const
VerifyInfo
&
rhs
)
const
;
std
::
string
vid
;
std
::
string
tag
;
uint64_t
totalFiles
;
uint64_t
totalSize
;
uint64_t
filesToVerify
;
uint64_t
filesFailed
;
uint64_t
filesVerified
;
std
::
string
verifyStatus
;
EntryLog
creationLog
;
std
::
map
<
uint64_t
,
std
::
string
>
errors
;
};
// struct VerifyInfo
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
VerifyInfo
&
obj
);
}
// namespace dataStructures
}
// namespace common
}
// namespace cta
scheduler/Scheduler.cpp
View file @
38c9a678
...
...
@@ -549,66 +549,6 @@ void Scheduler::RepackReportBatch::report(log::LogContext& lc) {
}
}
//------------------------------------------------------------------------------
// shrink
//------------------------------------------------------------------------------
void
Scheduler
::
shrink
(
const
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
,
const
std
::
string
&
tapepool
)
{
throw
exception
::
Exception
(
std
::
string
(
"Not implemented: "
)
+
__PRETTY_FUNCTION__
);
}
//------------------------------------------------------------------------------
// verify
//------------------------------------------------------------------------------
void
Scheduler
::
queueVerify
(
const
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
,
const
std
::
string
&
vid
,
const
optional
<
uint64_t
>
numberOfFiles
)
{
throw
exception
::
Exception
(
std
::
string
(
"Not implemented: "
)
+
__PRETTY_FUNCTION__
);
}
//------------------------------------------------------------------------------
// cancelVerify
//------------------------------------------------------------------------------
void
Scheduler
::
cancelVerify
(
const
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
,
const
std
::
string
&
vid
)
{
throw
exception
::
Exception
(
std
::
string
(
"Not implemented: "
)
+
__PRETTY_FUNCTION__
);
}
//------------------------------------------------------------------------------
// getVerifys
//------------------------------------------------------------------------------
std
::
list
<
common
::
dataStructures
::
VerifyInfo
>
Scheduler
::
getVerifys
(
const
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
)
const
{
return
std
::
list
<
common
::
dataStructures
::
VerifyInfo
>
();
}
//------------------------------------------------------------------------------
// getVerify
//------------------------------------------------------------------------------
common
::
dataStructures
::
VerifyInfo
Scheduler
::
getVerify
(
const
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
,
const
std
::
string
&
vid
)
const
{
throw
exception
::
Exception
(
std
::
string
(
"Not implemented: "
)
+
__PRETTY_FUNCTION__
);
}
//------------------------------------------------------------------------------
// readTest
//------------------------------------------------------------------------------
common
::
dataStructures
::
ReadTestResult
Scheduler
::
readTest
(
const
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
,
const
std
::
string
&
driveName
,
const
std
::
string
&
vid
,
const
uint64_t
firstFSeq
,
const
uint64_t
lastFSeq
,
const
bool
checkChecksum
,
const
std
::
string
&
output
)
const
{
throw
exception
::
Exception
(
std
::
string
(
"Not implemented: "
)
+
__PRETTY_FUNCTION__
);
}
//------------------------------------------------------------------------------
// writeTest
//------------------------------------------------------------------------------
common
::
dataStructures
::
WriteTestResult
Scheduler
::
writeTest
(
const
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
,
const
std
::
string
&
driveName
,
const
std
::
string
&
vid
,
const
std
::
string
&
inputFile
)
const
{
throw
exception
::
Exception
(
std
::
string
(
"Not implemented: "
)
+
__PRETTY_FUNCTION__
);
}
//------------------------------------------------------------------------------
// write_autoTest
//------------------------------------------------------------------------------
common
::
dataStructures
::
WriteTestResult
Scheduler
::
write_autoTest
(
const
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
,
const
std
::
string
&
driveName
,
const
std
::
string
&
vid
,
const
uint64_t
numberOfFiles
,
const
uint64_t
fileSize
,
const
common
::
dataStructures
::
TestSourceType
testSourceType
)
const
{
throw
exception
::
Exception
(
std
::
string
(
"Not implemented: "
)
+
__PRETTY_FUNCTION__
);
}
//------------------------------------------------------------------------------
// getDesiredDriveState
//------------------------------------------------------------------------------
...
...
scheduler/Scheduler.hpp
View file @
38c9a678
...
...
@@ -37,7 +37,6 @@
#include
"common/dataStructures/TestSourceType.hpp"
#include
"common/dataStructures/UpdateFileInfoRequest.hpp"
#include
"common/dataStructures/UpdateFileStorageClassRequest.hpp"
#include
"common/dataStructures/VerifyInfo.hpp"
#include
"common/dataStructures/WriteTestResult.hpp"
#include
"common/dataStructures/QueueAndMountSummary.hpp"
#include
"common/Timer.hpp"
...
...
@@ -206,31 +205,6 @@ public:
std
::
list
<
cta
::
common
::
dataStructures
::
RepackInfo
>
getRepacks
();
cta
::
common
::
dataStructures
::
RepackInfo
getRepack
(
const
std
::
string
&
vid
);
void
shrink
(
const
cta
::
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
,
const
std
::
string
&
tapepool
);
// removes extra tape copies from a specific pool(usually an "_2" pool)
void
queueVerify
(
const
cta
::
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
,
const
std
::
string
&
vid
,
const
optional
<
uint64_t
>
numberOfFiles
);
//if numberOfFiles is nullopt, all files are verified
void
cancelVerify
(
const
cta
::
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
,
const
std
::
string
&
vid
);
std
::
list
<
cta
::
common
::
dataStructures
::
VerifyInfo
>
getVerifys
(
const
cta
::
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
)
const
;
cta
::
common
::
dataStructures
::
VerifyInfo
getVerify
(
const
cta
::
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
,
const
std
::
string
&
vid
)
const
;
cta
::
common
::
dataStructures
::
ReadTestResult
readTest
(
const
cta
::
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
,
const
std
::
string
&
driveName
,
const
std
::
string
&
vid
,
const
uint64_t
firstFSeq
,
const
uint64_t
lastFSeq
,
const
bool
checkChecksum
,
const
std
::
string
&
output
)
const
;
//when output=="null" discard the data read
cta
::
common
::
dataStructures
::
WriteTestResult
writeTest
(
const
cta
::
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
,
const
std
::
string
&
driveName
,
const
std
::
string
&
vid
,
const
std
::
string
&
inputFile
)
const
;
cta
::
common
::
dataStructures
::
WriteTestResult
write_autoTest
(
const
cta
::
common
::
dataStructures
::
SecurityIdentity
&
cliIdentity
,
const
std
::
string
&
driveName
,
const
std
::
string
&
vid
,
const
uint64_t
numberOfFiles
,
const
uint64_t
fileSize
,
const
cta
::
common
::
dataStructures
::
TestSourceType
testSourceType
)
const
;
std
::
map
<
std
::
string
,
std
::
list
<
cta
::
common
::
dataStructures
::
ArchiveJob
>
>
getPendingArchiveJobs
(
log
::
LogContext
&
lc
)
const
;
std
::
list
<
cta
::
common
::
dataStructures
::
ArchiveJob
>
getPendingArchiveJobs
(
const
std
::
string
&
tapePoolName
,
log
::
LogContext
&
lc
)
const
;
std
::
map
<
std
::
string
,
std
::
list
<
cta
::
common
::
dataStructures
::
RetrieveJob
>
>
getPendingRetrieveJobs
(
log
::
LogContext
&
lc
)
const
;
...
...
xroot_plugins/XrdSsiCtaRequestMessage.cpp
View file @
38c9a678
...
...
@@ -210,9 +210,6 @@ void RequestMessage::process(const cta::xrd::Request &request, cta::xrd::Respons
case
cmd_pair
(
AdminCmd
::
CMD_REQUESTERMOUNTRULE
,
AdminCmd
::
SUBCMD_LS
):
processRequesterMountRule_Ls
(
request
.
admincmd
(),
response
);
break
;
case
cmd_pair
(
AdminCmd
::
CMD_SHRINK
,
AdminCmd
::
SUBCMD_NONE
):
processShrink
(
request
.
admincmd
(),
response
);
break
;
case
cmd_pair
(
AdminCmd
::
CMD_SHOWQUEUES
,
AdminCmd
::
SUBCMD_NONE
):
processShowQueues
(
request
.
admincmd
(),
response
);
break
;
...
...
@@ -259,27 +256,6 @@ void RequestMessage::process(const cta::xrd::Request &request, cta::xrd::Respons
case
cmd_pair
(
AdminCmd
::
CMD_TAPEPOOL
,
AdminCmd
::
SUBCMD_LS
):
processTapePool_Ls
(
request
.
admincmd
(),
response
,
stream
);
break
;
case
cmd_pair
(
AdminCmd
::
CMD_TEST
,
AdminCmd
::
SUBCMD_READ
):
processTest_Read
(
request
.
admincmd
(),
response
);
break
;
case
cmd_pair
(
AdminCmd
::
CMD_TEST
,
AdminCmd
::
SUBCMD_WRITE
):
processTest_Write
(
request
.
admincmd
(),
response
);
break
;
case
cmd_pair
(
AdminCmd
::
CMD_TEST
,
AdminCmd
::
SUBCMD_WRITE_AUTO
):
processTest_WriteAuto
(
request
.
admincmd
(),
response
);
break
;
case
cmd_pair
(
AdminCmd
::
CMD_VERIFY
,
AdminCmd
::
SUBCMD_ADD
):
processVerify_Add
(
request
.
admincmd
(),
response
);
break
;
case
cmd_pair
(
AdminCmd
::
CMD_VERIFY
,
AdminCmd
::
SUBCMD_RM
):
processVerify_Rm
(
request
.
admincmd
(),
response
);
break
;
case
cmd_pair
(
AdminCmd
::
CMD_VERIFY
,
AdminCmd
::
SUBCMD_LS
):
processVerify_Ls
(
request
.
admincmd
(),
response
);
break
;
case
cmd_pair
(
AdminCmd
::
CMD_VERIFY
,
AdminCmd
::
SUBCMD_ERR
):
processVerify_Err
(
request
.
admincmd
(),
response
);
break
;
default:
throw
PbException
(
"Admin command pair <"
+
...
...
@@ -1601,19 +1577,6 @@ void RequestMessage::processRequesterMountRule_Ls(const cta::admin::AdminCmd &ad
void
RequestMessage
::
processShrink
(
const
cta
::
admin
::
AdminCmd
&
admincmd
,
cta
::
xrd
::
Response
&
response
)
{
using
namespace
cta
::
admin
;
auto
&
tapepool
=
getRequired
(
OptionString
::
TAPE_POOL
);
m_scheduler
.
shrink
(
m_cliIdentity
,
tapepool
);
response
.
set_type
(
cta
::
xrd
::
Response
::
RSP_SUCCESS
);
}
void
RequestMessage
::
processShowQueues
(
const
cta
::
admin
::
AdminCmd
&
admincmd
,
cta
::
xrd
::
Response
&
response
)
{
using
namespace
cta
::
admin
;
...
...
@@ -2113,269 +2076,6 @@ void RequestMessage::processTapePool_Ls(const cta::admin::AdminCmd &admincmd, ct
void
RequestMessage
::
processTest_Read
(
const
cta
::
admin
::
AdminCmd
&
admincmd
,
cta
::
xrd
::
Response
&
response
)
{
using
namespace
cta
::
admin
;
std
::
stringstream
cmdlineOutput
;
auto
&
drive
=
getRequired
(
OptionString
::
DRIVE
);
auto
&
vid
=
getRequired
(
OptionString
::
VID
);
auto
&
output
=
getRequired
(
OptionString
::
OUTPUT
);
auto
&
firstfseq
=
getRequired
(
OptionUInt64
::
FIRST_FSEQ
);
auto
&
lastfseq
=
getRequired
(
OptionUInt64
::
LAST_FSEQ
);
bool
checkchecksum
=
has_flag
(
OptionBoolean
::
CHECK_CHECKSUM
);
cta
::
common
::
dataStructures
::
ReadTestResult
res
=
m_scheduler
.
readTest
(
m_cliIdentity
,
drive
,
vid
,
firstfseq
,
lastfseq
,
checkchecksum
,
output
);
std
::
vector
<
std
::
vector
<
std
::
string
>>
responseTable
;
std
::
vector
<
std
::
string
>
header
=
{
"fseq"
,
"checksum type"
,
"checksum value"
,
"error"
};
responseTable
.
push_back
(
header
);
for
(
auto
it
=
res
.
checksums
.
cbegin
();
it
!=
res
.
checksums
.
cend
();
it
++
)
{
std
::
vector
<
std
::
string
>
currentRow
;
currentRow
.
push_back
(
std
::
to_string
(
static_cast
<
unsigned
long
long
>
(
it
->
first
)));
currentRow
.
push_back
(
it
->
second
.
first
);
currentRow
.
push_back
(
it
->
second
.
second
);
if
(
res
.
errors
.
find
(
it
->
first
)
!=
res
.
errors
.
cend
())
{
currentRow
.
push_back
(
res
.
errors
.
at
(
it
->
first
));
}
else
{
currentRow
.
push_back
(
"-"
);
}
responseTable
.
push_back
(
currentRow
);
}
m_option_bool
[
OptionBoolean
::
SHOW_HEADER
]
=
true
;
cmdlineOutput
<<
formatResponse
(
responseTable
)
<<
std
::
endl
<<
"Drive: "
<<
res
.
driveName
<<
" Vid: "
<<
res
.
vid
<<
" #Files: "
<<
res
.
totalFilesRead
<<
" #Bytes: "
<<
res
.
totalBytesRead
<<
" Time: "
<<
res
.
totalTimeInSeconds
<<
" s"
<<
" Speed(avg): "
<<
static_cast
<
long
double
>
(
res
.
totalBytesRead
)
/
static_cast
<
long
double
>
(
res
.
totalTimeInSeconds
)
<<
" B/s"
<<
std
::
endl
;
response
.
set_message_txt
(
cmdlineOutput
.
str
());
response
.
set_type
(
cta
::
xrd
::
Response
::
RSP_SUCCESS
);
}
void
RequestMessage
::
processTest_Write
(
const
cta
::
admin
::
AdminCmd
&
admincmd
,
cta
::
xrd
::
Response
&
response
)
{
using
namespace
cta
::
admin
;
std
::
stringstream
cmdlineOutput
;
auto
&
drive
=
getRequired
(
OptionString
::
DRIVE
);
auto
&
vid
=
getRequired
(
OptionString
::
VID
);
auto
&
file
=
getRequired
(
OptionString
::
FILENAME
);
cta
::
common
::
dataStructures
::
WriteTestResult
res
=
m_scheduler
.
writeTest
(
m_cliIdentity
,
drive
,
vid
,
file
);
std
::
vector
<
std
::
vector
<
std
::
string
>>
responseTable
;
std
::
vector
<
std
::
string
>
header
=
{
"fseq"
,
"checksum type"
,
"checksum value"
,
"error"
};
responseTable
.
push_back
(
header
);
for
(
auto
it
=
res
.
checksums
.
cbegin
();
it
!=
res
.
checksums
.
cend
();
it
++
)
{
std
::
vector
<
std
::
string
>
currentRow
;
currentRow
.
push_back
(
std
::
to_string
(
static_cast
<
unsigned
long
long
>
(
it
->
first
)));
currentRow
.
push_back
(
it
->
second
.
first
);
currentRow
.
push_back
(
it
->
second
.
second
);
if
(
res
.
errors
.
find
(
it
->
first
)
!=
res
.
errors
.
cend
())
{
currentRow
.
push_back
(
res
.
errors
.
at
(
it
->
first
));
}
else
{
currentRow
.
push_back
(
"-"
);
}
responseTable
.
push_back
(
currentRow
);
}
m_option_bool
[
OptionBoolean
::
SHOW_HEADER
]
=
true
;
cmdlineOutput
<<
formatResponse
(
responseTable
)
<<
std
::
endl
<<
"Drive: "
<<
res
.
driveName
<<
" Vid: "
<<
res
.
vid
<<
" #Files: "
<<
res
.
totalFilesWritten
<<
" #Bytes: "
<<
res
.
totalBytesWritten
<<
" Time: "
<<
res
.
totalTimeInSeconds
<<
" s"
<<
" Speed(avg): "
<<
static_cast
<
long
double
>
(
res
.
totalBytesWritten
)
/
static_cast
<
long
double
>
(
res
.
totalTimeInSeconds
)
<<
" B/s"
<<
std
::
endl
;
response
.
set_message_txt
(
cmdlineOutput
.
str
());
response
.
set_message_txt
(
cmdlineOutput
.
str
());
response
.
set_type
(
cta
::
xrd
::
Response
::
RSP_SUCCESS
);
}
void
RequestMessage
::
processTest_WriteAuto
(
const
cta
::
admin
::
AdminCmd
&
admincmd
,
cta
::
xrd
::
Response
&
response
)
{
using
namespace
cta
::
admin
;
std
::
stringstream
cmdlineOutput
;
auto
&
drive
=
getRequired
(
OptionString
::
DRIVE
);
auto
&
vid
=
getRequired
(
OptionString
::
VID
);
auto
&
number
=
getRequired
(
OptionUInt64
::
NUMBER_OF_FILES
);
auto
&
size
=
getRequired
(
OptionUInt64
::
FILE_SIZE
);
auto
&
input
=
getRequired
(
OptionString
::
INPUT
);
cta
::
common
::
dataStructures
::
TestSourceType
type
;
if
(
input
==
"zero"
)
{
type
=
cta
::
common
::
dataStructures
::
TestSourceType
::
devzero
;
}
else
if
(
input
==
"urandom"
)
{
type
=
cta
::
common
::
dataStructures
::
TestSourceType
::
devurandom
;
}
else
{
throw
cta
::
exception
::
UserError
(
"--input value must be either
\"
zero
\"
or
\"
urandom
\"
"
);
}
cta
::
common
::
dataStructures
::
WriteTestResult
res
=
m_scheduler
.
write_autoTest
(
m_cliIdentity
,
drive
,
vid
,
number
,
size
,
type
);
std
::
vector
<
std
::
vector
<
std
::
string
>>
responseTable
;
std
::
vector
<
std
::
string
>
header
=
{
"fseq"
,
"checksum type"
,
"checksum value"
,
"error"
};
responseTable
.
push_back
(
header
);
for
(
auto
it
=
res
.
checksums
.
cbegin
();
it
!=
res
.
checksums
.
cend
();
it
++
)
{
std
::
vector
<
std
::
string
>
currentRow
;
currentRow
.
push_back
(
std
::
to_string
(
static_cast
<
unsigned
long
long
>
(
it
->
first
)));
currentRow
.
push_back
(
it
->
second
.
first
);
currentRow
.
push_back
(
it
->
second
.
second
);
if
(
res
.
errors
.
find
(
it
->
first
)
!=
res
.
errors
.
cend
())
{
currentRow
.
push_back
(
res
.
errors
.
at
(
it
->
first
));
}
else
{
currentRow
.
push_back
(
"-"
);
}
responseTable
.
push_back
(
currentRow
);
}
m_option_bool
[
OptionBoolean
::
SHOW_HEADER
]
=
true
;
cmdlineOutput
<<
formatResponse
(
responseTable
)
<<
std
::
endl
<<
"Drive: "
<<
res
.
driveName
<<
" Vid: "
<<
res
.
vid
<<
" #Files: "
<<
res
.
totalFilesWritten
<<
" #Bytes: "
<<
res
.
totalBytesWritten
<<
" Time: "
<<
res
.
totalTimeInSeconds
<<
" s"
<<
" Speed(avg): "
<<
static_cast
<
long
double
>
(
res
.
totalBytesWritten
)
/
static_cast
<
long
double
>
(
res
.
totalTimeInSeconds
)
<<
" B/s"
<<
std
::
endl
;
response
.
set_message_txt
(
cmdlineOutput
.
str
());
response
.
set_type
(
cta
::
xrd
::
Response
::
RSP_SUCCESS
);
}
void
RequestMessage
::
processVerify_Add
(
const
cta
::
admin
::
AdminCmd
&
admincmd
,
cta
::
xrd
::
Response
&
response
)
{
using
namespace
cta
::
admin
;
auto
&
vid
=
getRequired
(
OptionString
::
VID
);
auto
number
=
getOptional
(
OptionUInt64
::
NUMBER_OF_FILES
);
m_scheduler
.
queueVerify
(
m_cliIdentity
,
vid
,
number
);
response
.
set_type
(
cta
::
xrd
::
Response
::
RSP_SUCCESS
);
}
void
RequestMessage
::
processVerify_Rm
(
const
cta
::
admin
::
AdminCmd
&
admincmd
,
cta
::
xrd
::
Response
&
response
)
{
using
namespace
cta
::
admin
;
auto
&
vid
=
getRequired
(
OptionString
::
VID
);
m_scheduler
.
cancelVerify
(
m_cliIdentity
,
vid
);
response
.
set_type
(
cta
::
xrd
::
Response
::
RSP_SUCCESS
);