1
- import os
2
1
import pwd
3
2
import osgtest .library .core as core
4
3
import osgtest .library .files as files
5
4
import osgtest .library .service as service
6
5
import osgtest .library .osgunittest as osgunittest
7
6
8
7
9
- XROOTD_PORT = 1096 # chosen so it doesn't conflict w/ the stashcache instances
10
-
11
8
XROOTD_CFG_TEXT = """\
12
9
cms.space min 2g 5g
13
10
xrootd.seclib /usr/lib64/libXrdSec-4.so
20
17
%s
21
18
acc.authdb /etc/xrootd/auth_file
22
19
ofs.authorize
23
- xrd.port %d
20
+ """
21
+
22
+ # XRootD configuration necessaryfor osg-xrootd-standalone
23
+ META_XROOTD_CFG_TEXT = """\
24
+ set rootdir = /
25
+ set resourcename = OSG_TEST_XROOTD_STANDALONE
24
26
"""
25
27
26
28
AUTHFILE_TEXT = """\
29
31
u xrootd /tmp a
30
32
"""
31
33
34
+ SYSCONFIG_TEXT = """\
35
+ XROOTD_USER=xrootd
36
+ XROOTD_GROUP=xrootd
37
+
38
+ XROOTD_DEFAULT_OPTIONS="-l /var/log/xrootd/xrootd.log -c /etc/xrootd/xrootd-standalone.cfg -k fifo"
39
+ CMSD_DEFAULT_OPTIONS="-l /var/log/xrootd/cmsd.log -c /etc/xrootd/xrootd-standalone.cfg -k fifo"
40
+ PURD_DEFAULT_OPTIONS="-l /var/log/xrootd/purged.log -c /etc/xrootd/xrootd-standalone.cfg -k fifo"
41
+ XFRD_DEFAULT_OPTIONS="-l /var/log/xrootd/xfrd.log -c /etc/xrootd/xrootd-standalone.cfg -k fifo"
42
+
43
+ XROOTD_INSTANCES="default"
44
+ CMSD_INSTANCES="default"
45
+ PURD_INSTANCES="default"
46
+ XFRD_INSTANCES="default"
47
+ """
48
+
49
+
32
50
class TestStartXrootd (osgunittest .OSGTestCase ):
33
51
34
52
def setUp (self ):
35
53
if core .rpm_is_installed ("xcache" ):
36
- self .skip_ok_if (core .PackageVersion ("xcache" ) >= "1.0.2" , "xcache 1.0.2+ configs conflict with xrootd tests" )
54
+ self .skip_ok_if (core .PackageVersion ("xcache" ) >= "1.0.2" ,
55
+ "xcache 1.0.2+ configs conflict with xrootd tests" )
37
56
38
- def test_01_start_xrootd (self ):
57
+ def test_01_configure_xrootd (self ):
39
58
core .config ['xrootd.pid-file' ] = '/var/run/xrootd/xrootd-default.pid'
40
59
core .config ['certs.xrootdcert' ] = '/etc/grid-security/xrd/xrdcert.pem'
41
60
core .config ['certs.xrootdkey' ] = '/etc/grid-security/xrd/xrdkey.pem'
42
- core .config ['xrootd.config' ] = '/etc/xrootd/xrootd-clustered.cfg'
43
- core .config ['xrootd.config-extra' ] = '/etc/xrootd/config.d/99-osg-test.cfg'
44
- core .config ['xrootd.port' ] = XROOTD_PORT
61
+ if core .rpm_is_installed ('osg-xrootd-standalone' ):
62
+ # rootdir and resourcename needs to be set early for the default osg-xrootd config
63
+ core .config ['xrootd.config' ] = '/etc/xrootd/config.d/10-osg-test.cfg'
64
+ else :
65
+ core .config ['xrootd.config' ] = '/etc/xrootd/config.d/99-osg-test.cfg'
66
+ core .config ['xrootd.service-defaults' ] = '/etc/sysconfig/xrootd'
45
67
core .config ['xrootd.multiuser' ] = False
46
68
core .state ['xrootd.started-server' ] = False
47
69
core .state ['xrootd.backups-exist' ] = False
@@ -54,27 +76,28 @@ def test_01_start_xrootd(self):
54
76
core .install_cert ('certs.xrootdcert' , 'certs.hostcert' , 'xrootd' , 0o644 )
55
77
core .install_cert ('certs.xrootdkey' , 'certs.hostkey' , 'xrootd' , 0o400 )
56
78
57
- lcmaps_packages = ('lcmaps' , 'lcmaps-db-templates' , 'xrootd-lcmaps' , 'vo-client' , 'vo-client-lcmaps-voms' )
58
- if all ([core .rpm_is_installed (x ) for x in lcmaps_packages ]):
59
- core .log_message ("Using xrootd-lcmaps authentication" )
60
- sec_protocol = '-authzfun:libXrdLcmaps.so -authzfunparms:--loglevel,5'
61
- if core .PackageVersion ('xrootd-lcmaps' ) >= '1.4.0' :
62
- sec_protocol += ',--policy,authorize_only'
63
- else :
64
- core .log_message ("Using XRootD mapfile authentication" )
65
- sec_protocol = '-gridmap:/etc/grid-security/xrd/xrdmapfile'
66
- files .write ("/etc/grid-security/xrd/xrdmapfile" , "\" %s\" vdttest" % core .config ['user.cert_subject' ],
67
- owner = "xrootd" ,
68
- chown = (user .pw_uid , user .pw_gid ))
69
-
70
- if core .PackageVersion ('xrootd' ) < '1:4.9.0' :
71
- files .append (core .config ['xrootd.config' ],
72
- XROOTD_CFG_TEXT % (sec_protocol , core .config ['xrootd.port' ]),
73
- owner = 'xrootd' , backup = True )
79
+ if core .rpm_is_installed ('osg-xrootd-standalone' ):
80
+ core .log_message ("Using osg-xrootd configuration" )
81
+ xrootd_config = META_XROOTD_CFG_TEXT
74
82
else :
75
- files .write (core .config ['xrootd.config-extra' ],
76
- XROOTD_CFG_TEXT % (sec_protocol , core .config ['xrootd.port' ]),
77
- owner = 'xrootd' , backup = True , chmod = 0o644 )
83
+ lcmaps_packages = ('lcmaps' , 'lcmaps-db-templates' , 'xrootd-lcmaps' , 'vo-client' , 'vo-client-lcmaps-voms' )
84
+ if all ([core .rpm_is_installed (x ) for x in lcmaps_packages ]):
85
+ core .log_message ("Using xrootd-lcmaps authentication" )
86
+ sec_protocol = '-authzfun:libXrdLcmaps.so -authzfunparms:loglevel=5,policy=authorize_only'
87
+ else :
88
+ core .log_message ("Using XRootD mapfile authentication" )
89
+ sec_protocol = '-gridmap:/etc/grid-security/xrd/xrdmapfile'
90
+ files .write ("/etc/grid-security/xrd/xrdmapfile" , "\" %s\" vdttest" % core .config ['user.cert_subject' ],
91
+ owner = "xrootd" ,
92
+ chown = (user .pw_uid , user .pw_gid ))
93
+ xrootd_config = XROOTD_CFG_TEXT % sec_protocol
94
+
95
+ files .write (core .config ['xrootd.config' ], xrootd_config , owner = 'xrootd' , backup = True , chmod = 0o644 )
96
+
97
+ if core .el_release () < 7 :
98
+ files .write (core .config ['xrootd.service-defaults' ], SYSCONFIG_TEXT ,
99
+ owner = "xrootd" , chown = (user .pw_uid , user .pw_gid ), chmod = 0o644 )
100
+
78
101
authfile = '/etc/xrootd/auth_file'
79
102
files .write (authfile , AUTHFILE_TEXT , owner = "xrootd" , chown = (user .pw_uid , user .pw_gid ))
80
103
@@ -83,28 +106,22 @@ def test_01_start_xrootd(self):
83
106
def test_02_configure_hdfs (self ):
84
107
core .skip_ok_unless_installed ('xrootd-hdfs' )
85
108
hdfs_config = "ofs.osslib /usr/lib64/libXrdHdfs.so"
86
- if core .PackageVersion ('xrootd' ) < '1:4.9.0' :
87
- files .append (core .config ['xrootd.config' ], hdfs_config , backup = False )
88
- else :
89
- files .append (core .config ['xrootd.config-extra' ], hdfs_config , backup = False )
109
+ files .append (core .config ['xrootd.config' ], hdfs_config , backup = False )
90
110
91
111
def test_03_configure_multiuser (self ):
92
- core .skip_ok_unless_installed ('xrootd-multiuser' ,'globus-proxy-utils' , by_dependency = True )
112
+ core .skip_ok_unless_installed ('xrootd-multiuser' , 'globus-proxy-utils' , by_dependency = True )
93
113
xrootd_multiuser_conf = "xrootd.fslib libXrdMultiuser.so default"
94
- if core .PackageVersion ('xrootd' ) < '1:4.9.0' :
95
- files .append (core .config ['xrootd.config' ], xrootd_multiuser_conf , owner = 'xrootd' , backup = False )
96
- else :
97
- files .append (core .config ['xrootd.config-extra' ], xrootd_multiuser_conf , owner = 'xrootd' , backup = False )
114
+ files .append (core .config ['xrootd.config' ], xrootd_multiuser_conf , owner = 'xrootd' , backup = False )
98
115
core .config ['xrootd.multiuser' ] = True
99
116
100
117
def test_04_start_xrootd (self ):
101
118
core .skip_ok_unless_installed ('xrootd' , by_dependency = True )
102
119
if core .el_release () < 7 :
103
120
core .config ['xrootd_service' ] = "xrootd"
104
121
elif core .config ['xrootd.multiuser' ]:
105
- core .config ['xrootd_service' ] = "xrootd-privileged@clustered "
122
+ core .config ['xrootd_service' ] = "xrootd-privileged@standalone "
106
123
else :
107
- core .config ['xrootd_service' ] = "xrootd@clustered "
124
+ core .config ['xrootd_service' ] = "xrootd@standalone "
108
125
109
126
service .check_start (core .config ['xrootd_service' ])
110
127
core .state ['xrootd.started-server' ] = True
0 commit comments