From 9be8f28c08d40eee072192794645ec517f23336f Mon Sep 17 00:00:00 2001 From: Philip Kovacs Date: Sep 15 2017 22:05:40 +0000 Subject: Initial import (#1489668) --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7548e15 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/slurm-17.02.7.tar.bz2 diff --git a/README.md b/README.md deleted file mode 100644 index 2d59d93..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# slurm - -The slurm package \ No newline at end of file diff --git a/slurm-128x128.png b/slurm-128x128.png new file mode 100644 index 0000000..e8a5104 Binary files /dev/null and b/slurm-128x128.png differ diff --git a/slurm-sview.desktop b/slurm-sview.desktop new file mode 100644 index 0000000..b694d18 --- /dev/null +++ b/slurm-sview.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=Slurm sview +Name[en]=Slurm sview +Comment=Slurm sview gui to view and modify slurm state +Comment[en]=Slurm sview gui to view and modify slurm state +Exec=sview +Icon=slurm +Terminal=false +Type=Application +Categories=GTK;Network;ParallelComputing diff --git a/slurm.conf b/slurm.conf new file mode 100644 index 0000000..cb02c0d --- /dev/null +++ b/slurm.conf @@ -0,0 +1,159 @@ +# +# See the slurm.conf man page for more information. +# +ControlMachine=localhost +#ControlAddr= +#BackupController= +#BackupAddr= +# +AuthType=auth/munge +#CheckpointType=checkpoint/none +CryptoType=crypto/munge +#DisableRootJobs=NO +#EnforcePartLimits=NO +#Epilog= +#EpilogSlurmctld= +#FirstJobId=1 +#MaxJobId=999999 +#GresTypes= +#GroupUpdateForce=0 +#GroupUpdateTime=600 +#JobCheckpointDir=/var/slurm/checkpoint +#JobCredentialPrivateKey= +#JobCredentialPublicCertificate= +#JobFileAppend=0 +#JobRequeue=1 +#JobSubmitPlugins=1 +#KillOnBadExit=0 +#LaunchType=launch/slurm +#Licenses=foo*4,bar +#MailProg=/bin/mail +#MaxJobCount=5000 +#MaxStepCount=40000 +#MaxTasksPerNode=128 +MpiDefault=none +#MpiParams=ports=#-# +#PluginDir= +#PlugStackConfig= +#PrivateData=jobs +ProctrackType=proctrack/cgroup +#Prolog= +#PrologFlags= +#PrologSlurmctld= +#PropagatePrioProcess=0 +#PropagateResourceLimits= +#PropagateResourceLimitsExcept= +#RebootProgram= +ReturnToService=1 +#SallocDefaultCommand= +SlurmctldPidFile=/var/run/slurm/slurmctld.pid +SlurmctldPort=6817 +SlurmdPidFile=/var/run/slurm/slurmd.pid +SlurmdPort=6818 +SlurmdSpoolDir=/var/spool/slurm/d +SlurmUser=root +#SlurmdUser=root +#SrunEpilog= +#SrunProlog= +StateSaveLocation=/var/spool/slurm/ctld +SwitchType=switch/none +#TaskEpilog= +TaskPlugin=task/none +#TaskPluginParam= +#TaskProlog= +#TopologyPlugin=topology/tree +#TmpFS=/tmp +#TrackWCKey=no +#TreeWidth= +#UnkillableStepProgram= +#UsePAM=0 +# +# +# TIMERS +#BatchStartTimeout=10 +#CompleteWait=0 +#EpilogMsgTime=2000 +#GetEnvTimeout=2 +#HealthCheckInterval=0 +#HealthCheckProgram= +InactiveLimit=0 +KillWait=30 +#MessageTimeout=10 +#ResvOverRun=0 +MinJobAge=300 +#OverTimeLimit=0 +SlurmctldTimeout=120 +SlurmdTimeout=300 +#UnkillableStepTimeout=60 +#VSizeFactor=0 +Waittime=0 +# +# +# SCHEDULING +#DefMemPerCPU=0 +FastSchedule=1 +#MaxMemPerCPU=0 +#SchedulerTimeSlice=30 +SchedulerType=sched/backfill +SelectType=select/linear +#SelectTypeParameters= +# +# +# JOB PRIORITY +#PriorityFlags= +#PriorityType=priority/basic +#PriorityDecayHalfLife= +#PriorityCalcPeriod= +#PriorityFavorSmall= +#PriorityMaxAge= +#PriorityUsageResetPeriod= +#PriorityWeightAge= +#PriorityWeightFairshare= +#PriorityWeightJobSize= +#PriorityWeightPartition= +#PriorityWeightQOS= +# +# +# LOGGING AND ACCOUNTING +#AccountingStorageEnforce=0 +#AccountingStorageHost= +#AccountingStorageLoc= +#AccountingStoragePass= +#AccountingStoragePort= +AccountingStorageType=accounting_storage/none +#AccountingStorageUser= +AccountingStoreJobComment=YES +ClusterName=local +#DebugFlags= +#JobCompHost= +#JobCompLoc= +#JobCompPass= +#JobCompPort= +JobCompType=jobcomp/none +#JobCompUser= +#JobContainerType=job_container/none +JobAcctGatherFrequency=30 +JobAcctGatherType=jobacct_gather/none +SlurmctldDebug=3 +#SlurmctldLogFile= +SlurmdDebug=3 +#SlurmdLogFile= +#SlurmSchedLogFile= +#SlurmSchedLogLevel= +# +# +# POWER SAVE SUPPORT FOR IDLE NODES (optional) +#SuspendProgram= +#ResumeProgram= +#SuspendTimeout= +#ResumeTimeout= +#ResumeRate= +#SuspendExcNodes= +#SuspendExcParts= +#SuspendRate= +#SuspendTime= +# +# +# COMPUTE NODES +NodeName=localhost CPUs=1 State=UNKNOWN +PartitionName=debug Nodes=localhost Default=YES MaxTime=INFINITE State=UP diff --git a/slurm.spec b/slurm.spec new file mode 100644 index 0000000..e4a6614 --- /dev/null +++ b/slurm.spec @@ -0,0 +1,757 @@ +# ------------- +# Base Packages +# ------------- +# slurm +# slurm-devel +# slurm-doc +# slurm-gui +# slurm-libs +# slurm-plugins +# slurm-plugins-auth_none +# slurm-plugins-lua +# slurm-plugins-munge +# slurm-plugins-mysql +# slurm-plugins-pbs +# slurm-plugins-rrdtool +# slurm-slurmdbd + +# ----------------- +# Contribs Packages +# ----------------- +# slurm-contribs +# slurm-openlava +# slurm-perlapi +# slurm-plugins-pam_slurm +# slurm-torque + +Name: slurm +Version: 17.02.7 +Release: 1%{?dist} +Summary: Simple Linux Utility for Resource Management +License: GPLv2 and BSD +URL: https://slurm.schedmd.com/ +Source0: http://www.schedmd.com/download/latest/%{name}-%{version}.tar.bz2 +Source1: slurm.conf +Source2: slurmdbd.conf +Source3: slurm-sview.desktop +Source4: slurm-128x128.png +Source5: slurm_setuser.in + +# upstream bugs #4094, #4095, #4101, #4113 +Patch0: slurm_salloc_privileges.patch +Patch1: slurm_format_truncation.patch + +# build-related patches +Patch2: slurm_perlapi_rpaths.patch +Patch3: slurm_html_doc_path.patch +Patch4: slurm_doc_fix.patch + +# Fedora-related patches +Patch5: slurm_service_files.patch + +BuildRequires: pkgconfig(gtk+-2.0) +BuildRequires: hdf5-devel +BuildRequires: pkgconfig(hwloc) +BuildRequires: pkgconfig(libfreeipmi) +BuildRequires: pkgconfig(libcurl) +BuildRequires: pkgconfig(lua) +BuildRequires: pkgconfig(mariadb) +BuildRequires: pkgconfig(munge) +BuildRequires: pkgconfig(ncurses) +BuildRequires: pkgconfig(openssl) +BuildRequires: pam-devel +BuildRequires: pmix-devel +BuildRequires: readline-devel +BuildRequires: pkgconfig(librrd) +BuildRequires: pkgconfig(zlib) + +# follow arch exclusions for these devel packages +%ifnarch s390 s390x %{arm} +BuildRequires: libibmad-devel +BuildRequires: libibumad-devel +BuildRequires: numactl-devel +%endif + +BuildRequires: desktop-file-utils +BuildRequires: perl-ExtUtils-MakeMaker +BuildRequires: perl-podlators +BuildRequires: pkgconf +%{?systemd_requires} +BuildRequires: systemd + +Requires: %{name}-plugins%{?_isa} = %{version}-%{release} +Requires: %{name}-plugins-munge%{?_isa} = %{version}-%{release} +Requires: munge + +Requires(pre): shadow-utils + +%description +Slurm is an open source, fault-tolerant, and highly scalable +cluster management and job scheduling system for large and +small Linux clusters. + +# ------------- +# Base Packages +# ------------- + +%package devel +Summary: Slurm development +Requires: %{name}-libs%{?_isa} = %{version}-%{release} +%description devel +Development package for Slurm. Includes headers, libraries +and man pages for using the Slurm API. + +%package doc +Summary: Slurm documentation +%description doc +Documentation package for Slurm. Includes documentation and +html-based configuration tools for Slurm. + +%package gui +Summary: Slurm gui and visual tools +Requires: %{name}%{?_isa} = %{version}-%{release} +%description gui +This package contains the Slurm visual tools smap and sview +and their respective man pages. + +%package libs +Summary: Slurm shared libraries +%description libs +Slurm shared libraries. + +%package plugins +Summary: Slurm plugins (loadable shared objects) +%description plugins +Slurm plugins (loadable shared objects) supporting a wide variety of +architectures and behaviors. These basically provide the building blocks +with which Slurm can be configured. Note that some system specific plugins +are in other packages. + +%package plugins-auth_none +Summary: Slurm auth null implementation (no authentication) +%description plugins-auth_none +Slurm null authentication plugin. + +%package plugins-lua +Summary: Slurm lua plugins +%description plugins-lua +Slurm proctrack/lua and job_submit/lua plugins. + +%package plugins-munge +Summary: Slurm authentication and crypto plugins using Munge +%description plugins-munge +Slurm authentication and crypto implementation using Munge. Used to +authenticate user originating an RPC, digitally sign and/or encrypt messages. + +%package plugins-mysql +Summary: Slurm MySQL/MariaDb support +%description plugins-mysql +Slurm MySQL/MariaDb support plugins implementing interfaces to those +databases for accounting storage and job completion. + +%package plugins-pbs +Summary: Slurm torque (PBS) support +%description plugins-pbs +Slurm torque (PBS) support plugins. + +%package plugins-rrdtool +Summary: Slurm rrdtool external sensor plugin +%description plugins-rrdtool +Slurm external sensor plugin for rrdtool. This package is separated from +the base plugins package due to gui dependencies which are unneeded if not +using this plugin. + +%package slurmdbd +Summary: Slurm database daemon +# Use with auth_none or munge plugins for authentication +Requires: %{name}-plugins-munge%{?_isa} = %{version}-%{release} +Requires: %{name}-plugins-mysql%{?_isa} = %{version}-%{release} +Requires: munge +%description slurmdbd +Slurm database daemon. Used to accept and process database RPCs and upload +database changes to slurmctld daemons on each cluster. + +# ----------------- +# Contribs Packages +# ----------------- + +%package contribs +Summary: Perl tools to print Slurm job state information +Requires: %{name}-perlapi%{?_isa} = %{version}-%{release} +%description contribs +Slurm contribution package which includes the programs seff, +sjobexitmod, sjstat and smail. See their respective man pages +for more information. + +%package openlava +Summary: Openlava/LSF wrappers for transition from OpenLava/LSF to Slurm +Requires: %{name}-perlapi%{?_isa} = %{version}-%{release} +%description openlava +OpenLava wrapper scripts used for helping migrate from OpenLava/LSF to Slurm. + +%package perlapi +Summary: Perl API to Slurm +Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) +Requires: %{name}-libs%{?_isa} = %{version}-%{release} +%description perlapi +Perl API package for Slurm. This package includes the perl API to provide a +helpful interface to Slurm through Perl. + +%package plugins-pam_slurm +Summary: Slurm pam modules +Requires: %{name}-libs%{?_isa} = %{version}-%{release} +%description plugins-pam_slurm +The pam_slurm module restricts access to compute nodes in a cluster where Slurm +is in use. Also includes the pam_slurm_adopt plugin for "adopting" connections +into slurm jobs. + +%package torque +Summary: Torque/PBS wrappers for transition from Torque/PBS to Slurm +Requires: %{name}-perlapi%{?_isa} = %{version}-%{release} +Requires: %{name}-plugins-pbs%{?_isa} = %{version}-%{release} +%description torque +Torque wrapper scripts used for helping migrate from Torque/PBS to Slurm. + +%prep +%setup -q -n %{name}-%{version} +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +cp %SOURCE1 etc/slurm.conf +cp %SOURCE1 etc/slurm.conf.example +cp %SOURCE2 etc/slurmdbd.conf +cp %SOURCE2 etc/slurmdbd.conf.example +mkdir -p share/applications +mkdir -p share/icons/hicolor/128x128/apps +cp %SOURCE3 share/applications/%{name}-sview.desktop +cp %SOURCE4 share/icons/hicolor/128x128/apps/%{name}.png +mkdir -p extras +cp %SOURCE5 extras/slurm_setuser.in + +%build +# upstream bug #2443. need to force lazy linkage since plugins contain +# undefined symbols not used in every context, i.e. slurmctld vs slurmd. +CFLAGS="$RPM_OPT_FLAGS -Wl,-z,lazy" +CXXFLAGS="$RPM_OPT_FLAGS -Wl,-z,lazy" +# --enable-debug (auxdir/x_ac_debug.m4) breaks fortification (-O0) +%configure \ + --prefix=%{_prefix} \ + --sysconfdir=%{_sysconfdir}/%{name} \ + --with-pam_dir=%{_libdir}/security \ + --enable-shared \ + --disable-static \ + --disable-debug \ + --disable-developer \ + --disable-bluegene \ + --disable-native-cray \ + --disable-cray-network \ + --disable-salloc-background \ + --disable-multiple-slurmd \ + --disable-partial_attach \ + --without-rpath \ +# patch libtool to remove rpaths +sed -i 's|^hardcode_into_libs=.*|hardcode_into_libs=no|g' libtool + +# configure the extras/slurm_setuser script +sed -r ' +s|^dir_conf=.*|dir_conf="%{_sysconfdir}/%{name}"|g; +s|^dir_log=.*|dir_log="%{_var}/log/%{name}"|g; +s|^dir_run=.*|dir_run="%{_rundir}/%{name}"|g; +s|^dir_spool=.*|dir_spool="%{_var}/spool/%{name}"|g; +s|^dir_tmpfiles_d=.*|dir_tmpfiles_d="%{_tmpfilesdir}"|g;' \ + extras/slurm_setuser.in > extras/slurm_setuser + +# build base packages +%make_build V=0 + +# build contribs packages +# INSTALLDIRS=vendor so perlapi goes to vendor_perl directory +PERL_MM_PARAMS="INSTALLDIRS=vendor" %make_build contrib V=0 + +%check +make check + +%install +%make_install +%{__make} install-contrib DESTDIR=%{buildroot} + +install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name} +install -d -m 0755 %{buildroot}%{_sysconfdir}/%{name}/layouts.d +install -d -m 0755 %{buildroot}%{_unitdir} +install -m 0644 -p etc/cgroup.conf.example \ + %{buildroot}%{_sysconfdir}/%{name} +install -m 0644 -p etc/cgroup.conf.example \ + %{buildroot}%{_sysconfdir}/%{name}/cgroup.conf +install -m 0644 -p etc/cgroup_allowed_devices_file.conf.example \ + %{buildroot}%{_sysconfdir}/%{name} +install -m 0644 -p etc/layouts.d.power.conf.example \ + %{buildroot}%{_sysconfdir}/%{name}/layouts.d/power.conf.example +install -m 0644 -p etc/layouts.d.power_cpufreq.conf.example \ + %{buildroot}%{_sysconfdir}/%{name}/layouts.d/power_cpufreq.conf.example +install -m 0644 -p etc/layouts.d.unit.conf.example \ + %{buildroot}%{_sysconfdir}/%{name}/layouts.d/unit.conf.example +install -m 0644 -p etc/slurm.conf %{buildroot}%{_sysconfdir}/%{name} +install -m 0644 -p etc/slurm.conf.example %{buildroot}%{_sysconfdir}/%{name} +install -m 0644 -p etc/slurmdbd.conf %{buildroot}%{_sysconfdir}/%{name} +install -m 0644 -p etc/slurmdbd.conf.example %{buildroot}%{_sysconfdir}/%{name} +install -m 0644 -p etc/slurm.epilog.clean %{buildroot}%{_sysconfdir}/%{name} +install -m 0644 -p etc/slurmctld.service %{buildroot}%{_unitdir} +install -m 0644 -p etc/slurmd.service %{buildroot}%{_unitdir} +install -m 0644 -p etc/slurmdbd.service %{buildroot}%{_unitdir} + +# tmpfiles.d file for creating /run/slurm dir after reboot +install -d -m 0755 %{buildroot}%{_tmpfilesdir} +cat >%{buildroot}%{_tmpfilesdir}/slurm.conf <%{buildroot}%{_sysconfdir}/logrotate.d/%{name} <%{buildroot}%{_libdir}/pkgconfig/slurm.pc < %{buildroot}%{_mandir}/man1/${prog}.1 +done + +# contribs docs +install -d -m 0755 %{buildroot}%{_docdir}/%{name}/contribs/lua +install -m 0644 contribs/README %{buildroot}%{_docdir}/%{name}/contribs +install -m 0644 contribs/lua/proctrack.lua %{buildroot}%{_docdir}/%{name}/contribs/lua + +# remove libtool archives +find %{buildroot} -name \*.a -o -name \*.la | xargs rm -f +# remove example plugins +rm -f %{buildroot}%{_libdir}/%{name}/job_submit_defaults.so +rm -f %{buildroot}%{_libdir}/%{name}/job_submit_logging.so +rm -f %{buildroot}%{_libdir}/%{name}/job_submit_partition.so +# remove bluegene files +rm -f %{buildroot}%{_libdir}/%{name}/libsched_if.so +rm -f %{buildroot}%{_libdir}/%{name}/libsched_if64.so +rm -f %{buildroot}%{_libdir}/%{name}/runjob_plugin.so +rm -f %{buildroot}%{_mandir}/man5/bluegene* +rm -f %{buildroot}%{_sbindir}/sfree +rm -f %{buildroot}%{_sbindir}/slurm_epilog +rm -f %{buildroot}%{_sbindir}/slurm_prolog +# remove cray files +rm -f %{buildroot}%{_libdir}/%{name}/acct_gather_energy_cray.so +rm -f %{buildroot}%{_libdir}/%{name}/core_spec_cray.so +rm -f %{buildroot}%{_libdir}/%{name}/job_submit_cray.so +rm -f %{buildroot}%{_libdir}/%{name}/select_cray.so +rm -f %{buildroot}%{_libdir}/%{name}/switch_cray.so +rm -f %{buildroot}%{_libdir}/%{name}/task_cray.so +rm -f %{buildroot}%{_mandir}/man5/cray* +# remove percs files +rm -f %{buildroot}%{_libdir}/%{name}/launch_poe.so +rm -f %{buildroot}%{_libdir}/%{name}/libpermapi.so +rm -f %{buildroot}%{_libdir}/%{name}/switch_nrt.so +# remove perl cruft +rm -f %{buildroot}%{perl_vendorarch}/auto/Slurm*/.packlist +rm -f %{buildroot}%{perl_vendorarch}/auto/Slurm*/Slurm*.bs +rm -f %{buildroot}%{perl_archlib}/perllocal.pod + +# customize __find_requires to strip out incorrect dependencies +cat >find-requires </dev/null || : + +%postun gui +if [ $1 -eq 0 ] ; then + /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null + /usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : +fi + +%posttrans gui +/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : + +%post libs -p /sbin/ldconfig + +%postun libs -p /sbin/ldconfig + +%post slurmdbd +%systemd_post slurmdbd.service + +%preun slurmdbd +%systemd_preun slurmdbd.service + +%postun slurmdbd +%systemd_postun_with_restart slurmdbd.service + +%changelog +* Thu Sep 14 2017 Philip Kovacs - 17.02.7-1 +- Packaging for Fedora. diff --git a/slurm_doc_fix.patch b/slurm_doc_fix.patch new file mode 100644 index 0000000..8cd7936 --- /dev/null +++ b/slurm_doc_fix.patch @@ -0,0 +1,43 @@ +--- slurm-17.02.6/doc/man/man5/burst_buffer.conf.5.orig 2017-08-15 23:22:24.333180212 -0400 ++++ slurm-17.02.6/doc/man/man5/burst_buffer.conf.5 2017-08-15 23:23:45.224298397 -0400 +@@ -31,18 +31,18 @@ + \fBAllowUsers\fR + Comma separated list of user names and/or IDs permitted to use burst buffers. + The options \fBAllowUsers\fR and \fBDenyUsers\fR can not both be specified. +-By default all users are permitted to use burst buffers. ++By default all users are permitted to use burst buffers. Possible future ++enhancement for generic plugin. + +-.\ Possible future enhancement for generic plugin +-.\ .TP +-.\ \fBAltPool\fR +-.\ The AltPool value consists of a comma separated list of alternate pools of +-.\ resources, each of which includes a name separated by a colon and a numeric +-.\ value. +-.\ The numeric value can include a suffix of "k", "m", "g", "t" and "p" which +-.\ multiplies the numeric value by 1,024, 1,048,576, 1,073,741,824 etc. +-.\ The numeric value is a 64-bit value. +-.\ for example, "AltPool=test:20g,small:4g ++.TP ++\fBAltPool\fR ++The AltPool value consists of a comma separated list of alternate pools of ++resources, each of which includes a name separated by a colon and a numeric ++value. ++The numeric value can include a suffix of "k", "m", "g", "t" and "p" which ++multiplies the numeric value by 1,024, 1,048,576, 1,073,741,824 etc. ++The numeric value is a 64-bit value. ++for example, "AltPool=test:20g,small:4g + + .TP + \fBCreateBuffer\fR +@@ -195,8 +195,8 @@ + AllowUsers=alan,brenda + .br + PrivateData=true +-.\ .br +-.\ Gres=nodes:10,other:20 ++.br ++Gres=nodes:10,other:20 + .br + # + .br diff --git a/slurm_format_truncation.patch b/slurm_format_truncation.patch new file mode 100644 index 0000000..8107e97 --- /dev/null +++ b/slurm_format_truncation.patch @@ -0,0 +1,44 @@ +--- slurm-17.02.7/src/plugins/node_features/knl_generic/node_features_knl_generic.c 2017-08-15 14:37:07.000000000 -0400 ++++ slurm-17.02.7/src/plugins/node_features/knl_generic/node_features_knl_generic.c.new 2017-08-21 01:35:38.352301060 -0400 +@@ -1607,7 +1607,7 @@ + // insmod /home/tim/kmod/xppsl-addons/zonesort_module.ko + struct stat sb; + int buf_len, fd, i, len; +- char buf[8]; ++ char buf[16]; + + if (stat(ZONE_SORT_PATH, &sb) == -1) + (void) system(MODPROBE_PATH " zonesort_module"); +--- slurm-17.02.7/src/plugins/select/bluegene/bg_core.c 2017-07-21 11:17:53.000000000 -0400 ++++ slurm-17.02.7/src/plugins/select/bluegene/bg_core.c.new 2017-08-21 01:39:35.896506235 -0400 +@@ -701,7 +701,7 @@ + */ + extern const char *bg_err_str(int inx) + { +- static char tmp_char[10]; ++ static char tmp_char[32]; + + switch (inx) { + case SLURM_SUCCESS: +--- slurm-17.02.7/src/plugins/task/affinity/cpuset.c 2017-07-21 11:17:53.000000000 -0400 ++++ slurm-17.02.7/src/plugins/task/affinity/cpuset.c.new 2017-08-21 01:42:53.872712983 -0400 +@@ -354,7 +354,7 @@ + int slurm_set_memset(char *path, nodemask_t *new_mask) + { + char file_path[PATH_MAX]; +- char mstr[1 + CPU_SETSIZE * 4], tmp[10]; ++ char mstr[1 + CPU_SETSIZE * 4], tmp[16]; + int fd, i, max_node; + ssize_t rc; + +--- slurm-17.02.7/src/slurmd/slurmd/read_proc.c 2017-07-21 11:17:53.000000000 -0400 ++++ slurm-17.02.7/src/slurmd/slurmd/read_proc.c.new 2017-08-26 00:27:38.036289952 -0400 +@@ -233,7 +233,7 @@ + DIR *proc_fs; + struct dirent *proc_ent; + int proc_fd, proc_stat_size, found, n; +- char proc_name[22], *proc_stat; ++ char proc_name[272], *proc_stat; + struct stat buffer; + int uid, session; + long resident_set_size; diff --git a/slurm_html_doc_path.patch b/slurm_html_doc_path.patch new file mode 100644 index 0000000..263439a --- /dev/null +++ b/slurm_html_doc_path.patch @@ -0,0 +1,11 @@ +--- slurm-17.02.7/doc/html/Makefile.in 2017-08-14 13:48:43.000000000 -0400 ++++ slurm-17.02.7/doc/html/Makefile.in.new 2017-08-24 07:58:01.242452059 -0400 +@@ -417,7 +417,7 @@ + host_cpu = @host_cpu@ + host_os = @host_os@ + host_vendor = @host_vendor@ +-htmldir = ${datadir}/doc/${PACKAGE}-${SLURM_VERSION_STRING}/html ++htmldir = ${datadir}/doc/${PACKAGE}/html + includedir = @includedir@ + infodir = @infodir@ + install_sh = @install_sh@ diff --git a/slurm_perlapi_rpaths.patch b/slurm_perlapi_rpaths.patch new file mode 100644 index 0000000..66b5afe --- /dev/null +++ b/slurm_perlapi_rpaths.patch @@ -0,0 +1,22 @@ +--- slurm-17.02.7/contribs/perlapi/libslurm/perl/Makefile.PL.in.orig 2016-11-08 15:11:32.000000000 -0500 ++++ slurm-17.02.7/contribs/perlapi/libslurm/perl/Makefile.PL.in 2017-08-17 03:06:27.363688978 -0400 +@@ -77,7 +77,7 @@ + # AIX has problems with not always having the correct + # flags so we have to add some :) + my $os = lc(`uname`); +-my $other_ld_flags = "-Wl,-rpath,@top_builddir@/src/api/.libs -Wl,-rpath,@prefix@/lib"; ++my $other_ld_flags = " "; + $other_ld_flags = " -brtl -G -bnoentry -bgcbypass:1000 -bexpfull" + if $os =~ "aix"; + +--- slurm-17.02.7/contribs/perlapi/libslurmdb/perl/Makefile.PL.in.orig 2017-08-17 03:37:39.689054161 -0400 ++++ slurm-17.02.7/contribs/perlapi/libslurmdb/perl/Makefile.PL.in 2017-08-17 03:38:07.305780718 -0400 +@@ -76,7 +76,7 @@ + # AIX has problems with not always having the correct + # flags so we have to add some :) + my $os = lc(`uname`); +-my $other_ld_flags = "-Wl,-rpath,@top_builddir@/src/db_api/.libs -Wl,-rpath,@prefix@/lib"; ++my $other_ld_flags = " "; + $other_ld_flags = " -brtl -G -bnoentry -bgcbypass:1000 -bexpfull" + if $os =~ "aix"; + diff --git a/slurm_salloc_privileges.patch b/slurm_salloc_privileges.patch new file mode 100644 index 0000000..3cc2910 --- /dev/null +++ b/slurm_salloc_privileges.patch @@ -0,0 +1,53 @@ +--- slurm-17.02.7/src/salloc/salloc.c 2017-08-14 13:48:43.000000000 -0400 ++++ slurm-17.02.7/src/salloc/salloc.c.new 2017-08-23 00:07:22.759099425 -0400 +@@ -42,6 +42,7 @@ + + #include + #include ++#include + #include + #include + #include +@@ -298,13 +299,27 @@ + if (_fill_job_desc_from_opts(&desc) == -1) { + exit(error_exit); + } +- if (opt.gid != (gid_t) -1) { ++ ++ /* If the requested gid is different than ours, become that gid */ ++ if ((getgid() != opt.gid) && (opt.gid != (gid_t) -1)) { + if (setgid(opt.gid) < 0) { + error("setgid: %m"); + exit(error_exit); + } + } + ++ /* If the requested uid is different than ours, become that uid */ ++ if ((getuid() != opt.uid) && (opt.uid != (uid_t) -1)) { ++ if (setgroups(0, NULL) < 0) { ++ error("setgroups: %m"); ++ exit(error_exit); ++ } ++ if (setuid(opt.uid) < 0) { ++ error("setuid: %m"); ++ exit(error_exit); ++ } ++ } ++ + callbacks.ping = _ping_handler; + callbacks.timeout = _timeout_handler; + callbacks.job_complete = _job_complete_handler; +@@ -333,13 +348,6 @@ + sleep (++retries); + } + +- /* become the user after the allocation has been requested. */ +- if (opt.uid != (uid_t) -1) { +- if (setuid(opt.uid) < 0) { +- error("setuid: %m"); +- exit(error_exit); +- } +- } + if (alloc == NULL) { + if (allocation_interrupted) { + /* cancelled by signal */ diff --git a/slurm_service_files.patch b/slurm_service_files.patch new file mode 100644 index 0000000..988262d --- /dev/null +++ b/slurm_service_files.patch @@ -0,0 +1,33 @@ +--- slurm-17.02.7/etc/slurmctld.service.in 2017-08-14 13:48:43.000000000 -0400 ++++ slurm-17.02.7/etc/slurmctld.service.in.new 2017-08-21 13:35:26.472209176 -0400 +@@ -8,7 +8,7 @@ + EnvironmentFile=-/etc/sysconfig/slurmctld + ExecStart=@sbindir@/slurmctld $SLURMCTLD_OPTIONS + ExecReload=/bin/kill -HUP $MAINPID +-PIDFile=/var/run/slurmctld.pid ++PIDFile=/var/run/slurm/slurmctld.pid + + [Install] + WantedBy=multi-user.target +--- slurm-17.02.7/etc/slurmd.service.in 2017-08-14 13:48:43.000000000 -0400 ++++ slurm-17.02.7/etc/slurmd.service.in.new 2017-08-21 14:45:23.485061312 -0400 +@@ -8,7 +8,7 @@ + EnvironmentFile=-/etc/sysconfig/slurmd + ExecStart=@sbindir@/slurmd $SLURMD_OPTIONS + ExecReload=/bin/kill -HUP $MAINPID +-PIDFile=/var/run/slurmd.pid ++PIDFile=/var/run/slurm/slurmd.pid + KillMode=process + LimitNOFILE=51200 + LimitMEMLOCK=infinity +--- slurm-17.02.7/etc/slurmdbd.service.in 2017-08-14 13:48:43.000000000 -0400 ++++ slurm-17.02.7/etc/slurmdbd.service.in.new 2017-08-21 14:47:56.134071820 -0400 +@@ -8,7 +8,7 @@ + EnvironmentFile=-/etc/sysconfig/slurmdbd + ExecStart=@sbindir@/slurmdbd $SLURMDBD_OPTIONS + ExecReload=/bin/kill -HUP $MAINPID +-PIDFile=/var/run/slurmdbd.pid ++PIDFile=/var/run/slurm/slurmdbd.pid + + [Install] + WantedBy=multi-user.target diff --git a/slurm_setuser.in b/slurm_setuser.in new file mode 100644 index 0000000..7ed78e6 --- /dev/null +++ b/slurm_setuser.in @@ -0,0 +1,229 @@ +#!/bin/bash +# +# Copyright (c) 2017, Philip Kovacs +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +prog=`basename $0` +user=root +group=root +yesno=no + +red='\033[0;31m' +green='\033[0;32m' +nc='\033[0m' +pass="${green}[*]${nc}" +fail="${red}[!]${nc}" +ask="[?]" + +# the rpm spec configures these directory variables +dir_conf="%{_sysconfdir}/%{name}" +dir_log="%{_var}/log/%{name}" +dir_run="%{_rundir}/%{name}" +dir_spool="%{_var}/spool/%{name}" +dir_tmpfiles_d="%{_tmpfilesdir}" + +file_slurm_conf="${dir_conf}/slurm.conf" +file_slurmdbd_conf="${dir_conf}/slurmdbd.conf" +file_tmpfiles_d_conf="${dir_tmpfiles_d}/slurm.conf" + +function usage () +{ + echo -e "Sets the slurm installation on this node to run as the specified user and group\n" + echo "Usage: $prog [-u ] [-g ] [-h] [-y]" + echo " -u user> : the slurm file owner and SlurmUser ($user)" + echo " -g : the slurm file group ($group)" + echo " -y : answer yes to all questions ($yesno)" + echo " -h : print help" +} + +function answer () +{ + while true + do + if [ "${yesno}" = "yes" ]; then + echo -e "${ask} $1 [${yesno}]" + __answer="yes" + break; + fi + + echo -e -n "${ask} " + read -e -p "$1 [${yesno}] " yn + case $yn in + "") __answer=$yesno + break;; + [yY]*) __answer="yes" + break;; + [nN]*) __answer="no" + break;; + *) + echo "Please answer yes or no";; + esac + done +} + +# +# Parse options +# +while getopts "u:g:yh" opt +do + case "$opt" in + h) + usage + exit 2;; + u) + user=$OPTARG;; + g) + group=$OPTARG;; + y) + yesno=yes;; + *) + echo "" + usage + exit 2;; + esac +done + +# +# Run this script only as root +# +if [ $UID -eq 0 ]; then + echo -e "${pass} running as root... good" +else + echo -e "${fail} $prog must be run as root." + exit 1 +fi + +# +# Validate the user and group +# +valid_user="`getent passwd $user || :`" +if [ -n "$valid_user" ]; then + echo -e "${pass} found user $user... good" +else + echo -e "${fail} the specified user was not found... ${user}" + exit 2 +fi +valid_group="`getent group $group || :`" +if [ -n "$valid_group" ]; then + echo -e "${pass} found group $group... good" +else + echo -e "${fail} the specified group was not found... ${group}" + exit 2 +fi + +# +# Slurm services must not be running +# +slurmctld_running_pid="`ps -e | grep slurmctld | grep -v grep | awk '{print $1}'`" +if [ -z "$slurmctld_running_pid" ]; then + echo -e "${pass} slurmctld is not running... good" +else + echo -e "${fail} slurmctld is running... stop it with [systemctl stop slurmctld]" + exit 2 +fi +slurmd_running_pid="`ps -e | grep slurmd | grep -v grep | awk '{print $1}'`" +if [ -z "$slurmd_running_pid" ]; then + echo -e "${pass} slurmd is not running... good" +else + echo -e "${fail} slurmd is running... stop it with [systemctl stop slurmd]" + exit 2 +fi +slurmdbd_running_pid="`ps -e | grep slurmdbd | grep -v grep | awk '{print $1}'`" +if [ -z "$slurmdbd_running_pid" ]; then + echo -e "${pass} slurmdbd is not running... good" +else + echo -e "${fail} slurmdbd is running... stop it with [systemctl stop slurmdbd]" + exit 2 +fi + +# +# Update SlurmUser in the slurm configs +# +for file in "$file_slurm_conf" "$file_slurmdbd_conf" +do + if [ -f "$file" ]; then + answer "update SlurmUser in $file ?" + if [ "$__answer" = "yes" ]; then + sed -i "s|^SlurmUser=.*|SlurmUser=${user}|g" $file + if [ $? -eq 0 ]; then + echo -e "${pass} $file updated successfully" + else + echo -e "${fail} error updating $file" + exit 1 + fi + fi + fi +done + +# +# Update ownership of slurm directories that must be owned by the slurm user +# +for dir in "$dir_log" "$dir_run" "$dir_spool" "$dir_spool/ctld" +do + if [ -d "$dir" ]; then + answer "update ownership of $dir ?" + if [ "$__answer" = "yes" ]; then + chown ${user}:${group} $dir + if [ $? -eq 0 ]; then + echo -e "${pass} $dir updated successfully" + else + echo -e "${fail} error updating $dir" + exit 1 + fi + fi + fi +done + +# +# Update ownership of slurmctld spool files which are owned by the slurm user +# +if [ -d "${dir_spool}/ctld" ]; then + answer "update ownership of files in ${dir_spool}/ctld ?" + if [ "$__answer" = "yes" ]; then + if [ $? -eq 0 ]; then + find ${dir_spool}/ctld -mindepth 1 -exec chown ${user}:${group} {} \; + echo -e "${pass} ${dir_spool}/ctld files updated successfully" + else + echo -e "${fail} error updating ${dir_spool}/ctld files" + exit 1 + fi + fi +fi + +# +# Update the tmpfiles.d config file to the new slurm user +# +if [ -f "$file_tmpfiles_d_conf" ]; then + answer "update tmpfiles.d config $file_tmpfiles_d_conf ?" + if [ "$__answer" = "yes" ]; then + sed -i "s|0755 \(.*\) -$|0755 ${user} ${group} -|g" $file_tmpfiles_d_conf + if [ $? -eq 0 ]; then + echo -e "${pass} $file_tmpfiles_d_conf updated successfully" + else + echo -e "${fail} error updating $file_tmpfiles_d_conf" + exit 1 + fi + fi +fi + +exit 0 diff --git a/slurmdbd.conf b/slurmdbd.conf new file mode 100644 index 0000000..32eb78f --- /dev/null +++ b/slurmdbd.conf @@ -0,0 +1,37 @@ +# +# See the slurmdbd.conf man page for more information. +# +# Archive info +#ArchiveJobs=yes +#ArchiveDir="/tmp" +#ArchiveSteps=yes +#ArchiveScript= +#JobPurge=12 +#StepPurge=1 +# +# Authentication info +AuthType=auth/munge +#AuthInfo=/var/run/munge/munge.socket.2 +# +# slurmDBD info +DbdAddr=localhost +DbdHost=localhost +#DbdPort=7031 +SlurmUser=root +#MessageTimeout=300 +DebugLevel=4 +#DefaultQOS=normal,standby +#LogFile= +PidFile=/var/run/slurm/slurmdbd.pid +#PluginDir= +#PrivateData=accounts,users,usage,jobs +#TrackWCKey=yes +# +# Database info +StorageType=accounting_storage/mysql +#StorageHost=localhost +#StoragePort=1234 +StoragePass=password +StorageUser=slurm +#StorageLoc=slurm_acct_db + diff --git a/sources b/sources new file mode 100644 index 0000000..8bfd228 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (slurm-17.02.7.tar.bz2) = 363ba06b7f2f8a1203396395a3d88b580ba76192bd050c94dbde5c0729fd20a8304f1a0842362588e6e1eed1527f8be47f17dfb0731fbc867d2a253112b147d5