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