/[pdpsoft]/trunk/nl.nikhef.ndpf.tools/globus-yaim-gram5/config_gip_gram5_glue13
ViewVC logotype

Contents of /trunk/nl.nikhef.ndpf.tools/globus-yaim-gram5/config_gip_gram5_glue13

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2541 - (show annotations) (download)
Fri Apr 27 11:16:39 2012 UTC (10 years, 2 months ago) by davidg
File size: 31027 byte(s)
fixup

1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) Members of the EGEE Collaboration. 2004.
4 # See http://www.eu-egee.org/partners/ for details on the copyright
5 # holders.
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 # http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 ##############################################################################
19 #
20 # NAME : config_gram5_gip
21 #
22 # DESCRIPTION : This function configures the generic information providor (GIP)
23 # for a GRAM5
24 #
25 # MODIFIED BY : davidg@nikhef.nl
26 #
27 # ORIGINAL AUTHORS : grid-release@infn.it massimo.sgaravatto@pd.infn.it
28 #
29 # NOTES : Support installation of GRAM5 - modified from CREAM UMD
30 # version
31 #
32 # YAIM MODULE: org.globus.gram5.gip.glue13
33 #
34 ##############################################################################
35
36
37 config_gip_gram5_glue13_setenv () {
38 yaimlog DEBUG "This function currently doesn't set any environment variables."
39 }
40
41
42 config_gip_gram5_glue13_check () {
43 if [ "x${CREAM_CLUSTER_MODE}" = "xyes" ]; then
44 config_gip_gram5_glue13_check_cluster
45 else
46 config_gip_gram5_glue13_check_nocluster
47 fi
48 }
49
50
51 config_gip_gram5_glue13 () {
52
53 requires $1 CE_BATCH_SYS BATCH_SERVER
54
55 # configure a dynamic plugin if we have the dependencies and it is pbs
56 if [ "$CE_BATCH_SYS" = "pbs" -a -x /usr/libexec/lcg-info-dynamic-pbs ]; then
57 config_gip_gram5_glue13_pbs
58 fi
59
60 if [ "x${CREAM_CLUSTER_MODE}" = "xyes" ]; then
61 config_gip_gram5_glue13_cluster
62 else
63 config_gip_gram5_glue13_nocluster
64 fi
65
66 }
67
68 function config_gip_gram5_glue13_pbs () {
69
70 requires $1 CE_BATCH_SYS BATCH_SERVER
71
72 yaimlog DEBUG "Considering dynamic plugin for PBS batch system"
73
74 GIP_DATA=${GIP_DATA:-/var/lib/bdii/gip}
75 PLUGIN_DIR="${GIP_DATA}/plugin"
76 LOCATION_ETC=${LOCATION_ETC:-/etc}
77
78 if [ -d "$PLUGIN_DIR" ]; then
79 yaimlog DEBUG "Configuring dynamic plugin for PBS batch system on ${BATCH_SERVER}"
80 cat > "$PLUGIN_DIR"/globus-gram5-info-dynamic-ce <<EOF
81 #! /bin/sh
82 if [ -f "${GIP_DATA}/ldif/static-file-CE.ldif" ]; then
83 /usr/libexec/lcg-info-dynamic-pbs "${GIP_DATA}/ldif/static-file-CE.ldif" ${BATCH_SERVER}
84 fi
85 EOF
86 chmod +x "$PLUGIN_DIR"/globus-gram5-info-dynamic-ce
87 else
88 yaimlog WARNING "No dynamic plugin found or non-PBS batch system"
89 fi
90
91 TORQUE_VAR_DIR="${TORQUE_VAR_DIR:-/var/torque}"
92
93 ### Auxiliary script parameters
94 BATCH_SYS=`echo $CE_BATCH_SYS | tr '[:upper:]' '[:lower:]'`
95
96 yaimlog DEBUG "Checks if the batch system is correct for this function"
97 ####@ Checks if the batch system is correct for this function
98 if [ ${BATCH_SYS} != "pbs" ] && [ ${BATCH_SYS} != "torque" ] ; then
99 yaimlog ERROR "Running config_gip_sched_plugin_pbs but current CE_BATCH_SYS is ${BATCH_SYS}"
100 return 1
101 fi
102
103 yaimlog DEBUG "Define the 'max jobs' cmd for the VOs"
104 ####@ Define the 'max jobs' cmd for the VOs
105 vo_max_jobs_cmd=""
106 if ( diagnose -g --host=${BATCH_SERVER} > /dev/null 2>&1 ); then
107 vo_max_jobs_cmd="/usr/libexec/vomaxjobs-maui -h ${BATCH_SERVER}"
108 fi
109
110 yaimlog DEBUG "Add BATCH_SERVER to the $TORQUE_VAR_DIR/server_name file to enable torque clients"
111 ####@ Add BATCH_SERVER to the $TORQUE_VAR_DIR/server_name file to enable torque clients.
112 if [ -d $TORQUE_VAR_DIR ]; then
113 echo $BATCH_SERVER > $TORQUE_VAR_DIR/server_name
114 fi
115 mylrmsinfo=/usr/libexec/lrmsinfo-pbs
116
117 yaimlog DEBUG "Create ERT configuration"
118 ####@ Create ERT configuration
119
120 INFOD_SCHED_WRAP="${PLUGIN_DIR}/glite-info-dynamic-scheduler-wrapper"
121 LDIF_FILE="static-file-CE.ldif"
122 sched_conf="${LOCATION_ETC}/lcg-info-dynamic-scheduler.conf"
123
124 ####@ Writes the wrapper for the information provider
125 cat << EOF > ${INFOD_SCHED_WRAP}
126 #!/bin/sh -l
127 export PYTHONPATH=/usr/lib/python:$PYTHONPATH
128 ${GLITE_CREAM_LOCATION_LIBEXEC}/lcg-info-dynamic-scheduler -c ${sched_conf}
129 EOF
130 chmod +x ${INFOD_SCHED_WRAP}
131
132
133 ####@ Writes the [Main] section of the lcg-info-dynamic-scheduler.conf file.
134
135 cat <<EOF > ${sched_conf}
136 [Main]
137 static_ldif_file: ${GIP_DATA}/ldif/$LDIF_FILE
138 vomap :
139 EOF
140
141 {
142 while IFS=: read myfqan mygroup mygroupid mytag myvo; do
143
144 # strip off the " marks
145 myfqan=`echo ${myfqan} | sed -e 's/\"//g'`
146
147 # determine vo from VOMS FQAN if not defined
148 convert_fqan "${myfqan}"
149
150 if [ ! "${myvo}" ]; then
151 suppvo="${newfqanvo}"
152 else
153 suppvo="${myvo}"
154 fi
155
156 # Is the VO supported ?
157 if [ `echo $VOS | grep -i -w "${suppvo}" | cut -f 1 -d " "` ]; then
158
159 # If yes and mygroup is also defined ....
160 if [ "${mygroup}" ] && [ "${myfqan}" ]; then
161 if [ "x${FQANVOVIEWS}" = "xyes" ]; then
162 echo " $mygroup:$newfqan" >> ${sched_conf}
163 else
164 echo " $mygroup:$suppvo" >> ${sched_conf}
165 fi
166 # If yes and group is not defined but tag is defined then we can figure out the group
167 elif [ "${mytag}" ] && [ "${myfqan}" ]; then
168 mygroup=`users_getvogroup ${myfqan}`
169 if [ "${mygroup}" ]; then
170 if [ "x${FQANVOVIEWS}" = "xyes" ]; then
171 echo " ${mygroup}:${newfqan}" >> ${sched_conf}
172 else
173 echo " ${mygroup}:${suppvo}" >> ${sched_conf}
174 fi
175 fi
176 # Otherwise we just map to the standars VO unix group
177 else
178 mygroup=`users_getvogroup ${suppvo}`
179 if [ "x${mygroup}" != "x${suppvo}" ]; then
180 if [ "x${FQANVOVIEWS}" = "xyes" ]; then
181 echo " ${mygroup}:${newfqan}" >> ${sched_conf}
182 else
183 echo " ${mygroup}:${suppvo}" >> ${sched_conf}
184 fi
185 fi
186 fi
187 fi
188 done
189 } < ${GROUPS_CONF}
190
191
192
193
194 cat <<EOF >> ${sched_conf}
195 module_search_path : ../lrms:../ett
196 [LRMS]
197 lrms_backend_cmd: $mylrmsinfo
198 [Scheduler]
199 cycle_time : 0
200 EOF
201
202 if [ "$vo_max_jobs_cmd" ]; then
203 echo "vo_max_jobs_cmd: $vo_max_jobs_cmd" >> ${sched_conf}
204 fi
205
206 }
207
208
209 function config_gip_gram5_glue13_check_nocluster () {
210
211 requires $1 SE_LIST JOB_MANAGER VOS QUEUES CE_BATCH_SYS \
212 CE_CPU_MODEL CE_CPU_VENDOR CE_CPU_SPEED CE_OS CE_OS_RELEASE \
213 CE_MINPHYSMEM CE_MINVIRTMEM CE_SMPSIZE CE_SI00 CE_SF00 \
214 CE_OUTBOUNDIP CE_INBOUNDIP CE_RUNTIMEENV \
215 CE_PHYSCPU CE_LOGCPU CREAM_CE_STATE GROUPS_CONF \
216 CE_OS_ARCH CE_OS_VERSION \
217 CE_CAPABILITY CE_OTHERDESCR VO_SW_DIR \
218 SE_MOUNT_INFO_LIST __GROUP_ENABLE
219
220 ret_cod1=$?
221
222 BATCH_SYS=`echo $CE_BATCH_SYS | tr '[:upper:]' '[:lower:]'`
223 if [ "x$BATCH_SYS" == "xlsf" ]; then
224 requires $1 BATCH_BIN_DIR LSFPROFILE_DIR
225 ret_cod2=$?
226 else if [ $BATCH_SYS = pbs ] || [ $BATCH_SYS = torque ] ; then
227 requires $1 BATCH_SERVER
228 ret_cod2=$?
229 fi
230 fi
231 if [ ! $ret_cod1 == 0 ] || [ ! $ret_cod2 == 0 ]; then
232 return 1
233 else
234 return 0
235 fi
236
237 }
238
239
240 function config_gip_gram5_glue13_nocluster () {
241
242 # Fix bug #51706
243 JOB_MANAGER=`echo $JOB_MANAGER | sed 's/^lcg//'`
244
245 # Auxiliary parameters
246 GIP_DATA=${GIP_DATA:-/var/lib/bdii/gip}
247 LDIF_DIR="${GIP_DATA}/ldif"
248
249 # Info config for GRAM5
250 ce_port=2119
251 ce_type="jobmanager"
252 info_port=2170
253 info_type=resource
254 ce_impl_ver=`rpm -q --qf %{V} globus-gram-job-manager`
255 ce_impl_name=globus
256
257 # Set default SE info
258 default_se=`set x $SE_LIST; echo "$2"`
259 if [ "$default_se" ]; then
260 for VO in `echo $VOS | tr '[:lower:]' '[:upper:]'`; do
261 if [ "x`get_vo_param ${VO} DEFAULT_SE`" = "x" ]; then
262 set_vo_param ${VO} DEFAULT_SE $default_se
263 fi
264 done
265 fi
266
267
268 #=============
269 # GlueCluster
270 #=============
271
272 # Define conf file
273 outfile=${LDIF_DIR}/static-file-Cluster.ldif
274
275 cat << EOF > $outfile
276 dn: GlueClusterUniqueID=${CE_HOST},mds-vo-name=resource,o=grid
277 objectClass: GlueClusterTop
278 objectClass: GlueCluster
279 objectClass: GlueInformationService
280 objectClass: GlueKey
281 objectClass: GlueSchemaVersion
282 GlueClusterUniqueID: ${CE_HOST}
283 GlueClusterName: ${CE_HOST}
284 GlueForeignKey: GlueSiteUniqueID=${SITE_NAME}
285 EOF
286
287 for QUEUE in $QUEUES; do
288 echo "GlueForeignKey:" \
289 "GlueCEUniqueID: ${CE_HOST}:${ce_port}/${ce_type}-$JOB_MANAGER-$QUEUE" >> $outfile
290 done
291
292 for QUEUE in $QUEUES; do
293 echo "GlueClusterService: ${CE_HOST}:${ce_port}/${ce_type}-$JOB_MANAGER-$QUEUE" >> $outfile
294 done
295
296 cat << EOF >> $outfile
297 GlueInformationServiceURL: ldap://`hostname -f`:${info_port}/mds-vo-name=${info_type},o=grid
298 GlueSchemaVersionMajor: 1
299 GlueSchemaVersionMinor: 3
300
301 EOF
302
303 cat << EOF >> $outfile
304 dn: GlueSubClusterUniqueID=${CE_HOST},GlueClusterUniqueID=${CE_HOST},mds-vo-name=resource,o=grid
305 objectClass: GlueClusterTop
306 objectClass: GlueSubCluster
307 objectClass: GlueHostApplicationSoftware
308 objectClass: GlueHostArchitecture
309 objectClass: GlueHostBenchmark
310 objectClass: GlueHostMainMemory
311 objectClass: GlueHostNetworkAdapter
312 objectClass: GlueHostOperatingSystem
313 objectClass: GlueHostProcessor
314 objectClass: GlueInformationService
315 objectClass: GlueKey
316 objectClass: GlueSchemaVersion
317 GlueSubClusterUniqueID: ${CE_HOST}
318 GlueChunkKey: GlueClusterUniqueID=${CE_HOST}
319 GlueHostArchitecturePlatformType: ${CE_OS_ARCH}
320 GlueHostArchitectureSMPSize: ${CE_SMPSIZE}
321 GlueHostBenchmarkSF00: ${CE_SF00}
322 GlueHostBenchmarkSI00: ${CE_SI00}
323 GlueHostMainMemoryRAMSize: ${CE_MINPHYSMEM}
324 GlueHostMainMemoryVirtualSize: ${CE_MINVIRTMEM}
325 GlueHostNetworkAdapterInboundIP: ${CE_INBOUNDIP}
326 GlueHostNetworkAdapterOutboundIP: ${CE_OUTBOUNDIP}
327 GlueHostOperatingSystemName: ${CE_OS}
328 GlueHostOperatingSystemRelease: ${CE_OS_RELEASE}
329 GlueHostOperatingSystemVersion: ${CE_OS_VERSION}
330 GlueHostProcessorClockSpeed: ${CE_CPU_SPEED}
331 GlueHostProcessorModel: ${CE_CPU_MODEL}
332 GlueHostProcessorVendor: ${CE_CPU_VENDOR}
333 GlueHostProcessorOtherDescription: ${CE_OTHERDESCR}
334 GlueSubClusterName: ${CE_HOST}
335 GlueSubClusterPhysicalCPUs: ${CE_PHYSCPU}
336 GlueSubClusterLogicalCPUs: ${CE_LOGCPU}
337 GlueSubClusterTmpDir: /tmp
338 GlueSubClusterWNTmpDir: /tmp
339 GlueInformationServiceURL: ldap://`hostname -f`:${info_port}/mds-vo-name=${info_type},o=grid
340 GlueSchemaVersionMajor: 1
341 GlueSchemaVersionMinor: 3
342 EOF
343
344 for x in $CE_RUNTIMEENV; do
345 echo "GlueHostApplicationSoftwareRunTimeEnvironment: $x" >> $outfile
346 done
347
348
349 #========
350 # GlueCE
351 #========
352
353 # Define ldif file
354 GIP_DATA=${GIP_DATA:-/var/lib/bdii/gip}
355 LDIF_DIR="${GIP_DATA}/ldif"
356 outfile=${LDIF_DIR}/static-file-CE.ldif
357
358 cat /dev/null > $outfile
359
360 # for (1) - BEGIN
361 for QUEUE in $QUEUES; do
362 cat << EOF >> $outfile
363
364
365
366 dn: GlueCEUniqueID=${CE_HOST}:${ce_port}/${ce_type}-$JOB_MANAGER-$QUEUE,mds-vo-name=resource,o=grid
367 objectClass: GlueCETop
368 objectClass: GlueCE
369 objectClass: GlueCEAccessControlBase
370 objectClass: GlueCEInfo
371 objectClass: GlueCEPolicy
372 objectClass: GlueCEState
373 objectClass: GlueInformationService
374 objectClass: GlueKey
375 objectClass: GlueSchemaVersion
376 GlueCEUniqueID: ${CE_HOST}:${ce_port}/${ce_type}-$JOB_MANAGER-$QUEUE
377 GlueCEHostingCluster: ${CE_HOST}
378 GlueCEName: $QUEUE
379 GlueCEImplementationName: $ce_impl_name
380 GlueCEImplementationVersion: $ce_impl_ver
381 GlueCEInfoGatekeeperPort: ${ce_port}
382 GlueCEInfoHostName: ${CE_HOST}
383 GlueCEInfoLRMSType: $CE_BATCH_SYS
384 GlueCEInfoLRMSVersion: not defined
385 GlueCEInfoTotalCPUs: 0
386 GlueCEInfoJobManager: ${JOB_MANAGER}
387 GlueCEInfoContactString: https://${CE_HOST}:${ce_port}/jobmanager-${JOB_MANAGER}
388 GlueCEInfoApplicationDir: ${VO_SW_DIR}
389 GlueCEInfoDataDir: ${CE_DATADIR:-unset}
390 GlueCEInfoDefaultSE: $default_se
391 GlueCEStateEstimatedResponseTime: 2146660842
392 GlueCEStateFreeCPUs: 0
393 GlueCEStateRunningJobs: 0
394 GlueCEStateStatus: ${CREAM_CE_STATE}
395 GlueCEStateTotalJobs: 0
396 GlueCEStateWaitingJobs: 444444
397 GlueCEStateWorstResponseTime: 2146660842
398 GlueCEStateFreeJobSlots: 0
399 GlueCEPolicyMaxCPUTime: 999999999
400 GlueCEPolicyMaxRunningJobs: 999999999
401 GlueCEPolicyMaxTotalJobs: 999999999
402 GlueCEPolicyMaxWallClockTime: 999999999
403 GlueCEPolicyMaxObtainableCPUTime: 999999999
404 GlueCEPolicyMaxObtainableWallClockTime: 999999999
405 GlueCEPolicyMaxWaitingJobs: 999999999
406 GlueCEPolicyMaxSlotsPerJob: 999999999
407 GlueCEPolicyPreemption: 0
408 GlueCEPolicyPriority: 1
409 GlueCEPolicyAssignedJobSlots: 0
410 GlueForeignKey: GlueClusterUniqueID=${CE_HOST}
411 GlueInformationServiceURL: ldap://`hostname -f`:${info_port}/mds-vo-name=${info_type},o=grid
412 GlueSchemaVersionMajor: 1
413 GlueSchemaVersionMinor: 3
414 EOF
415
416 for capa in ${CE_CAPABILITY}; do
417 echo "GlueCECapability: ${capa}" >> $outfile
418 done
419
420 # Converting the dots and dashes to underscore to get the proper variable name
421 dnssafevar=`echo $QUEUE | sed -e 's/[\.-]/_/g' | tr '[:lower:]' '[:upper:]'`
422 qenablevar=${dnssafevar}_GROUP_ENABLE
423
424 if [ "${!qenablevar}" ] ; then
425 # Here we add the VO names or/and VOMS FQANs to the GlueCEUniqueID's ACBR list
426 for vomsgroup in ${!qenablevar}; do
427 echo -n "GlueCEAccessControlBaseRule: " >> $outfile
428 convert_fqan "${vomsgroup}"
429 if [ ! `echo ${vomsgroup} | grep "/"` ]; then
430 echo "VO:${newfqanvo}" >> $outfile
431 if ( echo "${vomsgroup}" | egrep -q '^/[^/]*$' ); then
432 yaimlog WARNING "Queue $QUEUE was enabled for one or more FQANs which specify an entire VO"
433 fi
434 else
435 yaimlog WARNING "Queue $QUEUE was enabled for one or more FQANs which specify an entire VO"
436 echo "VOMS:${newfqan}" >> $outfile
437 fi
438 done
439
440 # Now, we publish the VOViews belonging to the given GlueCEUniqueID
441 # for (2) - BEGIN
442 for vomsgroup in ${!qenablevar}; do
443 convert_fqan "${vomsgroup}"
444
445 # Keep the possibility to turn off the whole stuff
446 if [ "x${FQANVOVIEWS}" = "xyes" ] || ([ ! `echo ${vomsgroup} | grep "/"` ] && [ "x${FQANVOVIEWS}" = "xno" ] ) ; then
447 myview=`echo ${newfqan} | sed -e 's/=/_/g'`
448 myaccessrule="VOMS:${newfqan}"
449 VO="${newfqanvo}"
450
451 # To make VO determination `GEAR - safe `
452 if [ ! `echo $vomsgroup | grep "/"` ]; then
453 mygroupsdotconfvo=`cat $GROUPS_CONF | grep $vomsgroup | head -1 | cut -d ":" -f 5`
454 if [ ${mygroupsdotconfvo} ]; then
455 VO=${mygroupsdotconfvo}
456 else
457 VO="${newfqanvo}"
458 fi
459 myaccessrule="VO:${VO}"
460 fi
461
462 cat << EOF >> $outfile
463
464 dn: GlueVOViewLocalID=$myview,\
465 GlueCEUniqueID=${CE_HOST}:${ce_port}/${ce_type}-${JOB_MANAGER}-${QUEUE},mds-vo-name=resource,o=grid
466 objectClass: GlueCETop
467 objectClass: GlueVOView
468 objectClass: GlueCEInfo
469 objectClass: GlueCEState
470 objectClass: GlueCEAccessControlBase
471 objectClass: GlueCEPolicy
472 objectClass: GlueKey
473 objectClass: GlueSchemaVersion
474 GlueVOViewLocalID: $myview
475 GlueCEStateRunningJobs: 0
476 GlueCEStateWaitingJobs: 444444
477 GlueCEStateTotalJobs: 0
478 GlueCEStateFreeJobSlots: 0
479 GlueCEStateEstimatedResponseTime: 2146660842
480 GlueCEStateWorstResponseTime: 2146660842
481 GlueCEInfoDefaultSE: `get_vo_param ${VO} DEFAULT_SE`
482 GlueCEInfoApplicationDir: `get_vo_param ${VO} SW_DIR`
483 GlueCEInfoDataDir: ${CE_DATADIR:-unset}
484 GlueChunkKey: GlueCEUniqueID=${CE_HOST}:${ce_port}/${ce_type}-${JOB_MANAGER}-${QUEUE}
485 GlueCEAccessControlBaseRule: $myaccessrule
486 GlueSchemaVersionMajor: 1
487 GlueSchemaVersionMinor: 3
488 EOF
489
490 # Here we add the DENY strings only for the generic VOview, i.e which does not contain "/"
491 allvoview="";thisqueuevoview=""
492 # Collecting all VoView defs
493 for OQUEUE in ${QUEUES}; do
494 dsv=`echo $OQUEUE | sed -e 's/[\.-]/_/g' | tr '[:lower:]' '[:upper:]'`
495 oqenvar=${dsv}_GROUP_ENABLE
496 allvoview="${allvoview} ${!oqenvar}"
497 done
498 # Sort and drop entries whic appears twice
499 allvoview=`for kk in $allvoview; do echo $kk; done | sort | uniq`;
500
501 # Add the DENY stuff only if it is the generic VOview, i.e the VO itself -> no '/' in it's name
502
503 if [ ! `echo ${vomsgroup} | grep "/"` ]; then
504 convert_fqan ${vomsgroup}
505 vomsgroupvo="${newfqanvo}"
506
507 for myview in ${allvoview}; do
508 convert_fqan ${myview}
509 # We don't deny ourselves...
510
511 if [ "x${myview}" != "x${vomsgroup}" ]; then
512
513 # .. and we put DENY only if it is in the same VO, otherwise it doesn't match, so DENY is not necessary
514 if [ "x${vomsgroupvo}" = "x${newfqanvo}" ] && [ "x${FQANVOVIEWS}" = "xyes" ]; then
515 echo -n "GlueCEAccessControlBaseRule: " >> $outfile
516 if [ `echo ${myview} | grep "/"` ] ; then
517 echo "DENY:${newfqan}" >> $outfile
518 fi
519 fi
520 fi
521 done
522 fi
523 # This is the end of the FQANVOVIEWS if
524 fi # if (2) - END
525 # End of qenablevar loop
526 done # for (2) - END
527 # End of qenablevar if
528 fi # if (1) - END
529 done # for () - END
530
531 #==============
532 # GlueCESEBind
533 #==============
534
535 # Create conf file
536 outfile=${LDIF_DIR}/static-file-CESEBind.ldif
537
538 cat /dev/null > $outfile
539 for QUEUE in $QUEUES; do
540 cat <<EOF >> $outfile
541 dn: GlueCESEBindGroupCEUniqueID=${CE_HOST}:${ce_port}/${ce_type}-${JOB_MANAGER}-${QUEUE},mds-vo-name=resource,o=grid
542 objectClass: GlueGeneralTop
543 objectClass: GlueCESEBindGroup
544 objectClass: GlueSchemaVersion
545 GlueCESEBindGroupCEUniqueID: ${CE_HOST}:${ce_port}/${ce_type}-${JOB_MANAGER}-${QUEUE}
546 EOF
547 for se in $SE_LIST; do
548 echo "GlueCESEBindGroupSEUniqueID: $se" >> $outfile
549 done
550 cat <<EOF >> $outfile
551 GlueSchemaVersionMajor: 1
552 GlueSchemaVersionMinor: 3
553
554 EOF
555 done
556
557 for se in ${SE_LIST};
558 do
559 accesspoint="n.a"
560 for item in ${SE_MOUNT_INFO_LIST}
561 do
562 se_aux=${item%:*}
563 if [ "x${se}" == "x${se_aux}" ]; then
564 accesspoint=${item#*:}
565 export=${accesspoint%,*}
566 mount=${accesspoint#*,}
567 accesspoint="${mount},${export}"
568 break
569 fi
570 done
571 for QUEUE in $QUEUES;
572 do
573 cat << EOF >> $outfile
574
575 dn: GlueCESEBindSEUniqueID=$se,\
576 GlueCESEBindGroupCEUniqueID=${CE_HOST}:${ce_port}/${ce_type}-${JOB_MANAGER}-${QUEUE},mds-vo-name=resource,o=grid
577 objectClass: GlueGeneralTop
578 objectClass: GlueCESEBind
579 objectClass: GlueSchemaVersion
580 GlueCESEBindSEUniqueID: $se
581 GlueCESEBindCEAccesspoint: $accesspoint
582 GlueCESEBindCEUniqueID: ${CE_HOST}:${ce_port}/${ce_type}-$JOB_MANAGER-$QUEUE
583 GlueCESEBindMountInfo: $accesspoint
584 GlueCESEBindWeight: 0
585 GlueSchemaVersionMajor: 1
586 GlueSchemaVersionMinor: 3
587
588 EOF
589 done #queues
590 done # se
591
592 # Exit with success
593 return 0
594 }
595
596
597 config_gip_gram5_glue13_check_cluster () {
598 requires $1 SE_LIST CE_BATCH_SYS VOS CE_HOST
599 ret=$?
600 CE_name=`echo ${CE_HOST} | sed -e 's/-/_/g' -e 's/\./_/g' | tr '[:upper:]' '[:lower:]'`
601 requires $1 CE_HOST_${CE_name}_QUEUES CE_HOST_${CE_name}_CE_InfoJobManager \
602 CE_HOST_${CE_name}_QUEUE__CE_AccessControlBaseRule CE_HOST_${CE_name}_CLUSTER_UniqueID \
603 CE_HOST_${CE_name}_CE_TYPE
604 let "ret |= $?"
605 for i in InfoApplicationDir CAPABILITY; do
606 if [ ! "`eval echo "\\$CE_$i"`" ]; then
607 if [ ! "`eval echo "\\$CE_HOST_${CE_name}_CE_$i"`" ]; then
608 requires $1 CE_HOST_${CE_name}_QUEUE__CE_$i
609 if [ $? -ne 0 ]; then
610 yaimlog ERROR "(And neither is CE_HOST_${CE_name}_CE_$i nor CE_$i)"
611 ret=1
612 fi
613 fi
614 fi
615 done
616 if [ $ret -ne 0 ]; then
617 return 1
618 fi
619 return 0
620 }
621
622
623
624 config_gip_gram5_glue13_cluster () {
625
626
627 yaimlog DEBUG "Configuring the GlueCE"
628
629 info_type=resource
630
631 # Define ldif file
632 GIP_DATA=${GIP_DATA:-/var/lib/bdii/gip}
633 LDIF_DIR="${GIP_DATA}/ldif"
634 OUTFILE=${LDIF_DIR}/static-file-CE.ldif
635 cat /dev/null > ${OUTFILE}
636
637 CE_name=`echo ${CE_HOST} | sed -e 's/[\.-]/_/g' | tr '[:upper:]' '[:lower:]'` # Transform . and - into _ for the variable name.
638 ce_type=`eval echo "\\$CE_HOST_${CE_name}_CE_TYPE"`
639
640 for QUEUE in `eval echo "\\$CE_HOST_${CE_name}_QUEUES"`; do
641 QUEUE_name=`echo ${QUEUE} | sed -e 's/[\.-]/_/g' | tr '[:lower:]' '[:upper:]'`
642
643 yaimlog DEBUG "Configuring the queue information for queue ${QUEUE} for CE ${CE_name}"
644 echo "" >> $OUTFILE
645 echo "dn: GlueCEUniqueID=${CE_HOST}:8443/${ce_type}-`eval echo "\\$CE_HOST_${CE_name}_CE_InfoJobManager"`-${QUEUE},mds-vo-name=resource,o=grid" >> $OUTFILE
646 cat <<EOF >> $OUTFILE
647 objectClass: GlueCETop
648 objectClass: GlueCE
649 objectClass: GlueCEAccessControlBase
650 objectClass: GlueCEInfo
651 objectClass: GlueCEPolicy
652 objectClass: GlueCEState
653 objectClass: GlueInformationService
654 objectClass: GlueKey
655 objectClass: GlueSchemaVersion
656 GlueSchemaVersionMajor: 1
657 GlueSchemaVersionMinor: 3
658 EOF
659 echo "GlueCEUniqueID: ${CE_HOST}:8443/${ce_type}-`eval echo "\\$CE_HOST_${CE_name}_CE_InfoJobManager"`-${QUEUE}" >> $OUTFILE
660 echo "GlueCEHostingCluster: ${CE_HOST}" >> $OUTFILE
661 echo "GlueCEName: ${QUEUE}" >> $OUTFILE
662 echo "GlueCEInfoContactString: https://${CE_HOST}:2119/$JOB_MANAGER" >> $OUTFILE
663
664 for i in ${CE_VAR}; do
665 if [ "`eval echo "\\$CE_HOST_${CE_name}_QUEUE_${QUEUE_name}_CE_$i"`" ]; then # user defined value for CE - queue
666 yaimlog DEBUG "using user defined value at CE-queue level for GlueCE attribute $i"
667 var="`eval echo "\\$CE_HOST_${CE_name}_QUEUE_${QUEUE_name}_CE_$i"`"
668 elif [ "`eval echo "\\$CE_HOST_${CE_name}_CE_$i"`" ]; then
669 yaimlog DEBUG "using user defined value at CE level for GlueCE attribute $i"
670 var="`eval echo "\\$CE_HOST_${CE_name}_CE_$i"`"
671 else
672 yaimlog DEBUG "using user defined value at site level for GlueCE attribute $i"
673 var="`eval echo "\\$CE_$i"`"
674 fi
675 if [ "x$var" != "x" ]; then
676 if [ $i != "CAPABILITY" ]; then
677 echo "GlueCE$i: $var" >> ${OUTFILE}
678 else
679 for capa in $var; do
680 echo "GlueCECapability: ${capa}" >> $OUTFILE
681 done
682 fi
683 elif [ $i == "InfoDefaultSE" ]; then
684 TEMP_SE=`eval echo \$SE_LIST | sed s'/^[ ]*//'`; # default SE taken from SE_LIST
685 default_se="${TEMP_SE%% *}"
686 yaimlog DEBUG "using SE_LIST first value for GlueCE$i"
687 echo "GlueCE$i: ${default_se}" >> ${OUTFILE}
688 fi
689 done # Glue CE
690 echo "GlueForeignKey: GlueClusterUniqueID=`eval echo "\\$CE_HOST_${CE_name}_CLUSTER_UniqueID"`" >> $OUTFILE
691 echo "GlueInformationServiceURL: ldap://`hostname -f`:${info_port}/mds-vo-name=${info_type},o=grid" >> $OUTFILE
692
693 # Decide whether multiple value glue variables have the same separator
694 # or whether we keep old syntax in certain variables
695 #OLDIFS=$IFS
696 #IFS="|"
697 var=CE_HOST_${CE_name}_QUEUE_${QUEUE_name}_CE_AccessControlBaseRule
698 eval var=\$$var
699 for j in $var; do
700 convert_fqan "${j}"
701 if [ ! `echo ${j} | grep "/"` ]; then
702 echo "GlueCEAccessControlBaseRule: VO:${newfqanvo}" >> ${OUTFILE}
703 else
704 echo "GlueCEAccessControlBaseRule: VOMS:${newfqan}" >> ${OUTFILE}
705 fi
706 done
707 #IFS=$OLDIFS
708
709 ##########
710 # VOView #
711 ##########
712
713 yaimlog DEBUG "Configuring the VOView information for queue ${QUEUE} for CE ${CE_name}"
714
715 for j in $var; do
716 echo "" >> $OUTFILE
717 if [ "x${FQANVOVIEWS}" = "xyes" ] || ([ ! `echo $j | grep "/"` ] && [ "x${FQANVOVIEWS}" = "xno" ] ) ; then
718 convert_fqan "${j}"
719 voview=`echo ${j} | sed -e 's/=/_/g'`
720 voview_name=`echo ${voview} | sed -e 's/\//_/g' | sed -e 's/[\.-]/_/g' | tr '[:lower:]' '[:upper:]'`
721 echo "dn: GlueVOViewLocalID=${voview},GlueCEUniqueID=${CE_HOST}:8443/${ce_type}-`eval echo "\\$CE_HOST_${CE_name}_CE_InfoJobManager"`-${QUEUE},mds-vo-name=resource,o=grid" >> $OUTFILE
722 cat <<EOF >> $OUTFILE
723 objectClass: GlueCETop
724 objectClass: GlueVOView
725 objectClass: GlueCEInfo
726 objectClass: GlueCEState
727 objectClass: GlueCEAccessControlBase
728 objectClass: GlueCEPolicy
729 objectClass: GlueKey
730 objectClass: GlueSchemaVersion
731 GlueSchemaVersionMajor: 1
732 GlueSchemaVersionMinor: 3
733 EOF
734 echo "GlueVOViewLocalID: ${voview}" >> ${OUTFILE}
735 for i in ${VOVIEW_VAR}; do
736 if [ `eval echo "\\$CE_HOST_${CE_name}_QUEUE_${QUEUE_name}_VOVIEW_${voview_name}_CE_$i"` ]; then # user defined value for CE - queue - voview
737 yaimlog DEBUG "using user defined value at CE-queue-voview level for GlueCE$i"
738 echo "GlueCE$i: `eval echo "\\$CE_HOST_${CE_name}_QUEUE_${QUEUE_name}_VOVIEW_${voview_name}_CE_$i"`" >> ${OUTFILE}
739 else
740 if [ `eval echo "\\$CE_HOST_${CE_name}_QUEUE_${QUEUE_name}_CE_$i"` ]; then # user defined value for CE - queue
741 yaimlog DEBUG "using user defined value at CE-queue level for GlueCE$i"
742 echo "GlueCE$i: `eval echo "\\$CE_HOST_${CE_name}_QUEUE_${QUEUE_name}_CE_$i"`" >> ${OUTFILE}
743 else
744 if [ `eval echo "\\$CE_HOST_${CE_name}_CE_$i"` ]; then # user defined value for CE
745 yaimlog DEBUG "using user defined value at CE level for GlueCE$i"
746 echo "GlueCE$i: `eval echo "\\$CE_HOST_${CE_name}_CE_$i"`" >> ${OUTFILE}
747 else
748 if [ $i == "InfoDefaultSE" ]; then
749 vo_default_se=`get_vo_param ${newfqanvo} DEFAULT_SE`
750 if [ "${vo_default_se}" ]; then
751 echo "GlueCE$i: ${vo_default_se}" >> ${OUTFILE} # VO default SE
752 else
753 if [ `eval echo "\\$CE_$i"` ]; then
754 echo "GlueCE$i: `eval echo "\\$CE_$i"`" >> ${OUTFILE} # default value
755 else
756 echo "GlueCE$i: ${default_se}" >> ${OUTFILE} # default SE taken from SE_LIST
757 fi
758 fi
759 else
760 if [ $i == "InfoApplicationDir" ]; then
761 sw_dir=`get_vo_param ${newfqanvo} SW_DIR`
762 if [ "${sw_dir}" ]; then
763 echo "GlueCE$i: ${sw_dir}" >> ${OUTFILE} # VO default SW_DIR
764 else
765 yaimlog ERROR "SW_DIR for ${VO} is not set !"
766 exit 1
767 fi
768 else
769 yaimlog DEBUG "using user defined value at site level for GlueCE$i"
770 echo "GlueCE$i: `eval echo "\\$CE_$i"`" >> ${OUTFILE} # default value
771 fi # SW_DIR
772 fi #default SE
773 fi # CE
774 fi # CE - queue
775 fi # CE - queue - voview
776 done # Glue VOView
777 echo "GlueChunkKey: GlueCEUniqueID=${CE_HOST}:8443/${ce_type}-`eval echo "\\$CE_HOST_${CE_name}_CE_InfoJobManager"`-${QUEUE}" >> $OUTFILE
778 if [ ! `echo ${j} | grep "/"` ]; then
779 echo "GlueCEAccessControlBaseRule: VO:${newfqanvo}" >> ${OUTFILE}
780 else
781 echo "GlueCEAccessControlBaseRule: VOMS:${newfqan}" >> ${OUTFILE}
782 fi
783 ##################
784 # Configure DENY #
785 ##################
786
787 for deny_QUEUE in `eval echo "\\$CE_HOST_${CE_name}_QUEUES"`; do
788 deny_QUEUE_name=`echo ${deny_QUEUE} | sed -e 's/[\.-]/_/g' | tr '[:lower:]' '[:upper:]'`
789 deny_var=CE_HOST_${CE_name}_QUEUE_${deny_QUEUE_name}_AccessControlBaseRule
790 allowview="${allowview} ${!deny_var}"
791 done
792
793 # Sort and drop entries whic appears twice
794 allvoview=`for kk in $allvoview; do echo $kk; done | sort | uniq`;
795
796 # Add the DENY stuff only if it is the generic VOview, i.e the VO itself -> no '/' in it's name
797 if [ ! `echo ${j} | grep "/"` ]; then
798 vomsgroupvo="${newfqanvo}"
799 for myview in ${allvoview}; do
800 convert_fqan ${myview}
801 # We don't deny ourselves...
802 if [ "x${myview}" != "x${j}" ]; then
803 # .. and we put DENY only if it is in the same VO, otherwise it doesn't match, so DENY is not necessary
804 if [ "x${vomsgroupvo}" = "x${newfqanvo}" ] && [ "x${FQANVOVIEWS}" = "xyes" ]; then
805 echo -n "GlueCEAccessControlBaseRule: DENY:${newfqan}" >> ${OUTFILE}
806 fi
807 fi
808 done
809 fi # DENY
810 fi # FQANVOVIEWS
811 done # VOView
812 done # QUEUE
813 ############
814 # GlueCESE #
815 ############
816
817 yaimlog DEBUG "Configuring the GlueCESEBind"
818
819 OUTFILE=${LDIF_DIR}/static-file-CESEBind.ldif
820 cat /dev/null > ${OUTFILE}
821 for QUEUE in `eval echo "\\$CE_HOST_${CE_name}_QUEUES"`; do
822 QUEUE_name=`echo ${QUEUE} | sed -e 's/[\.-]/_/g' | tr '[:lower:]' '[:upper:]'`
823 echo "" >> ${OUTFILE}
824 echo "dn: GlueCESEBindGroupCEUniqueID=${CE_HOST}:8443/${ce_type}-`eval echo "\\$CE_HOST_${CE_name}_CE_InfoJobManager"`-${QUEUE},mds-vo-name=resource,o=grid" >> ${OUTFILE}
825 cat <<EOF >> ${OUTFILE}
826 objectClass: GlueGeneralTop
827 objectClass: GlueCESEBindGroup
828 objectClass: GlueSchemaVersion
829 GlueSchemaVersionMajor: 1
830 GlueSchemaVersionMinor: 3
831 EOF
832 echo "GlueCESEBindGroupCEUniqueID: ${CE_HOST}:8443/${ce_type}-`eval echo "\\$CE_HOST_${CE_name}_CE_InfoJobManager"`-${QUEUE}" >> ${OUTFILE}
833 for se in $SE_LIST; do
834 echo "GlueCESEBindGroupSEUniqueID: $se" >> ${OUTFILE}
835 done
836 done
837
838 for se in $SE_LIST
839 do
840 accesspoint="n.a"
841 for item in ${SE_MOUNT_INFO_LIST}
842 do
843 se_aux=${item%:*}
844 if [ "x${se}" == "x${se_aux}" ]; then
845 accesspoint=${item#*:}
846 export=${accesspoint%,*}
847 mount=${accesspoint#*,}
848 accesspoint="${mount},${export}"
849 break
850 fi
851 done
852 for QUEUE in `eval echo "\\$CE_HOST_${CE_name}_QUEUES"`; do
853 cat <<EOF >> ${OUTFILE}
854
855 dn: GlueCESEBindSEUniqueID=$se,\
856 GlueCESEBindGroupCEUniqueID=${CE_HOST}:8443/${ce_type}-`eval echo "\\$CE_HOST_${CE_name}_CE_InfoJobManager"`-${QUEUE},mds-vo-name=resource,o=grid
857 objectClass: GlueGeneralTop
858 objectClass: GlueCESEBind
859 objectClass: GlueSchemaVersion
860 GlueCESEBindSEUniqueID: $se
861 GlueCESEBindCEAccesspoint: $accesspoint
862 GlueCESEBindCEUniqueID: ${CE_HOST}:8443/${ce_type}-`eval echo "\\$CE_HOST_${CE_name}_CE_InfoJobManager"`-${QUEUE}
863 GlueCESEBindMountInfo: $accesspoint
864 GlueCESEBindWeight: 0
865 GlueSchemaVersionMajor: 1
866 GlueSchemaVersionMinor: 3
867 EOF
868
869 done #QUEUE
870 done #SE_LIST
871
872 return 0
873 }

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28