Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
231bf910
Commit
231bf910
authored
9 years ago
by
Daniele Kruse
Browse files
Options
Downloads
Patches
Plain Diff
Implemented persistent path for mock name server
parent
db670cf4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nameserver/mockNS/MockNameServer.cpp
+25
-5
25 additions, 5 deletions
nameserver/mockNS/MockNameServer.cpp
nameserver/mockNS/makeMockNameServerBasePath.cpp
+7
-2
7 additions, 2 deletions
nameserver/mockNS/makeMockNameServerBasePath.cpp
with
32 additions
and
7 deletions
nameserver/mockNS/MockNameServer.cpp
+
25
−
5
View file @
231bf910
...
...
@@ -437,8 +437,8 @@ void cta::MockNameServer::setOwner(
const
std
::
string
gidStr
=
Utils
::
toString
(
owner
.
gid
);
const
std
::
string
fsPath
=
m_fsDir
+
path
;
Utils
::
setXattr
(
fsPath
,
"user.uid"
,
uidStr
);
Utils
::
setXattr
(
fsPath
,
"user.gid"
,
gidStr
);
Utils
::
setXattr
(
fsPath
,
"user.
CTA
uid"
,
uidStr
);
Utils
::
setXattr
(
fsPath
,
"user.
CTA
gid"
,
gidStr
);
}
//------------------------------------------------------------------------------
...
...
@@ -449,8 +449,8 @@ cta::UserIdentity cta::MockNameServer::getOwner(
const
std
::
string
&
path
)
const
{
Utils
::
assertAbsolutePathSyntax
(
path
);
const
std
::
string
fsPath
=
m_fsDir
+
path
;
const
std
::
string
uidStr
=
Utils
::
getXattr
(
fsPath
,
"user.uid"
);
const
std
::
string
gidStr
=
Utils
::
getXattr
(
fsPath
,
"user.gid"
);
const
std
::
string
uidStr
=
Utils
::
getXattr
(
fsPath
,
"user.
CTA
uid"
);
const
std
::
string
gidStr
=
Utils
::
getXattr
(
fsPath
,
"user.
CTA
gid"
);
if
(
uidStr
.
empty
()
||
gidStr
.
empty
())
{
std
::
ostringstream
msg
;
...
...
@@ -680,7 +680,27 @@ std::string cta::MockNameServer::getVidOfFile(
const
SecurityIdentity
&
requester
,
const
std
::
string
&
path
,
const
uint16_t
copyNb
)
const
{
return
"T00001"
;
//everything is on one tape for the moment:)
if
(
copyNb
!=
1
||
copyNb
!=
2
)
{
std
::
ostringstream
msg
;
msg
<<
"cta::MockNameServer::getVidOfFile() - The mock nameserver only supports the copy number to be 1 or 2. Instead the one supplied is: "
<<
copyNb
;
throw
(
exception
::
Exception
(
msg
.
str
()));
}
const
std
::
string
fsPath
=
m_fsDir
+
path
;
assertFsFileExists
(
fsPath
);
std
::
list
<
cta
::
NameServerTapeFile
>
tapeFileList
;
std
::
string
copyOne
=
Utils
::
getXattr
(
fsPath
,
"user.CTATapeFileCopyOne"
);
std
::
string
copyTwo
=
Utils
::
getXattr
(
fsPath
,
"user.CTATapeFileCopyTwo"
);
if
(
copyNb
==
1
)
{
return
fromStringToNameServerTapeFile
(
copyOne
).
tapeFileLocation
.
vid
;
}
else
if
(
copyNb
==
2
)
{
return
fromStringToNameServerTapeFile
(
copyTwo
).
tapeFileLocation
.
vid
;
}
else
{
std
::
ostringstream
msg
;
msg
<<
"cta::MockNameServer::getVidOfFile() - The mock nameserver only supports the copy number to be 1 or 2. Instead the one supplied is: "
<<
copyNb
;
throw
(
exception
::
Exception
(
msg
.
str
()));
}
}
//------------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
nameserver/mockNS/makeMockNameServerBasePath.cpp
+
7
−
2
View file @
231bf910
...
...
@@ -25,6 +25,7 @@
#include
<sys/stat.h>
#include
<sys/types.h>
#include
<attr/xattr.h>
#include
<unistd.h>
#include
"common/exception/Errnum.hpp"
#include
"common/exception/Exception.hpp"
...
...
@@ -53,9 +54,13 @@ int main(void) {
cta
::
exception
::
Errnum
::
throwOnNull
(
mkdtemp
(
path
),
"MockNameServer() - Failed to create temporary directory"
);
std
::
string
pathString
(
path
);
pathString
+=
"/"
;
std
::
stringstream
uidss
;
uidss
<<
getuid
();
std
::
stringstream
gidss
;
gidss
<<
getgid
();
setXattr
(
pathString
.
c_str
(),
"user.CTAStorageClass"
,
""
);
setXattr
(
pathString
.
c_str
(),
"user.uid"
,
"0"
);
setXattr
(
pathString
.
c_str
(),
"user.gid"
,
"0"
);
setXattr
(
pathString
.
c_str
(),
"user.
CTA
uid"
,
uidss
.
str
()
);
setXattr
(
pathString
.
c_str
(),
"user.
CTA
gid"
,
gidss
.
str
()
);
std
::
cout
<<
"New mock name server path: "
<<
pathString
<<
std
::
endl
;
}
catch
(
cta
::
exception
::
Exception
&
e
)
{
std
::
cerr
<<
"Failed to create a new directory for the mock name server. CTA Exception: "
<<
e
.
getMessageValue
()
<<
std
::
endl
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment