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
139bf3c1
Commit
139bf3c1
authored
Feb 16, 2021
by
Steven Murray
Browse files
cta/CTA#966 Unable to distinguish empty and wrong tape pool
Fixed.
parent
c6fcbe89
Changes
3
Hide whitespace changes
Inline
Side-by-side
catalogue/Catalogue.hpp
View file @
139bf3c1
...
...
@@ -91,6 +91,7 @@ CTA_GENERATE_USER_EXCEPTION_CLASS(UserSpecifiedANonEmptyLogicalLibrary);
CTA_GENERATE_USER_EXCEPTION_CLASS
(
UserSpecifiedANonEmptyTape
);
CTA_GENERATE_USER_EXCEPTION_CLASS
(
UserSpecifiedANonExistentLogicalLibrary
);
CTA_GENERATE_USER_EXCEPTION_CLASS
(
UserSpecifiedANonExistentTape
);
CTA_GENERATE_USER_EXCEPTION_CLASS
(
UserSpecifiedANonExistentTapePool
);
CTA_GENERATE_USER_EXCEPTION_CLASS
(
UserSpecifiedAnEmptyStringComment
);
CTA_GENERATE_USER_EXCEPTION_CLASS
(
UserSpecifiedAnEmptyStringDiskSystemName
);
CTA_GENERATE_USER_EXCEPTION_CLASS
(
UserSpecifiedAnEmptyStringFileRegexp
);
...
...
@@ -580,6 +581,8 @@ public:
*
* @param searchCriteria The search criteria.
* @return The list of tapes.
* @throw UserSpecifiedANonExistentTapePool if the user specified a
* non-existent tape pool.
*/
virtual
std
::
list
<
common
::
dataStructures
::
Tape
>
getTapes
(
const
TapeSearchCriteria
&
searchCriteria
=
TapeSearchCriteria
())
const
=
0
;
...
...
catalogue/CatalogueTest.cpp
View file @
139bf3c1
...
...
@@ -1136,6 +1136,28 @@ TEST_P(cta_catalogue_CatalogueTest, deleteMediaType_usedByTapes) {
ASSERT_THROW(m_catalogue->deleteMediaType(m_tape1.mediaType), exception::UserError);
}
TEST_P(cta_catalogue_CatalogueTest, getTapes_non_existent_tape_pool) {
using namespace cta;
log::LogContext dummyLc(m_dummyLog);
const bool logicalLibraryIsDisabled = false;
const uint64_t nbPartialTapes = 2;
const bool isEncrypted = true;
const cta::optional<std::string> supply("value for the supply pool mechanism");
m_catalogue->createMediaType(m_admin, m_mediaType);
m_catalogue->createLogicalLibrary(m_admin, m_tape1.logicalLibraryName, logicalLibraryIsDisabled, "Create logical library");
m_catalogue->createVirtualOrganization(m_admin, m_vo);
m_catalogue->createTapePool(m_admin, m_tape1.tapePoolName, m_vo.name, nbPartialTapes, isEncrypted, supply, "Create tape pool");
m_catalogue->createTape(m_admin, m_tape1);
{
cta::catalogue::TapeSearchCriteria criteria;
criteria.tapePool = "non_existent";
ASSERT_THROW(m_catalogue->getTapes(criteria), catalogue::UserSpecifiedANonExistentTapePool);
}
}
TEST_P(cta_catalogue_CatalogueTest, createTape_deleteStorageClass) {
// TO BE DONE
}
...
...
catalogue/RdbmsCatalogue.cpp
View file @
139bf3c1
...
...
@@ -3667,6 +3667,12 @@ std::list<common::dataStructures::Tape> RdbmsCatalogue::getTapes(rdbms::Conn &co
if
(
isSetAndEmpty
(
searchCriteria
.
diskFileIds
))
throw
exception
::
UserError
(
"Disk file ID list cannot be empty"
);
try
{
if
(
searchCriteria
.
tapePool
&&
!
tapePoolExists
(
conn
,
searchCriteria
.
tapePool
.
value
()))
{
UserSpecifiedANonExistentTapePool
ex
;
ex
.
getMessage
()
<<
"Cannot list tapes because tape pool "
+
searchCriteria
.
tapePool
.
value
()
+
" does not exist"
;
throw
ex
;
}
std
::
list
<
common
::
dataStructures
::
Tape
>
tapes
;
std
::
string
sql
=
"SELECT "
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment