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
3ea71139
Commit
3ea71139
authored
Oct 02, 2014
by
Victor Kotlyar
Browse files
Fleshed out the ACS messages
parent
f3e7bbc5
Changes
9
Hide whitespace changes
Inline
Side-by-side
castor/messages/AcsDismountTape.proto
0 → 100644
View file @
3ea71139
// This file is part of the Castor project.
// See http://castor.web.cern.ch/castor
//
// Copyright (C) 2003 CERN
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// @author Castor Dev team, castor-dev@cern.ch
package
castor
.
messages
;
message
AcsDismountTape
{
required
string
vid
=
1
;
required
uint32
acs
=
2
;
required
uint32
lsm
=
3
;
required
uint32
panel
=
4
;
required
uint32
drive
=
5
;
}
castor/messages/AcsMountTapeForMigration.proto
0 → 100644
View file @
3ea71139
// This file is part of the Castor project.
// See http://castor.web.cern.ch/castor
//
// Copyright (C) 2003 CERN
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// @author Castor Dev team, castor-dev@cern.ch
package
castor
.
messages
;
message
AcsMountTapeForMigration
{
required
string
vid
=
1
;
required
uint32
acs
=
2
;
required
uint32
lsm
=
3
;
required
uint32
panel
=
4
;
required
uint32
drive
=
5
;
}
castor/messages/AcsProxy.hpp
View file @
3ea71139
...
...
@@ -50,6 +50,30 @@ public:
*/
virtual
void
mountTapeForRecall
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
)
=
0
;
/**
* Request the CASTOR ACS daemon to mount the specifed tape for migration.
*
* @param vid The tape to be mounted.
* @param acs The ACS identifier.
* @param lsm The LSM identifier.
* @param panel The panel identifier.
* @param drive The drive identifier.
*/
virtual
void
mountTapeForMigration
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
)
=
0
;
/**
* Request the CASTOR ACS daemon to dismount the specifed tape.
*
* @param vid The tape to be dismounted.
* @param acs The ACS identifier.
* @param lsm The LSM identifier.
* @param panel The panel identifier.
* @param drive The drive identifier.
*/
virtual
void
dismountTape
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
)
=
0
;
};
// class AcsProxy
...
...
castor/messages/AcsProxyDummy.cpp
View file @
3ea71139
...
...
@@ -28,3 +28,19 @@ void castor::messages::AcsProxyDummy::mountTapeForRecall(const std::string &vid,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
)
{
}
//------------------------------------------------------------------------------
// mountTapeForMigration
//------------------------------------------------------------------------------
void
castor
::
messages
::
AcsProxyDummy
::
mountTapeForMigration
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
)
{
}
//------------------------------------------------------------------------------
// dismountTape
//------------------------------------------------------------------------------
void
castor
::
messages
::
AcsProxyDummy
::
dismountTape
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
)
{
}
\ No newline at end of file
castor/messages/AcsProxyDummy.hpp
View file @
3ea71139
...
...
@@ -43,6 +43,31 @@ public:
*/
void
mountTapeForRecall
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
);
/**
* Request the CASTOR ACS daemon to mount the specifed tape for migration.
*
* @param vid The tape to be mounted.
* @param acs The ACS identifier.
* @param lsm The LSM identifier.
* @param panel The panel identifier.
* @param drive The drive identifier.
*/
void
mountTapeForMigration
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
);
/**
* Request the CASTOR ACS daemon to dismount the specifed tape.
*
* @param vid The tape to be mounted.
* @param acs The ACS identifier.
* @param lsm The LSM identifier.
* @param panel The panel identifier.
* @param drive The drive identifier.
*/
void
dismountTape
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
);
};
// class AcsProxyDummy
...
...
castor/messages/AcsProxyZmq.cpp
View file @
3ea71139
...
...
@@ -95,3 +95,124 @@ castor::messages::Frame castor::messages::AcsProxyZmq::
throw
ex
;
}
}
//------------------------------------------------------------------------------
// mountTapeForMigration
//------------------------------------------------------------------------------
void
castor
::
messages
::
AcsProxyZmq
::
mountTapeForMigration
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
)
{
try
{
const
Frame
rqst
=
createAcsMountTapeForMigrationFrame
(
vid
,
acs
,
lsm
,
panel
,
drive
);
sendFrame
(
m_serverSocket
,
rqst
);
ReturnValue
reply
;
recvTapeReplyOrEx
(
m_serverSocket
,
reply
);
if
(
0
!=
reply
.
value
())
{
// Should never get here
castor
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Received an unexpected return value"
": expected=0 actual="
<<
reply
.
value
();
throw
ex
;
}
}
catch
(
castor
::
exception
::
Exception
&
ne
)
{
castor
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Failed to request CASTOR ACS daemon to mount tape for migration: "
<<
"vid="
<<
vid
<<
" acs="
<<
acs
<<
" lsm="
<<
lsm
<<
" panel="
<<
panel
<<
" drive="
<<
drive
<<
": "
<<
ne
.
getMessage
().
str
();
throw
ex
;
}
}
//------------------------------------------------------------------------------
// createAcsMountTapeForMigrationFrame
//------------------------------------------------------------------------------
castor
::
messages
::
Frame
castor
::
messages
::
AcsProxyZmq
::
createAcsMountTapeForMigrationFrame
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
)
{
try
{
Frame
frame
;
frame
.
header
=
messages
::
protoTapePreFillHeader
();
frame
.
header
.
set_msgtype
(
messages
::
MSG_TYPE_ACSMOUNTTAPEFORMIGRATION
);
frame
.
header
.
set_bodysignature
(
"PIPO"
);
AcsMountTapeForRecall
body
;
body
.
set_vid
(
vid
);
body
.
set_acs
(
acs
);
body
.
set_lsm
(
lsm
);
body
.
set_panel
(
panel
);
body
.
set_drive
(
drive
);
frame
.
serializeProtocolBufferIntoBody
(
body
);
return
frame
;
}
catch
(
castor
::
exception
::
Exception
&
ne
)
{
castor
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Failed to create AcsMountTapeForMigration frame: "
<<
ne
.
getMessage
().
str
();
throw
ex
;
}
}
//------------------------------------------------------------------------------
// dismountTape
//------------------------------------------------------------------------------
void
castor
::
messages
::
AcsProxyZmq
::
dismountTape
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
)
{
try
{
const
Frame
rqst
=
createAcsDismountTapeFrame
(
vid
,
acs
,
lsm
,
panel
,
drive
);
sendFrame
(
m_serverSocket
,
rqst
);
ReturnValue
reply
;
recvTapeReplyOrEx
(
m_serverSocket
,
reply
);
if
(
0
!=
reply
.
value
())
{
// Should never get here
castor
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Received an unexpected return value"
": expected=0 actual="
<<
reply
.
value
();
throw
ex
;
}
}
catch
(
castor
::
exception
::
Exception
&
ne
)
{
castor
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Failed to request CASTOR ACS daemon to dismount tape: "
<<
"vid="
<<
vid
<<
" acs="
<<
acs
<<
" lsm="
<<
lsm
<<
" panel="
<<
panel
<<
" drive="
<<
drive
<<
": "
<<
ne
.
getMessage
().
str
();
throw
ex
;
}
}
//------------------------------------------------------------------------------
// createAcsDismountTapeFrame
//------------------------------------------------------------------------------
castor
::
messages
::
Frame
castor
::
messages
::
AcsProxyZmq
::
createAcsDismountTapeFrame
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
)
{
try
{
Frame
frame
;
frame
.
header
=
messages
::
protoTapePreFillHeader
();
frame
.
header
.
set_msgtype
(
messages
::
MSG_TYPE_ACSDISMOUNTTAPE
);
frame
.
header
.
set_bodysignature
(
"PIPO"
);
AcsMountTapeForRecall
body
;
body
.
set_vid
(
vid
);
body
.
set_acs
(
acs
);
body
.
set_lsm
(
lsm
);
body
.
set_panel
(
panel
);
body
.
set_drive
(
drive
);
frame
.
serializeProtocolBufferIntoBody
(
body
);
return
frame
;
}
catch
(
castor
::
exception
::
Exception
&
ne
)
{
castor
::
exception
::
Exception
ex
;
ex
.
getMessage
()
<<
"Failed to create AcsDismountTape frame: "
<<
ne
.
getMessage
().
str
();
throw
ex
;
}
}
castor/messages/AcsProxyZmq.hpp
View file @
3ea71139
...
...
@@ -57,6 +57,30 @@ public:
*/
void
mountTapeForRecall
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
);
/**
* Request the CASTOR ACS daemon to mount the specifed tape for migration.
*
* @param vid The tape to be mounted.
* @param acs The ACS identifier.
* @param lsm The LSM identifier.
* @param panel The panel identifier.
* @param drive The drive identifier.
*/
void
mountTapeForMigration
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
);
/**
* Request the CASTOR ACS daemon to dismount the specifed tape.
*
* @param vid The tape to be mounted.
* @param acs The ACS identifier.
* @param lsm The LSM identifier.
* @param panel The panel identifier.
* @param drive The drive identifier.
*/
void
dismountTape
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
);
private:
...
...
@@ -89,6 +113,34 @@ private:
Frame
createAcsMountTapeForRecallFrame
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
);
/**
* Creates a frame containing a AcsMountTapeForMigration message.
*
* @param vid The tape to be mounted.
* @param acs The ACS identifier.
* @param lsm The LSM identifier.
* @param panel The panel identifier.
* @param drive The drive identifier.
* @return The frame.
*/
Frame
createAcsMountTapeForMigrationFrame
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
);
/**
* Creates a frame containing a AcsDismountTape message.
*
* @param vid The tape to be dismounted.
* @param acs The ACS identifier.
* @param lsm The LSM identifier.
* @param panel The panel identifier.
* @param drive The drive identifier.
* @return The frame.
*/
Frame
createAcsDismountTapeFrame
(
const
std
::
string
&
vid
,
const
uint32_t
acs
,
const
uint32_t
lsm
,
const
uint32_t
panel
,
const
uint32_t
drive
);
};
// class AcsProxyZmq
...
...
castor/messages/Constants.cpp
View file @
3ea71139
...
...
@@ -72,6 +72,10 @@ const char *castor::messages::msgTypeToString(const MsgType msgType) throw() {
return
"LabelError"
;
case
MSG_TYPE_ACSMOUNTTAPEFORRECALL
:
return
"AcsMountTapeForRecall"
;
case
MSG_TYPE_ACSMOUNTTAPEFORMIGRATION
:
return
"AcsMountTapeForMigration"
;
case
MSG_TYPE_ACSDISMOUNTTAPE
:
return
"AcsDismountTape"
;
default:
return
"Unknown"
;
}
...
...
castor/messages/Constants.hpp
View file @
3ea71139
...
...
@@ -53,7 +53,9 @@ enum MsgType {
MSG_TYPE_TAPEUNMOUNTSTARTED
,
MSG_TYPE_TAPEUNMOUNTED
,
MSG_TYPE_LABELERROR
,
MSG_TYPE_ACSMOUNTTAPEFORRECALL
MSG_TYPE_ACSMOUNTTAPEFORRECALL
,
MSG_TYPE_ACSMOUNTTAPEFORMIGRATION
,
MSG_TYPE_ACSDISMOUNTTAPE
};
enum
ProtocolVersion
{
...
...
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