Skip to content
GitLab
Menu
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
008330df
Commit
008330df
authored
Jan 23, 2015
by
Steven Murray
Browse files
Catalogue and CatalogueDrive now use a castor::tape::System::virtualWrapper
parent
597dc469
Changes
8
Hide whitespace changes
Inline
Side-by-side
castor/tape/tapeserver/daemon/Catalogue.cpp
View file @
008330df
...
@@ -39,7 +39,8 @@ castor::tape::tapeserver::daemon::Catalogue::Catalogue(
...
@@ -39,7 +39,8 @@ castor::tape::tapeserver::daemon::Catalogue::Catalogue(
legacymsg
::
VdqmProxy
&
vdqm
,
legacymsg
::
VdqmProxy
&
vdqm
,
legacymsg
::
VmgrProxy
&
vmgr
,
legacymsg
::
VmgrProxy
&
vmgr
,
const
std
::
string
&
hostName
,
const
std
::
string
&
hostName
,
const
CatalogueConfig
&
catalogueConfig
)
:
const
CatalogueConfig
&
catalogueConfig
,
System
::
virtualWrapper
&
sysWrapper
)
:
m_netTimeout
(
netTimeout
),
m_netTimeout
(
netTimeout
),
m_log
(
log
),
m_log
(
log
),
m_processForker
(
processForker
),
m_processForker
(
processForker
),
...
@@ -47,7 +48,8 @@ castor::tape::tapeserver::daemon::Catalogue::Catalogue(
...
@@ -47,7 +48,8 @@ castor::tape::tapeserver::daemon::Catalogue::Catalogue(
m_vdqm
(
vdqm
),
m_vdqm
(
vdqm
),
m_vmgr
(
vmgr
),
m_vmgr
(
vmgr
),
m_hostName
(
hostName
),
m_hostName
(
hostName
),
m_catalogueConfig
(
catalogueConfig
)
{
m_catalogueConfig
(
catalogueConfig
),
m_sysWrapper
(
sysWrapper
)
{
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
...
@@ -141,7 +143,7 @@ void castor::tape::tapeserver::daemon::Catalogue::enterDriveConfig(
...
@@ -141,7 +143,7 @@ void castor::tape::tapeserver::daemon::Catalogue::enterDriveConfig(
// Insert it
// Insert it
m_drives
[
driveConfig
.
getUnitName
()]
=
new
CatalogueDrive
(
m_netTimeout
,
m_drives
[
driveConfig
.
getUnitName
()]
=
new
CatalogueDrive
(
m_netTimeout
,
m_log
,
m_processForker
,
m_cupv
,
m_vdqm
,
m_vmgr
,
m_hostName
,
driveConfig
,
m_log
,
m_processForker
,
m_cupv
,
m_vdqm
,
m_vmgr
,
m_hostName
,
driveConfig
,
DRIVE_STATE_DOWN
,
m_catalogueConfig
);
DRIVE_STATE_DOWN
,
m_catalogueConfig
,
m_sysWrapper
);
// Else the drive is already in the catalogue
// Else the drive is already in the catalogue
}
else
{
}
else
{
castor
::
exception
::
Exception
ex
;
castor
::
exception
::
Exception
ex
;
...
...
castor/tape/tapeserver/daemon/Catalogue.hpp
View file @
008330df
...
@@ -66,6 +66,7 @@ public:
...
@@ -66,6 +66,7 @@ public:
* name is needed to fill in messages to be sent to the vdqmd daemon.
* name is needed to fill in messages to be sent to the vdqmd daemon.
* @param catalogueConfig The CASTOR configuration parameters to be used by
* @param catalogueConfig The CASTOR configuration parameters to be used by
* the catalogue.
* the catalogue.
* @param sysWrapper Object representing the operating system.
*/
*/
Catalogue
(
Catalogue
(
const
int
netTimeout
,
const
int
netTimeout
,
...
@@ -75,7 +76,8 @@ public:
...
@@ -75,7 +76,8 @@ public:
legacymsg
::
VdqmProxy
&
vdqm
,
legacymsg
::
VdqmProxy
&
vdqm
,
legacymsg
::
VmgrProxy
&
vmgr
,
legacymsg
::
VmgrProxy
&
vmgr
,
const
std
::
string
&
hostName
,
const
std
::
string
&
hostName
,
const
CatalogueConfig
&
catalogueConfig
);
const
CatalogueConfig
&
catalogueConfig
,
System
::
virtualWrapper
&
sysWrapper
);
/**
/**
* Destructor.
* Destructor.
...
@@ -212,6 +214,11 @@ private:
...
@@ -212,6 +214,11 @@ private:
*/
*/
const
CatalogueConfig
m_catalogueConfig
;
const
CatalogueConfig
m_catalogueConfig
;
/**
* Object representing the operating system.
*/
System
::
virtualWrapper
&
m_sysWrapper
;
/**
/**
* Type that maps the unit name of a tape drive to the catalogue entry of
* Type that maps the unit name of a tape drive to the catalogue entry of
* that drive.
* that drive.
...
...
castor/tape/tapeserver/daemon/CatalogueDrive.cpp
View file @
008330df
...
@@ -48,7 +48,8 @@ castor::tape::tapeserver::daemon::CatalogueDrive::CatalogueDrive(
...
@@ -48,7 +48,8 @@ castor::tape::tapeserver::daemon::CatalogueDrive::CatalogueDrive(
const
std
::
string
&
hostName
,
const
std
::
string
&
hostName
,
const
DriveConfig
&
config
,
const
DriveConfig
&
config
,
const
CatalogueDriveState
state
,
const
CatalogueDriveState
state
,
const
CatalogueConfig
&
catalogueConfig
)
const
CatalogueConfig
&
catalogueConfig
,
System
::
virtualWrapper
&
sysWrapper
)
throw
()
:
throw
()
:
m_netTimeout
(
netTimeout
),
m_netTimeout
(
netTimeout
),
m_log
(
log
),
m_log
(
log
),
...
@@ -58,6 +59,7 @@ castor::tape::tapeserver::daemon::CatalogueDrive::CatalogueDrive(
...
@@ -58,6 +59,7 @@ castor::tape::tapeserver::daemon::CatalogueDrive::CatalogueDrive(
m_vmgr
(
vmgr
),
m_vmgr
(
vmgr
),
m_hostName
(
hostName
),
m_hostName
(
hostName
),
m_config
(
config
),
m_config
(
config
),
m_sysWrapper
(
sysWrapper
),
m_state
(
state
),
m_state
(
state
),
m_waitJobTimeoutSecs
(
catalogueConfig
.
waitJobTimeoutSecs
),
m_waitJobTimeoutSecs
(
catalogueConfig
.
waitJobTimeoutSecs
),
m_mountTimeoutSecs
(
catalogueConfig
.
mountTimeoutSecs
),
m_mountTimeoutSecs
(
catalogueConfig
.
mountTimeoutSecs
),
...
@@ -396,8 +398,7 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::
...
@@ -396,8 +398,7 @@ void castor::tape::tapeserver::daemon::CatalogueDrive::
// checkDriveIsEmpty
// checkDriveIsEmpty
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void
castor
::
tape
::
tapeserver
::
daemon
::
CatalogueDrive
::
checkDriveIsEmpty
()
{
void
castor
::
tape
::
tapeserver
::
daemon
::
CatalogueDrive
::
checkDriveIsEmpty
()
{
castor
::
tape
::
System
::
realWrapper
sWrapper
;
ProbeSession
probeSession
(
m_log
,
m_config
,
m_sysWrapper
);
ProbeSession
probeSession
(
m_log
,
m_config
,
sWrapper
);
const
int
probeSessionExitCode
=
probeSession
.
execute
();
const
int
probeSessionExitCode
=
probeSession
.
execute
();
...
...
castor/tape/tapeserver/daemon/CatalogueDrive.hpp
View file @
008330df
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include
"castor/tape/tapeserver/daemon/DriveConfig.hpp"
#include
"castor/tape/tapeserver/daemon/DriveConfig.hpp"
#include
"castor/tape/tapeserver/daemon/ProcessForkerProxy.hpp"
#include
"castor/tape/tapeserver/daemon/ProcessForkerProxy.hpp"
#include
"castor/tape/tapeserver/daemon/VdqmDriveSynchronizer.hpp"
#include
"castor/tape/tapeserver/daemon/VdqmDriveSynchronizer.hpp"
#include
"castor/tape/tapeserver/system/Wrapper.hpp"
#include
<iostream>
#include
<iostream>
#include
<memory>
#include
<memory>
...
@@ -76,6 +77,7 @@ public:
...
@@ -76,6 +77,7 @@ public:
* @param state The initial state of the tape drive.
* @param state The initial state of the tape drive.
* @param catalogueConfig The CASTOR configuration parameters to be used by
* @param catalogueConfig The CASTOR configuration parameters to be used by
* the catalogue.
* the catalogue.
* @param sysWrapper Object representing the operating system.
*/
*/
CatalogueDrive
(
CatalogueDrive
(
const
int
netTimeout
,
const
int
netTimeout
,
...
@@ -87,7 +89,8 @@ public:
...
@@ -87,7 +89,8 @@ public:
const
std
::
string
&
hostName
,
const
std
::
string
&
hostName
,
const
DriveConfig
&
config
,
const
DriveConfig
&
config
,
const
CatalogueDriveState
state
,
const
CatalogueDriveState
state
,
const
CatalogueConfig
&
catalogueConfig
)
throw
();
const
CatalogueConfig
&
catalogueConfig
,
System
::
virtualWrapper
&
sysWrapper
)
throw
();
/**
/**
* Destructor
* Destructor
...
@@ -373,6 +376,11 @@ private:
...
@@ -373,6 +376,11 @@ private:
*/
*/
DriveConfig
m_config
;
DriveConfig
m_config
;
/**
* Object representing the operating system.
*/
System
::
virtualWrapper
&
m_sysWrapper
;
/**
/**
* The current state of the tape drive.
* The current state of the tape drive.
*/
*/
...
...
castor/tape/tapeserver/daemon/CatalogueTest.cpp
View file @
008330df
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include
"castor/log/DummyLogger.hpp"
#include
"castor/log/DummyLogger.hpp"
#include
"castor/tape/tapeserver/daemon/Catalogue.hpp"
#include
"castor/tape/tapeserver/daemon/Catalogue.hpp"
#include
"castor/tape/tapeserver/daemon/ProcessForkerProxyDummy.hpp"
#include
"castor/tape/tapeserver/daemon/ProcessForkerProxyDummy.hpp"
#include
"castor/tape/tapeserver/system/Wrapper.hpp"
#include
"castor/utils/utils.hpp"
#include
"castor/utils/utils.hpp"
#include
<gtest/gtest.h>
#include
<gtest/gtest.h>
...
@@ -64,8 +65,9 @@ TEST_F(castor_tape_tapeserver_daemon_CatalogueTest, goodDayPopulate) {
...
@@ -64,8 +65,9 @@ TEST_F(castor_tape_tapeserver_daemon_CatalogueTest, goodDayPopulate) {
const
std
::
string
hostName
=
""
;
const
std
::
string
hostName
=
""
;
const
CatalogueConfig
catalogueConfig
;
const
CatalogueConfig
catalogueConfig
;
const
int
netTimeout
=
1
;
const
int
netTimeout
=
1
;
castor
::
tape
::
System
::
mockWrapper
sysWrapper
;
Catalogue
catalogue
(
netTimeout
,
log
,
processForker
,
cupv
,
vdqm
,
vmgr
,
Catalogue
catalogue
(
netTimeout
,
log
,
processForker
,
cupv
,
vdqm
,
vmgr
,
hostName
,
catalogueConfig
);
hostName
,
catalogueConfig
,
sysWrapper
);
ASSERT_NO_THROW
(
catalogue
.
populate
(
driveConfigs
));
ASSERT_NO_THROW
(
catalogue
.
populate
(
driveConfigs
));
{
{
...
@@ -138,47 +140,12 @@ TEST_F(castor_tape_tapeserver_daemon_CatalogueTest,
...
@@ -138,47 +140,12 @@ TEST_F(castor_tape_tapeserver_daemon_CatalogueTest,
castor
::
legacymsg
::
VmgrProxyDummy
vmgr
;
castor
::
legacymsg
::
VmgrProxyDummy
vmgr
;
const
std
::
string
hostName
=
""
;
const
std
::
string
hostName
=
""
;
const
CatalogueConfig
catalogueConfig
;
const
CatalogueConfig
catalogueConfig
;
castor
::
tape
::
System
::
mockWrapper
sysWrapper
;
Catalogue
catalogue
(
netTimeout
,
log
,
processForker
,
cupv
,
vdqm
,
vmgr
,
Catalogue
catalogue
(
netTimeout
,
log
,
processForker
,
cupv
,
vdqm
,
vmgr
,
hostName
,
catalogueConfig
);
hostName
,
catalogueConfig
,
sysWrapper
);
ASSERT_THROW
(
catalogue
.
findDrive
(
unitName
),
castor
::
exception
::
Exception
);
ASSERT_THROW
(
catalogue
.
findDrive
(
unitName
),
castor
::
exception
::
Exception
);
}
}
TEST_F
(
castor_tape_tapeserver_daemon_CatalogueTest
,
dgnMismatchStart
)
{
using
namespace
castor
::
tape
::
tapeserver
::
daemon
;
TpconfigLines
lines
;
lines
.
push_back
(
TpconfigLine
(
"UNIT"
,
"DGN1"
,
"DEV"
,
"manual@SLOT"
));
DriveConfigMap
driveConfigs
;
ASSERT_NO_THROW
(
driveConfigs
.
enterTpconfigLines
(
lines
));
const
int
netTimeout
=
1
;
castor
::
log
::
DummyLogger
log
(
"unittest"
);
ProcessForkerProxyDummy
processForker
;
const
bool
isGrantedReturnValue
=
true
;
castor
::
legacymsg
::
CupvProxyDummy
cupv
(
isGrantedReturnValue
);
castor
::
legacymsg
::
VdqmProxyDummy
vdqm
;
castor
::
legacymsg
::
VmgrProxyDummy
vmgr
;
const
std
::
string
hostName
=
""
;
const
CatalogueConfig
catalogueConfig
;
Catalogue
catalogue
(
netTimeout
,
log
,
processForker
,
cupv
,
vdqm
,
vmgr
,
hostName
,
catalogueConfig
);
ASSERT_NO_THROW
(
catalogue
.
populate
(
driveConfigs
));
CatalogueDrive
&
unit
=
catalogue
.
findDrive
(
"UNIT"
);
ASSERT_EQ
(
DRIVE_STATE_DOWN
,
unit
.
getState
());
ASSERT_NO_THROW
(
unit
.
configureUp
());
ASSERT_EQ
(
DRIVE_STATE_UP
,
unit
.
getState
());
castor
::
legacymsg
::
RtcpJobRqstMsgBody
job
;
job
.
volReqId
=
1111
;
job
.
clientPort
=
2222
;
job
.
clientEuid
=
3333
;
job
.
clientEgid
=
4444
;
castor
::
utils
::
copyString
(
job
.
clientHost
,
"CLIENT_HOST"
);
castor
::
utils
::
copyString
(
job
.
dgn
,
"DGN2"
);
castor
::
utils
::
copyString
(
job
.
driveUnit
,
"UNIT"
);
castor
::
utils
::
copyString
(
job
.
clientUserName
,
"USER"
);
ASSERT_THROW
(
unit
.
receivedVdqmJob
(
job
),
castor
::
exception
::
Exception
);
}
TEST_F
(
castor_tape_tapeserver_daemon_CatalogueTest
,
getUnitNames
)
{
TEST_F
(
castor_tape_tapeserver_daemon_CatalogueTest
,
getUnitNames
)
{
using
namespace
castor
::
tape
::
tapeserver
::
daemon
;
using
namespace
castor
::
tape
::
tapeserver
::
daemon
;
TpconfigLines
lines
;
TpconfigLines
lines
;
...
@@ -189,7 +156,6 @@ TEST_F(castor_tape_tapeserver_daemon_CatalogueTest, getUnitNames) {
...
@@ -189,7 +156,6 @@ TEST_F(castor_tape_tapeserver_daemon_CatalogueTest, getUnitNames) {
DriveConfigMap
driveConfigs
;
DriveConfigMap
driveConfigs
;
ASSERT_NO_THROW
(
driveConfigs
.
enterTpconfigLines
(
lines
));
ASSERT_NO_THROW
(
driveConfigs
.
enterTpconfigLines
(
lines
));
const
int
netTimeout
=
1
;
const
int
netTimeout
=
1
;
castor
::
log
::
DummyLogger
log
(
"unittest"
);
castor
::
log
::
DummyLogger
log
(
"unittest"
);
ProcessForkerProxyDummy
processForker
;
ProcessForkerProxyDummy
processForker
;
...
@@ -199,8 +165,9 @@ TEST_F(castor_tape_tapeserver_daemon_CatalogueTest, getUnitNames) {
...
@@ -199,8 +165,9 @@ TEST_F(castor_tape_tapeserver_daemon_CatalogueTest, getUnitNames) {
castor
::
legacymsg
::
VmgrProxyDummy
vmgr
;
castor
::
legacymsg
::
VmgrProxyDummy
vmgr
;
const
std
::
string
hostName
=
""
;
const
std
::
string
hostName
=
""
;
const
CatalogueConfig
catalogueConfig
;
const
CatalogueConfig
catalogueConfig
;
castor
::
tape
::
System
::
mockWrapper
sysWrapper
;
Catalogue
catalogue
(
netTimeout
,
log
,
processForker
,
cupv
,
vdqm
,
vmgr
,
Catalogue
catalogue
(
netTimeout
,
log
,
processForker
,
cupv
,
vdqm
,
vmgr
,
hostName
,
catalogueConfig
);
hostName
,
catalogueConfig
,
sysWrapper
);
ASSERT_NO_THROW
(
catalogue
.
populate
(
driveConfigs
));
ASSERT_NO_THROW
(
catalogue
.
populate
(
driveConfigs
));
{
{
...
...
castor/tape/tapeserver/daemon/ProbeSession.hpp
View file @
008330df
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include
"castor/tape/tapeserver/drive/DriveInterface.hpp"
#include
"castor/tape/tapeserver/drive/DriveInterface.hpp"
#include
"castor/tape/tapeserver/file/Structures.hpp"
#include
"castor/tape/tapeserver/file/Structures.hpp"
#include
"castor/tape/tapeserver/SCSI/Device.hpp"
#include
"castor/tape/tapeserver/SCSI/Device.hpp"
#include
"castor/tape/tapeserver/system/Wrapper.hpp"
#include
<memory>
#include
<memory>
...
...
castor/tape/tapeserver/daemon/TapeDaemon.cpp
View file @
008330df
...
@@ -212,6 +212,7 @@ void castor::tape::tapeserver::daemon::TapeDaemon::exceptionThrowingMain(
...
@@ -212,6 +212,7 @@ void castor::tape::tapeserver::daemon::TapeDaemon::exceptionThrowingMain(
m_processForkerPid
=
forkProcessForker
(
cmdPair
,
reaperPair
);
m_processForkerPid
=
forkProcessForker
(
cmdPair
,
reaperPair
);
m_processForker
=
new
ProcessForkerProxySocket
(
m_log
,
cmdPair
.
tapeDaemon
);
m_processForker
=
new
ProcessForkerProxySocket
(
m_log
,
cmdPair
.
tapeDaemon
);
castor
::
tape
::
System
::
realWrapper
sysWrapper
;
m_catalogue
=
new
Catalogue
(
m_catalogue
=
new
Catalogue
(
m_netTimeout
,
m_netTimeout
,
m_log
,
m_log
,
...
@@ -220,7 +221,9 @@ void castor::tape::tapeserver::daemon::TapeDaemon::exceptionThrowingMain(
...
@@ -220,7 +221,9 @@ void castor::tape::tapeserver::daemon::TapeDaemon::exceptionThrowingMain(
m_vdqm
,
m_vdqm
,
m_vmgr
,
m_vmgr
,
m_hostName
,
m_hostName
,
m_tapeDaemonConfig
.
catalogueConfig
);
m_tapeDaemonConfig
.
catalogueConfig
,
sysWrapper
);
m_catalogue
->
populate
(
m_driveConfigs
);
m_catalogue
->
populate
(
m_driveConfigs
);
...
...
castor/tape/tapeserver/daemon/VdqmConnectionHandlerTest.cpp
View file @
008330df
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include
"castor/log/DummyLogger.hpp"
#include
"castor/log/DummyLogger.hpp"
#include
"castor/tape/tapeserver/daemon/ProcessForkerProxyDummy.hpp"
#include
"castor/tape/tapeserver/daemon/ProcessForkerProxyDummy.hpp"
#include
"castor/tape/tapeserver/daemon/TestingVdqmConnectionHandler.hpp"
#include
"castor/tape/tapeserver/daemon/TestingVdqmConnectionHandler.hpp"
#include
"castor/tape/tapeserver/system/Wrapper.hpp"
#include
"castor/tape/reactor/DummyZMQReactor.hpp"
#include
"castor/tape/reactor/DummyZMQReactor.hpp"
#include
"castor/utils/SmartFd.hpp"
#include
"castor/utils/SmartFd.hpp"
...
@@ -52,7 +53,8 @@ protected:
...
@@ -52,7 +53,8 @@ protected:
m_vdqm
,
m_vdqm
,
m_vmgr
,
m_vmgr
,
"hostName"
,
"hostName"
,
m_catalogueConfig
)
{
m_catalogueConfig
,
m_mockWrapper
)
{
}
}
castor
::
log
::
DummyLogger
m_log
;
castor
::
log
::
DummyLogger
m_log
;
...
@@ -73,6 +75,8 @@ protected:
...
@@ -73,6 +75,8 @@ protected:
castor
::
tape
::
tapeserver
::
daemon
::
CatalogueConfig
m_catalogueConfig
;
castor
::
tape
::
tapeserver
::
daemon
::
CatalogueConfig
m_catalogueConfig
;
castor
::
tape
::
System
::
mockWrapper
m_mockWrapper
;
castor
::
tape
::
tapeserver
::
daemon
::
Catalogue
m_catalogue
;
castor
::
tape
::
tapeserver
::
daemon
::
Catalogue
m_catalogue
;
castor
::
tape
::
tapeserver
::
daemon
::
TapeDaemonConfig
m_config
;
castor
::
tape
::
tapeserver
::
daemon
::
TapeDaemonConfig
m_config
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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