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
02f3509e
Commit
02f3509e
authored
Oct 21, 2015
by
Daniele Kruse
Browse files
Added the delete tape functionality to the OSDB
parent
fa35e7db
Changes
2
Hide whitespace changes
Inline
Side-by-side
objectstore/TapePool.cpp
View file @
02f3509e
...
...
@@ -129,6 +129,9 @@ void cta::objectstore::TapePool::removeTapeAndCommit(const std::string& vid) {
<<
vid
<<
" found: "
<<
t
.
getVid
();
throw
WrongTape
(
err
.
str
());
}
if
(
t
.
isEmpty
())
{
throw
exception
::
Exception
(
"Cannot delete the tape: it has queued retrieve jobs"
);
}
// We can now delete the tape
t
.
remove
();
// And remove it from our entry
...
...
scheduler/OStoreDB/OStoreDB.cpp
View file @
02f3509e
...
...
@@ -46,6 +46,7 @@
#include
<time.h>
/* time */
#include
<stdexcept>
#include
<set>
#include
<iostream>
namespace
cta
{
...
...
@@ -603,9 +604,29 @@ std::list<cta::Tape> OStoreDB::getTapes() const {
return
ret
;
}
void
OStoreDB
::
deleteTape
(
const
SecurityIdentity
&
requester
,
const
std
::
string
&
vid
)
{
throw
exception
::
Exception
(
"Not Implemented"
);
void
OStoreDB
::
deleteTape
(
const
SecurityIdentity
&
requester
,
const
std
::
string
&
vid
)
{
RootEntry
re
(
m_objectStore
);
ScopedExclusiveLock
rel
(
re
);
re
.
fetch
();
// Check we are not deleting a non-empty library
auto
tapePoolList
=
re
.
dumpTapePools
();
for
(
auto
tpi
=
tapePoolList
.
begin
();
tpi
!=
tapePoolList
.
end
();
tpi
++
)
{
objectstore
::
TapePool
tp
(
tpi
->
address
,
m_objectStore
);
ScopedExclusiveLock
tpl
(
tp
);
tp
.
fetch
();
// Check the tape pool is owned by the root entry. If not, it should be
// considered as a dangling pointer (and skip it)
if
(
tp
.
getOwner
()
!=
re
.
getAddressIfSet
())
continue
;
auto
tl
=
tp
.
dumpTapesAndFetchStatus
();
for
(
auto
ti
=
tl
.
begin
();
ti
!=
tl
.
end
();
ti
++
)
{
if
(
ti
->
vid
==
vid
)
{
tp
.
removeTapeAndCommit
(
vid
);
return
;
}
}
}
throw
exception
::
Exception
(
"Cannot delete the tape: it does not exist in any tape pool"
);
}
void
OStoreDB
::
createLogicalLibrary
(
const
std
::
string
&
name
,
...
...
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