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
063dd874
Commit
063dd874
authored
Apr 19, 2021
by
Steven Murray
Browse files
Removed the Oracle library only feature forceDismountTape()
parent
00093474
Changes
12
Hide whitespace changes
Inline
Side-by-side
mediachanger/DismountCmd.cpp
View file @
063dd874
...
...
@@ -66,11 +66,6 @@ int cta::mediachanger::DismountCmd::exceptionThrowingMain(const int argc,
m_dbg
<<
"DRIVE_SLOT = "
<<
m_cmdLine
.
getDriveLibrarySlot
().
str
()
<<
std
::
endl
;
if
(
m_cmdLine
.
getForce
())
{
m_mc
.
forceDismountTape
(
m_cmdLine
.
getVid
(),
m_cmdLine
.
getDriveLibrarySlot
());
}
else
{
m_mc
.
dismountTape
(
m_cmdLine
.
getVid
(),
m_cmdLine
.
getDriveLibrarySlot
());
}
m_mc
.
dismountTape
(
m_cmdLine
.
getVid
(),
m_cmdLine
.
getDriveLibrarySlot
());
return
0
;
}
mediachanger/DismountCmdLine.cpp
View file @
063dd874
...
...
@@ -29,8 +29,7 @@
cta
::
mediachanger
::
DismountCmdLine
::
DismountCmdLine
()
:
m_debug
(
false
),
m_help
(
false
),
m_driveLibrarySlot
(
0
),
m_force
(
false
)
{
m_driveLibrarySlot
(
0
)
{
}
//------------------------------------------------------------------------------
...
...
@@ -40,13 +39,11 @@ cta::mediachanger::DismountCmdLine::DismountCmdLine(const int argc,
char
*
const
*
const
argv
)
:
m_debug
(
false
),
m_help
(
false
),
m_driveLibrarySlot
(
0
),
m_force
(
false
)
{
m_driveLibrarySlot
(
0
)
{
static
struct
option
longopts
[]
=
{
{
"debug"
,
0
,
NULL
,
'd'
},
{
"help"
,
0
,
NULL
,
'h'
},
{
"force"
,
0
,
NULL
,
'f'
},
{
NULL
,
0
,
NULL
,
0
}
};
...
...
@@ -94,8 +91,7 @@ cta::mediachanger::DismountCmdLine::DismountCmdLine(
m_help
(
obj
.
m_help
),
m_vid
(
obj
.
m_vid
),
m_driveLibrarySlot
(
0
==
obj
.
m_driveLibrarySlot
?
0
:
obj
.
m_driveLibrarySlot
->
clone
()),
m_force
(
obj
.
m_force
)
{
obj
.
m_driveLibrarySlot
->
clone
())
{
}
//-----------------------------------------------------------------------------
...
...
@@ -120,19 +116,11 @@ cta::mediachanger::DismountCmdLine &cta::mediachanger::DismountCmdLine::
m_vid
=
rhs
.
m_vid
;
m_driveLibrarySlot
=
0
==
rhs
.
m_driveLibrarySlot
?
0
:
rhs
.
m_driveLibrarySlot
->
clone
();
m_force
=
rhs
.
m_force
;
}
return
*
this
;
}
//------------------------------------------------------------------------------
// getForce
//------------------------------------------------------------------------------
bool
cta
::
mediachanger
::
DismountCmdLine
::
getForce
()
const
{
return
m_force
;
}
//------------------------------------------------------------------------------
// getProgramName
//------------------------------------------------------------------------------
...
...
@@ -151,9 +139,6 @@ void cta::mediachanger::DismountCmdLine::processOption(const int opt) {
case
'h'
:
m_help
=
true
;
break
;
case
'f'
:
m_force
=
true
;
break
;
case
':'
:
return
handleMissingParameter
(
optopt
);
case
'?'
:
...
...
@@ -193,9 +178,7 @@ std::string cta::mediachanger::DismountCmdLine::getUsage() {
"
\n
"
" -h|--help Print this help message and exit.
\n
"
"
\n
"
" -f|--force Force the dismount (rewind and eject the tape where necessary)."
"
\n
"
"Comments to: Castor.Support@cern.ch
\n
"
;
"Comments to: cta-support@cern.ch
\n
"
;
}
//------------------------------------------------------------------------------
...
...
mediachanger/DismountCmdLine.hpp
View file @
063dd874
...
...
@@ -101,14 +101,6 @@ public:
*/
const
LibrarySlot
&
getDriveLibrarySlot
()
const
;
/**
* Gets the value of the force option.
*
* @return True if the dismount should be forced. Forcing a dismount means
* rewinding and ejecting the tape where necessary.
*/
bool
getForce
()
const
;
/**
* Return sthe program name.
*
...
...
@@ -138,12 +130,6 @@ private:
*/
LibrarySlot
*
m_driveLibrarySlot
;
/**
* True if the dismount should be forced. Forcing a dismount means
* rewinding and ejecting the tape where necessary.
*/
bool
m_force
;
/**
* Processes the specified option that was returned by getopt_long().
*
...
...
mediachanger/DismountCmdLineTest.cpp
View file @
063dd874
...
...
@@ -81,7 +81,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, copy_constructor) {
DismountCmdLine
cmdLine1
(
args
->
argc
,
args
->
argv
);
ASSERT_FALSE
(
cmdLine1
.
getHelp
());
ASSERT_FALSE
(
cmdLine1
.
getDebug
());
ASSERT_FALSE
(
cmdLine1
.
getForce
());
ASSERT_EQ
(
TAPE_LIBRARY_TYPE_SCSI
,
cmdLine1
.
getDriveLibrarySlot
().
getLibraryType
());
ASSERT_EQ
(
std
::
string
(
"smc1"
),
cmdLine1
.
getDriveLibrarySlot
().
str
());
...
...
@@ -89,7 +88,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, copy_constructor) {
DismountCmdLine
cmdLine2
(
cmdLine1
);
ASSERT_FALSE
(
cmdLine2
.
getHelp
());
ASSERT_FALSE
(
cmdLine2
.
getDebug
());
ASSERT_FALSE
(
cmdLine2
.
getForce
());
ASSERT_EQ
(
TAPE_LIBRARY_TYPE_SCSI
,
cmdLine2
.
getDriveLibrarySlot
().
getLibraryType
());
ASSERT_EQ
(
std
::
string
(
"smc1"
),
cmdLine2
.
getDriveLibrarySlot
().
str
());
...
...
@@ -110,7 +108,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, assignment) {
DismountCmdLine
cmdLine1
(
args1
->
argc
,
args1
->
argv
);
ASSERT_FALSE
(
cmdLine1
.
getHelp
());
ASSERT_FALSE
(
cmdLine1
.
getDebug
());
ASSERT_FALSE
(
cmdLine1
.
getForce
());
ASSERT_EQ
(
TAPE_LIBRARY_TYPE_SCSI
,
cmdLine1
.
getDriveLibrarySlot
().
getLibraryType
());
ASSERT_EQ
(
std
::
string
(
"smc1"
),
cmdLine1
.
getDriveLibrarySlot
().
str
());
...
...
@@ -126,7 +123,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, assignment) {
DismountCmdLine
cmdLine2
(
args2
->
argc
,
args2
->
argv
);
ASSERT_FALSE
(
cmdLine2
.
getHelp
());
ASSERT_FALSE
(
cmdLine2
.
getDebug
());
ASSERT_FALSE
(
cmdLine2
.
getForce
());
ASSERT_EQ
(
TAPE_LIBRARY_TYPE_SCSI
,
cmdLine2
.
getDriveLibrarySlot
().
getLibraryType
());
ASSERT_EQ
(
std
::
string
(
"smc2"
),
cmdLine2
.
getDriveLibrarySlot
().
str
());
...
...
@@ -134,13 +130,11 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, assignment) {
ASSERT_FALSE
(
cmdLine1
.
getHelp
());
ASSERT_FALSE
(
cmdLine1
.
getDebug
());
ASSERT_FALSE
(
cmdLine1
.
getForce
());
ASSERT_EQ
(
TAPE_LIBRARY_TYPE_SCSI
,
cmdLine1
.
getDriveLibrarySlot
().
getLibraryType
());
ASSERT_EQ
(
std
::
string
(
"smc2"
),
cmdLine1
.
getDriveLibrarySlot
().
str
());
ASSERT_FALSE
(
cmdLine2
.
getHelp
());
ASSERT_FALSE
(
cmdLine2
.
getDebug
());
ASSERT_FALSE
(
cmdLine2
.
getForce
());
ASSERT_EQ
(
TAPE_LIBRARY_TYPE_SCSI
,
cmdLine2
.
getDriveLibrarySlot
().
getLibraryType
());
ASSERT_EQ
(
std
::
string
(
"smc2"
),
cmdLine2
.
getDriveLibrarySlot
().
str
());
}
...
...
@@ -162,7 +156,6 @@ TEST_F(cta_mediachanger_DismountCmdLineTest, scsi) {
ASSERT_FALSE
(
cmdLine
->
getHelp
());
ASSERT_FALSE
(
cmdLine
->
getDebug
());
ASSERT_FALSE
(
cmdLine
->
getForce
());
ASSERT_EQ
(
TAPE_LIBRARY_TYPE_SCSI
,
cmdLine
->
getDriveLibrarySlot
().
getLibraryType
());
}
...
...
mediachanger/MediaChangerFacade.cpp
View file @
063dd874
...
...
@@ -71,20 +71,6 @@ void MediaChangerFacade::dismountTape(const std::string &vid, const LibrarySlot
}
}
//------------------------------------------------------------------------------
// forceDismountTape
//------------------------------------------------------------------------------
void
MediaChangerFacade
::
forceDismountTape
(
const
std
::
string
&
vid
,
const
LibrarySlot
&
slot
)
{
try
{
return
getProxy
(
slot
.
getLibraryType
()).
forceDismountTape
(
vid
,
slot
);
}
catch
(
cta
::
exception
::
Exception
&
ne
)
{
cta
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Failed to force dismount tape: vid="
<<
vid
<<
" slot="
<<
slot
.
str
()
<<
": "
<<
ne
.
getMessage
().
str
();
throw
ex
;
}
}
//------------------------------------------------------------------------------
// getProxy
//------------------------------------------------------------------------------
...
...
mediachanger/MediaChangerFacade.hpp
View file @
063dd874
...
...
@@ -75,19 +75,6 @@ public:
*/
void
dismountTape
(
const
std
::
string
&
vid
,
const
LibrarySlot
&
slot
);
/**
* Requests the media changer to forcefully dismount the specified tape from
* the drive in the specifed library slot. Forcefully means rewinding and
* ejecting the tape where necessary.
*
* Please note that this method provides a best-effort service because not all
* media changers support forceful dismounts.
*
* @param vid The volume identifier of the tape.
* @param slot The library slot containing the tape drive.
*/
void
forceDismountTape
(
const
std
::
string
&
vid
,
const
LibrarySlot
&
slot
);
private:
/**
...
...
mediachanger/MediaChangerProxy.hpp
View file @
063dd874
...
...
@@ -68,19 +68,6 @@ public:
*/
virtual
void
dismountTape
(
const
std
::
string
&
vid
,
const
LibrarySlot
&
librarySlot
)
=
0
;
/**
* Request the media changer daemon to forcefully dismount the specifed tape
* from the tape drive in the specified library slot. Forcefully means
* rewinding and ejecting the tape if necessary.
*
* Please note that this method provides a best-effort service because not all
* media changers support forceful dismounts.
*
* @param vid The volume identifier of the tape to be mounted.
* @param librarySlot The slot in the library that contains the tape drive.
*/
virtual
void
forceDismountTape
(
const
std
::
string
&
vid
,
const
LibrarySlot
&
librarySlot
)
=
0
;
};
// class MediaChangerProxy
}
// namespace mediachanger
...
...
mediachanger/MmcProxy.cpp
View file @
063dd874
...
...
@@ -59,15 +59,5 @@ void MmcProxy::dismountTape( const std::string &vid, const LibrarySlot &libraryS
m_log
(
log
::
WARNING
,
"Tape should be manual dismounted"
,
params
);
}
//------------------------------------------------------------------------------
// forceDismountTape
//------------------------------------------------------------------------------
void
MmcProxy
::
forceDismountTape
(
const
std
::
string
&
vid
,
const
LibrarySlot
&
librarySlot
)
{
std
::
list
<
log
::
Param
>
params
=
{
log
::
Param
(
"tapeVid"
,
vid
),
log
::
Param
(
"librarySlot"
,
librarySlot
.
str
())};
m_log
(
log
::
WARNING
,
"Tape should be manual dismounted"
,
params
);
}
}
// namespace medichanger
}
// namespace cta
mediachanger/MmcProxy.hpp
View file @
063dd874
...
...
@@ -67,19 +67,6 @@ public:
*/
void
dismountTape
(
const
std
::
string
&
vid
,
const
LibrarySlot
&
librarySlot
)
override
;
/**
* Requests the media changer to forcefully dismount the specified tape from
* the drive in the specifed library slot. Forcefully means rewinding and
* ejecting the tape where necessary.
*
* Please note that this method provides a best-effort service because not all
* media changers support forceful dismounts.
*
* @param vid The volume identifier of the tape.
* @param librarySlot The library slot containing the tape drive.
*/
void
forceDismountTape
(
const
std
::
string
&
vid
,
const
LibrarySlot
&
librarySlot
)
override
;
private:
/**
...
...
mediachanger/RmcProxy.cpp
View file @
063dd874
...
...
@@ -100,14 +100,6 @@ void RmcProxy::dismountTape(const std::string &vid, const LibrarySlot &librarySl
}
}
//------------------------------------------------------------------------------
// forceDismountTape
//------------------------------------------------------------------------------
void
RmcProxy
::
forceDismountTape
(
const
std
::
string
&
vid
,
const
LibrarySlot
&
librarySlot
)
{
// SCSI libraries do not support forced dismounts
dismountTape
(
vid
,
librarySlot
);
}
//-----------------------------------------------------------------------------
// connectToRmc
//-----------------------------------------------------------------------------
...
...
mediachanger/RmcProxy.hpp
View file @
063dd874
...
...
@@ -88,19 +88,6 @@ public:
*/
void
dismountTape
(
const
std
::
string
&
vid
,
const
LibrarySlot
&
librarySlot
)
override
;
/**
* Requests the media changer to forcefully dismount the specified tape from
* the drive in the specifed library slot. Forcefully means rewinding and
* ejecting the tape where necessary.
*
* Please note that this method provides a best-effort service because not all
* media changers support forceful dismounts.
*
* @param vid The volume identifier of the tape.
* @param librarySlot The library slot containing the tape drive.
*/
void
forceDismountTape
(
const
std
::
string
&
vid
,
const
LibrarySlot
&
librarySlot
)
override
;
protected:
/**
...
...
mediachanger/cta-mediachanger-dismount.1cta
View file @
063dd874
...
...
@@ -40,9 +40,6 @@ Turns on the printing of debug information.
.TP
\fB\-h, \-\-help
Prints the usage message.
.TP
\fB\-f, \-\-force
Force the dismount (rewind and eject the tape where necessary).
.SH "RETURN CODES"
.TP
...
...
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