4
4
import osgtest .library .osgunittest as osgunittest
5
5
import osgtest .library .service as service
6
6
7
+ import time
8
+
7
9
CLUSTER_NAME = 'osg_test'
8
10
CTLD_LOG = '/var/log/slurm/slurmctld.log'
11
+ SLURM_LOG = '/var/log/slurm/slurm.log'
9
12
SHORT_HOSTNAME = core .get_hostname ().split ('.' )[0 ]
10
13
11
14
SLURMDBD_CONFIG = """AuthType=auth/munge
39
42
StateSaveLocation=/var/spool/slurmd
40
43
"""
41
44
45
+ SLURM_CGROUPS_CONFIG = """CgroupAutomount=yes
46
+ CgroupMountpoint=/cgroup
47
+ ConstrainCores=no
48
+ ConstrainRAMSpace=no
49
+ """
50
+
51
+ SLURM_CGROUPS_DEVICE_CONFIG = """/dev/null
52
+ /dev/urandom
53
+ /dev/zero
54
+ /dev/sda*
55
+ /dev/cpu/*/*
56
+ /dev/pts/*
57
+ """
58
+
59
+
42
60
class TestStartSlurm (osgunittest .OSGTestCase ):
43
61
44
62
def slurm_reqs (self ):
@@ -52,6 +70,20 @@ def test_01_slurm_config(self):
52
70
SLURM_CONFIG % {'short_hostname' : SHORT_HOSTNAME , 'cluster' : CLUSTER_NAME , 'ctld_log' : CTLD_LOG },
53
71
owner = 'slurm' ,
54
72
chmod = 0644 )
73
+ core .config ['cgroup.config' ] = '/etc/slurm/cgroup.conf'
74
+ config = SLURM_CGROUPS_CONFIG
75
+ if core .el_release () == 6 :
76
+ config += "\n CgroupMountpoint=/cgroup"
77
+ files .write (core .config ['cgroup.config' ],
78
+ config ,
79
+ owner = 'slurm' ,
80
+ chmod = 0644 )
81
+
82
+ core .config ['cgroup_allowed_devices_file.conf' ] = '/etc/slurm/cgroup_allowed_devices_file.conf'
83
+ files .write (core .config ['cgroup_allowed_devices_file.conf' ],
84
+ SLURM_CGROUPS_DEVICE_CONFIG ,
85
+ owner = 'slurm' ,
86
+ chmod = 0644 )
55
87
56
88
def test_02_start_slurmdbd (self ):
57
89
core .state ['slurmdbd.started-service' ] = False
@@ -88,20 +120,31 @@ def test_03_start_slurm(self):
88
120
core .config ['slurm.service-name' ] = 'slurm'
89
121
if core .el_release () == 7 :
90
122
core .config ['slurm.service-name' ] += 'd'
123
+ core .config ['slurm.ctld-service-name' ] = 'slurmctld'
91
124
core .state ['%s.started-service' % core .config ['slurm.service-name' ]] = False
92
125
self .slurm_reqs ()
93
126
self .skip_ok_if (service .is_running (core .config ['slurm.service-name' ]), 'slurm already running' )
94
127
95
128
stat = core .get_stat (CTLD_LOG )
96
129
97
- command = ['slurmctld' ]
98
- core .check_system (command , 'enable slurmctld' )
99
- service .check_start (core .config ['slurm.service-name' ])
130
+ if core .el_release () == 7 :
131
+ # slurmctld is handled by /etc/init.d/slurm on EL6
132
+ command = ['slurmctld' ]
133
+ core .check_system (command , 'enable slurmctld' )
134
+ service .check_start (core .config ['slurm.service-name' ])
135
+ service .check_start (core .config ['slurm.ctld-service-name' ])
136
+ else :
137
+ service .check_start (core .config ['slurm.service-name' ])
100
138
101
139
core .monitor_file (CTLD_LOG ,
102
140
stat ,
103
141
'slurm_rpc_node_registration complete for %s' % SHORT_HOSTNAME ,
104
142
60.0 )
143
+ log_stat = core .get_stat (SLURM_LOG )
144
+ core .monitor_file (SLURM_LOG ,
145
+ log_stat ,
146
+ 'slurmd started' ,
147
+ 60.0 )
105
148
command = ['scontrol' , 'update' , 'nodename=%s' % SHORT_HOSTNAME , 'state=idle' ]
106
149
core .check_system (command , 'enable slurm node' )
107
150
0 commit comments