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
ce236877
Commit
ce236877
authored
6 years ago
by
Steven Murray
Browse files
Options
Downloads
Patches
Plain Diff
cta-fst-gcd can now optionally get mgmhost from /etc/cta/cta-fst-gcd.conf
parent
1c800907
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#32445
failed
2 years ago
Stage: build:srpm
Stage: build:rpm
Stage: sign
Stage: publish
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/eosfstgcd/cta-fst-gcd
+33
-17
33 additions, 17 deletions
python/eosfstgcd/cta-fst-gcd
python/eosfstgcd/cta-fst-gcd.conf.example
+1
-0
1 addition, 0 deletions
python/eosfstgcd/cta-fst-gcd.conf.example
with
34 additions
and
17 deletions
python/eosfstgcd/cta-fst-gcd
+
33
−
17
View file @
ce236877
...
...
@@ -34,23 +34,32 @@ class UserError(Exception):
class
Gc
:
def
get_env_mgmhost
(
self
):
logger
=
logging
.
getLogger
(
'
gc
'
)
if
"
EOS_MGM_URL
"
in
self
.
env
:
mgm_url
=
self
.
env
[
"
EOS_MGM_URL
"
]
if
mgm_url
:
return
re
.
sub
(
"
^x?root://
"
,
""
,
mgm_url
)
def
get_sysconfig_file_mgmhost
(
self
,
sysconfig_file
):
for
line
in
sysconfig_file
:
mgmhostline
=
re
.
match
(
"
^EOS_MGM_HOST=.*
"
,
line
)
if
mgmhostline
:
splitmgmhostline
=
mgmhostline
.
group
(
0
).
split
(
'
=
'
)
if
2
==
len
(
splitmgmhostline
):
return
splitmgmhostline
[
1
]
mgmhost
=
re
.
sub
(
"
^x?root://
"
,
""
,
mgm_url
)
logger
.
info
(
"
Determined MGM host {} from EOS_MGM_URL
"
.
format
(
mgmhost
))
return
mgmhost
logger
.
info
(
"
The environment variable EOS_MGM_URL is not set
"
)
def
get_syconfig_mgmhost
(
self
):
if
os
.
path
.
isfile
(
"
/etc/sysconfig/eos_env
"
):
sysconfig_file
=
open
(
"
/etc/sysconfig/eos_env
"
,
"
r
"
)
return
self
.
get_sysconfig_file_mgmhost
(
sysconfig_file
)
logger
=
logging
.
getLogger
(
'
gc
'
)
eos_env
=
'
/etc/sysconfig/eos_env
'
if
os
.
path
.
isfile
(
eos_env
)
and
os
.
access
(
eos_env
,
os
.
W_OK
):
sysconfig_file
=
open
(
eos_env
,
"
r
"
)
for
line
in
sysconfig_file
:
mgmhostline
=
re
.
match
(
"
^EOS_MGM_HOST=.*
"
,
line
)
if
mgmhostline
:
splitmgmhostline
=
mgmhostline
.
group
(
0
).
split
(
'
=
'
)
if
2
==
len
(
splitmgmhostline
):
mgmhost
=
splitmgmhostline
[
1
]
logger
.
info
(
"
Extracted MGM host {} from {}
"
.
format
(
mgmhost
,
eos_env
))
return
mgmhost
logger
.
info
(
"
Could not determine MGM host from {}
"
.
format
(
eos_env
))
def
setmgmhost
(
self
):
self
.
mgmhost
=
self
.
get_env_mgmhost
()
...
...
@@ -61,7 +70,7 @@ class Gc:
if
self
.
mgmhost
:
return
raise
Exception
(
"
Failed to
determine the MGM host
"
)
raise
UserError
(
"
Could not
determine the MGM host
from EOS_MGM_URL or from /etc/sysconfig/eos_env
"
)
def
configuredummylogging
(
self
):
config
=
{
...
...
@@ -132,6 +141,7 @@ class Gc:
self
.
localfilesystempaths
=
[]
self
.
nbfilesconsideredsincelastreport
=
0
self
.
nbfilesbeforereport
=
10000
self
.
mgmhost
=
None
def
eosfsls
(
self
):
logger
=
logging
.
getLogger
(
'
gc
'
)
...
...
@@ -227,6 +237,8 @@ class Gc:
def
logconf
(
self
):
logger
=
logging
.
getLogger
(
'
gc
'
)
if
self
.
mgmhost
:
logger
.
info
(
"
config mgmhost={}
"
.
format
(
self
.
mgmhost
))
logger
.
info
(
"
config minfreebytes={}
"
.
format
(
self
.
minfreebytes
))
logger
.
info
(
"
config gcagesecs={}
"
.
format
(
self
.
gcagesecs
))
...
...
@@ -240,6 +252,10 @@ class Gc:
config
.
read
(
self
.
conffilepath
)
try
:
try
:
self
.
mgmhost
=
config
.
get
(
'
main
'
,
'
mgmhost
'
)
except
ConfigParser
.
NoOptionError
:
pass
self
.
minfreebytes
=
config
.
getint
(
'
main
'
,
'
minfreebytes
'
)
self
.
gcagesecs
=
config
.
getint
(
'
main
'
,
'
gcagesecs
'
)
except
ConfigParser
.
Error
as
err
:
...
...
@@ -250,15 +266,15 @@ class Gc:
if
'
daemon
'
!=
username
:
raise
UserError
(
'
{} must be executed as user daemon and not user {}
'
.
format
(
self
.
programname
,
username
))
self
.
setmgmhost
()
self
.
configurelogging
()
logger
=
logging
.
getLogger
(
'
gc
'
)
logger
.
info
(
'
{} started
'
.
format
(
self
.
programname
))
logger
.
info
(
'
The EOS MGM host is {}
'
.
format
(
self
.
mgmhost
))
logger
.
info
(
'
The fqdn of this machine is {}
'
.
format
(
self
.
fqdn
))
self
.
readconf
()
self
.
logconf
()
if
not
self
.
mgmhost
:
self
.
setmgmhost
()
logger
.
info
(
'
The EOS MGM host is {}
'
.
format
(
self
.
mgmhost
))
minperiod
=
300
# In seconds
...
...
This diff is collapsed.
Click to expand it.
python/eosfstgcd/cta-fst-gcd.conf.example
+
1
−
0
View file @
ce236877
...
...
@@ -23,5 +23,6 @@
# There must always be a main section
[main]
mgmhost=HOSTNAME.2NDLEVEL.TOPLEVEL
minfreebytes = 10000000000 ; Minimum number of free bytes a filesystem should have
gcagesecs = 7200 ; The age at which a file can be considered for garbage collection
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