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
a79c1c75
Commit
a79c1c75
authored
Dec 16, 2014
by
Daniele Kruse
Browse files
Made the write-protection error a user error (drive stays up and no exception is generated)
parent
84c29e4e
Changes
2
Hide whitespace changes
Inline
Side-by-side
castor/tape/tapeserver/daemon/LabelSession.cpp
View file @
a79c1c75
...
...
@@ -110,22 +110,25 @@ castor::tape::tapeserver::daemon::Session::EndOfSessionAction
drive
::
DriveInterface
&
drive
=
*
drivePtr
.
get
();
waitUntilTapeLoaded
(
drive
,
60
);
// 60 = 60 seconds
checkTapeIsWritable
(
drive
);
rewindDrive
(
drive
);
// If the user is trying to label a non-empty tape without the force option
if
(
!
m_force
&&
!
drive
.
isTapeBlank
())
{
const
std
::
string
message
=
"Cannot label a non-empty tape without the"
" force option"
;
if
(
drive
.
isWriteProtected
())
{
const
std
::
string
message
=
"Cannot label the tape because the drive is write-protected"
;
notifyTapeserverOfUserError
(
message
);
// Else the labeling can go ahead
}
else
{
writeLabelToTape
(
drive
);
}
else
{
rewindDrive
(
drive
);
// If the user is trying to label a non-empty tape without the force option
if
(
!
m_force
&&
!
drive
.
isTapeBlank
())
{
const
std
::
string
message
=
"Cannot label a non-empty tape without the"
" force option"
;
notifyTapeserverOfUserError
(
message
);
// Else the labeling can go ahead
}
else
{
writeLabelToTape
(
drive
);
}
}
unloadTape
(
m_request
.
vid
,
drive
);
dismountTape
(
m_request
.
vid
);
...
...
@@ -220,27 +223,6 @@ void castor::tape::tapeserver::daemon::LabelSession::waitUntilTapeLoaded(
}
}
//------------------------------------------------------------------------------
// checkTapeIsWritable
//------------------------------------------------------------------------------
void
castor
::
tape
::
tapeserver
::
daemon
::
LabelSession
::
checkTapeIsWritable
(
drive
::
DriveInterface
&
drive
)
{
std
::
list
<
log
::
Param
>
params
;
params
.
push_back
(
log
::
Param
(
"uid"
,
m_request
.
uid
));
params
.
push_back
(
log
::
Param
(
"gid"
,
m_request
.
gid
));
params
.
push_back
(
log
::
Param
(
"TPVID"
,
m_request
.
vid
));
params
.
push_back
(
log
::
Param
(
"unitName"
,
m_request
.
drive
));
params
.
push_back
(
log
::
Param
(
"dgn"
,
m_request
.
dgn
));
params
.
push_back
(
log
::
Param
(
"force"
,
boolToStr
(
m_force
)));
if
(
drive
.
isWriteProtected
())
{
castor
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Tape to be labeled in write protected"
;
throw
ex
;
}
m_log
(
LOG_INFO
,
"Label session detected tape is writable"
,
params
);
}
//------------------------------------------------------------------------------
// rewindDrive
//------------------------------------------------------------------------------
...
...
castor/tape/tapeserver/daemon/LabelSession.hpp
View file @
a79c1c75
...
...
@@ -177,13 +177,6 @@ private:
void
waitUntilTapeLoaded
(
drive
::
DriveInterface
&
drive
,
const
int
timeoutSecond
);
/**
* Checks that the now loaded tape is writable.
*
* @param drive Object representing the drive hardware.
*/
void
checkTapeIsWritable
(
drive
::
DriveInterface
&
drive
);
/**
* Rewinds the specified tape drive.
*
...
...
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