diff --git a/src/plugins/job_container/tmpfs/Makefile.am b/src/plugins/job_container/tmpfs/Makefile.am index c24aa5e46105a68eec4bc3b753016fc951c5e4de..5a63f8ffa4896b56666ce40372a79c37247c040b 100644 --- a/src/plugins/job_container/tmpfs/Makefile.am +++ b/src/plugins/job_container/tmpfs/Makefile.am @@ -9,6 +9,6 @@ AM_CPPFLAGS = -DSLURM_PLUGIN_DEBUG -I$(top_srcdir) -I$(top_srcdir)/src/common pkglib_LTLIBRARIES = job_container_tmpfs.la # job_container/none plugin. -job_container_tmpfs_la_SOURCES = job_container_tmpfs.c read_nsconf.c \ - read_nsconf.h +job_container_tmpfs_la_SOURCES = job_container_tmpfs.c read_jcconf.c \ + read_jcconf.h job_container_tmpfs_la_LDFLAGS = $(PLUGIN_FLAGS) diff --git a/src/plugins/job_container/tmpfs/Makefile.in b/src/plugins/job_container/tmpfs/Makefile.in index cbac2e8b92d55f3cd0731f446f3a772f5389f0e7..5d36a50d1f95b0a6ea2afabec51419ada21ceed0 100644 --- a/src/plugins/job_container/tmpfs/Makefile.in +++ b/src/plugins/job_container/tmpfs/Makefile.in @@ -178,7 +178,7 @@ am__installdirs = "$(DESTDIR)$(pkglibdir)" LTLIBRARIES = $(pkglib_LTLIBRARIES) job_container_tmpfs_la_LIBADD = am_job_container_tmpfs_la_OBJECTS = job_container_tmpfs.lo \ - read_nsconf.lo + read_jcconf.lo job_container_tmpfs_la_OBJECTS = $(am_job_container_tmpfs_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -204,7 +204,7 @@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -I$(top_builddir)/slurm depcomp = $(SHELL) $(top_srcdir)/auxdir/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/job_container_tmpfs.Plo \ - ./$(DEPDIR)/read_nsconf.Plo + ./$(DEPDIR)/read_jcconf.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -510,8 +510,8 @@ AM_CPPFLAGS = -DSLURM_PLUGIN_DEBUG -I$(top_srcdir) -I$(top_srcdir)/src/common pkglib_LTLIBRARIES = job_container_tmpfs.la # job_container/none plugin. -job_container_tmpfs_la_SOURCES = job_container_tmpfs.c read_nsconf.c \ - read_nsconf.h +job_container_tmpfs_la_SOURCES = job_container_tmpfs.c read_jcconf.c \ + read_jcconf.h job_container_tmpfs_la_LDFLAGS = $(PLUGIN_FLAGS) all: all-am @@ -593,7 +593,7 @@ distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/job_container_tmpfs.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read_nsconf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read_jcconf.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @@ -723,7 +723,7 @@ clean-am: clean-generic clean-libtool clean-pkglibLTLIBRARIES \ distclean: distclean-am -rm -f ./$(DEPDIR)/job_container_tmpfs.Plo - -rm -f ./$(DEPDIR)/read_nsconf.Plo + -rm -f ./$(DEPDIR)/read_jcconf.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -770,7 +770,7 @@ installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/job_container_tmpfs.Plo - -rm -f ./$(DEPDIR)/read_nsconf.Plo + -rm -f ./$(DEPDIR)/read_jcconf.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic diff --git a/src/plugins/job_container/tmpfs/job_container_tmpfs.c b/src/plugins/job_container/tmpfs/job_container_tmpfs.c index 5e5d5cf77efb2aca193af51adbcc32d5eb6245cb..9b04f1b86daa38af595142d6d0efc8dfeb49bd26 100644 --- a/src/plugins/job_container/tmpfs/job_container_tmpfs.c +++ b/src/plugins/job_container/tmpfs/job_container_tmpfs.c @@ -56,7 +56,7 @@ #include "src/common/log.h" #include "src/common/run_command.h" -#include "read_nsconf.h" +#include "read_jcconf.h" #if defined (__APPLE__) extern slurmd_conf_t *conf __attribute__((weak_import)); @@ -68,7 +68,7 @@ const char plugin_name[] = "job_container tmpfs plugin"; const char plugin_type[] = "job_container/tmpfs"; const uint32_t plugin_version = SLURM_VERSION_NUMBER; -static slurm_ns_conf_t *ns_conf = NULL; +static slurm_jc_conf_t *jc_conf = NULL; static int step_ns_fd = -1; static int _create_paths(uint32_t job_id, @@ -77,9 +77,9 @@ static int _create_paths(uint32_t job_id, char *src_bind, char *active) { - ns_conf = get_slurm_ns_conf(); + jc_conf = get_slurm_jc_conf(); - if (!ns_conf) { + if (!jc_conf) { error("%s: Configuration not read correctly: did %s not exist?", __func__, tmpfs_conf_file); return SLURM_ERROR; @@ -87,7 +87,7 @@ static int _create_paths(uint32_t job_id, xassert(job_mount); - if (snprintf(job_mount, PATH_MAX, "%s/%u", ns_conf->basepath, job_id) + if (snprintf(job_mount, PATH_MAX, "%s/%u", jc_conf->basepath, job_id) >= PATH_MAX) { error("%s: Unable to build job %u mount path: %m", __func__, job_id); @@ -158,18 +158,18 @@ extern int fini(void) return SLURM_SUCCESS; #endif - ns_conf = get_slurm_ns_conf(); - if (!ns_conf) { + jc_conf = get_slurm_jc_conf(); + if (!jc_conf) { error("%s: Configuration not loaded", __func__); return SLURM_ERROR; } - rc = umount2(ns_conf->basepath, MNT_DETACH); + rc = umount2(jc_conf->basepath, MNT_DETACH); if (rc) { error("%s: umount2: %s failed: %s", - __func__, ns_conf->basepath, strerror(errno)); + __func__, jc_conf->basepath, strerror(errno)); return SLURM_ERROR; } - free_ns_conf(); + free_jc_conf(); if (step_ns_fd != -1) { close(step_ns_fd); @@ -185,29 +185,29 @@ extern int container_p_restore(char *dir_name, bool recover) return SLURM_SUCCESS; #endif - ns_conf = get_slurm_ns_conf(); - if (!ns_conf) { + jc_conf = get_slurm_jc_conf(); + if (!jc_conf) { error("%s: Configuration not loaded", __func__); return SLURM_ERROR; } debug("namepsace.conf read successfully"); - if (ns_conf->auto_basepath) { + if (jc_conf->auto_basepath) { int fstatus; char *mnt_point, *p; mode_t omask; omask = umask(S_IWGRP | S_IWOTH); - fstatus = mkdir(ns_conf->basepath, 0755); + fstatus = mkdir(jc_conf->basepath, 0755); if (fstatus && errno != EEXIST) { - if (ns_conf->basepath[0] != '/') { - debug("unable to create ns directory '%s' : does not start with '/'", ns_conf->basepath); + if (jc_conf->basepath[0] != '/') { + debug("unable to create ns directory '%s' : does not start with '/'", jc_conf->basepath); umask(omask); return SLURM_ERROR; } - mnt_point = xstrdup(ns_conf->basepath); + mnt_point = xstrdup(jc_conf->basepath); p = mnt_point; while ((p = xstrchr(p+1, '/')) != NULL) { *p = '\0'; @@ -222,12 +222,12 @@ extern int container_p_restore(char *dir_name, bool recover) *p='/'; } xfree(mnt_point); - fstatus = mkdir(ns_conf->basepath, 0755); + fstatus = mkdir(jc_conf->basepath, 0755); } if (fstatus && errno != EEXIST) { debug("unable to create ns directory '%s' : %m", - ns_conf->basepath); + jc_conf->basepath); umask(omask); return SLURM_ERROR; } @@ -243,12 +243,12 @@ extern int container_p_restore(char *dir_name, bool recover) * done by calling mount() a second time with MS_PRIVATE and MS_REC * flags. */ - if (mount(ns_conf->basepath, ns_conf->basepath, "xfs", MS_BIND, NULL)) { + if (mount(jc_conf->basepath, jc_conf->basepath, "xfs", MS_BIND, NULL)) { error("%s: Initial base mount failed, %s", __func__, strerror(errno)); return SLURM_ERROR; } - if (mount(ns_conf->basepath, ns_conf->basepath, "xfs", + if (mount(jc_conf->basepath, jc_conf->basepath, "xfs", MS_PRIVATE | MS_REC, NULL)) { error("%s: Initial base mount failed, %s", __func__, strerror(errno)); @@ -377,12 +377,12 @@ extern int container_p_create(uint32_t job_id) close(fd); /* run any initialization script- if any*/ - if (ns_conf->initscript) { - result = run_command("initscript", ns_conf->initscript, NULL, + if (jc_conf->initscript) { + result = run_command("initscript", jc_conf->initscript, NULL, 10000, 0, &rc); if (rc) { error("%s: init script: %s failed", - __func__, ns_conf->initscript); + __func__, jc_conf->initscript); goto exit2; } else { debug3("initscript stdout: %s", result); @@ -466,7 +466,7 @@ extern int container_p_create(uint32_t job_id) * mounts inside the job, they will only see their job mount * but not the basepath mount. */ - rc = umount2(ns_conf->basepath, MNT_DETACH); + rc = umount2(jc_conf->basepath, MNT_DETACH); if (rc) { error("%s: umount2 failed: %s", __func__, strerror(errno)); diff --git a/src/plugins/job_container/tmpfs/read_nsconf.c b/src/plugins/job_container/tmpfs/read_jcconf.c similarity index 79% rename from src/plugins/job_container/tmpfs/read_nsconf.c rename to src/plugins/job_container/tmpfs/read_jcconf.c index 67c8644a1f7f6ad0c5bd28408654aaa9628164cb..28387ca32f8af70af7a4113149436fe4917d743c 100644 --- a/src/plugins/job_container/tmpfs/read_nsconf.c +++ b/src/plugins/job_container/tmpfs/read_jcconf.c @@ -1,5 +1,5 @@ /*****************************************************************************\ - * read_nsconf.c - parse job_container.conf configuration file. + * read_jcconf.c - parse job_container.conf configuration file. ***************************************************************************** * Copyright (C) 2019-2021 Regents of the University of California * Produced at Lawrence Berkeley National Laboratory @@ -46,12 +46,12 @@ #include "src/common/read_config.h" #include "src/common/xmalloc.h" -#include "read_nsconf.h" +#include "read_jcconf.h" char *tmpfs_conf_file = "job_container.conf"; -static slurm_ns_conf_t slurm_ns_conf; -static bool slurm_ns_conf_inited = false; +static slurm_jc_conf_t slurm_jc_conf; +static bool slurm_jc_conf_inited = false; static bool auto_basepath_set = false; static s_p_hashtbl_t *_create_ns_hashtbl(void) @@ -66,7 +66,7 @@ static s_p_hashtbl_t *_create_ns_hashtbl(void) return s_p_hashtbl_create(ns_options); } -static int _parse_ns_conf_internal(void **dest, slurm_parser_enum_t type, +static int _parse_jc_conf_internal(void **dest, slurm_parser_enum_t type, const char *key, const char *value, const char *line, char **leftover) { @@ -75,8 +75,8 @@ static int _parse_ns_conf_internal(void **dest, slurm_parser_enum_t type, s_p_parse_line(tbl, *leftover, leftover); if (value) - slurm_ns_conf.basepath = xstrdup(value); - else if (!s_p_get_string(&slurm_ns_conf.basepath, "BasePath", tbl)) { + slurm_jc_conf.basepath = xstrdup(value); + else if (!s_p_get_string(&slurm_jc_conf.basepath, "BasePath", tbl)) { fatal("empty basepath detected, please verify %s is correct", tmpfs_conf_file); rc = 0; @@ -84,13 +84,13 @@ static int _parse_ns_conf_internal(void **dest, slurm_parser_enum_t type, } #ifdef MULTIPLE_SLURMD - xstrfmtcat(slurm_ns_conf.basepath, "/%s", conf->node_name); + xstrfmtcat(slurm_jc_conf.basepath, "/%s", conf->node_name); #endif - if (s_p_get_boolean(&slurm_ns_conf.auto_basepath, "AutoBasePath", tbl)) + if (s_p_get_boolean(&slurm_jc_conf.auto_basepath, "AutoBasePath", tbl)) auto_basepath_set = true; - if (!s_p_get_string(&slurm_ns_conf.initscript, "InitScript", tbl)) + if (!s_p_get_string(&slurm_jc_conf.initscript, "InitScript", tbl)) debug3("empty init script detected"); end_it: @@ -101,7 +101,7 @@ end_it: return rc; } -static int _parse_ns_conf(void **dest, slurm_parser_enum_t type, +static int _parse_jc_conf(void **dest, slurm_parser_enum_t type, const char *key, const char *value, const char *line, char **leftover) { @@ -121,10 +121,10 @@ static int _parse_ns_conf(void **dest, slurm_parser_enum_t type, } } - return _parse_ns_conf_internal(dest, type, key, NULL, line, leftover); + return _parse_jc_conf_internal(dest, type, key, NULL, line, leftover); } -static int _read_slurm_ns_conf(void) +static int _read_slurm_jc_conf(void) { char *conf_path = NULL; s_p_hashtbl_t *tbl = NULL; @@ -133,8 +133,8 @@ static int _read_slurm_ns_conf(void) static s_p_options_t options[] = { {"AutoBasePath", S_P_BOOLEAN}, - {"BasePath", S_P_ARRAY, _parse_ns_conf_internal, NULL}, - {"NodeName", S_P_ARRAY, _parse_ns_conf, NULL}, + {"BasePath", S_P_ARRAY, _parse_jc_conf_internal, NULL}, + {"NodeName", S_P_ARRAY, _parse_jc_conf, NULL}, {NULL} }; @@ -158,10 +158,10 @@ static int _read_slurm_ns_conf(void) /* If AutoBasePath wasn't set on the line see if it was on the global */ if (!auto_basepath_set) - s_p_get_boolean(&slurm_ns_conf.auto_basepath, + s_p_get_boolean(&slurm_jc_conf.auto_basepath, "AutoBasePath", tbl); - if (!slurm_ns_conf.basepath) { + if (!slurm_jc_conf.basepath) { error("Configuration for this node not found in %s", tmpfs_conf_file); rc = SLURM_ERROR; @@ -175,25 +175,25 @@ end_it: return rc; } -extern slurm_ns_conf_t *get_slurm_ns_conf(void) +extern slurm_jc_conf_t *get_slurm_jc_conf(void) { int rc; - if (!slurm_ns_conf_inited) { - memset(&slurm_ns_conf, 0, sizeof(slurm_ns_conf_t)); - rc = _read_slurm_ns_conf(); + if (!slurm_jc_conf_inited) { + memset(&slurm_jc_conf, 0, sizeof(slurm_jc_conf_t)); + rc = _read_slurm_jc_conf(); if (rc == SLURM_ERROR) return NULL; - slurm_ns_conf_inited = true; + slurm_jc_conf_inited = true; } - return &slurm_ns_conf; + return &slurm_jc_conf; } -extern void free_ns_conf(void) +extern void free_jc_conf(void) { - if (slurm_ns_conf_inited) { - xfree(slurm_ns_conf.basepath); - xfree(slurm_ns_conf.initscript); + if (slurm_jc_conf_inited) { + xfree(slurm_jc_conf.basepath); + xfree(slurm_jc_conf.initscript); } return; } diff --git a/src/plugins/job_container/tmpfs/read_nsconf.h b/src/plugins/job_container/tmpfs/read_jcconf.h similarity index 90% rename from src/plugins/job_container/tmpfs/read_nsconf.h rename to src/plugins/job_container/tmpfs/read_jcconf.h index 70f8d6ea4b7a1e82ea58d2adff7626860a040cea..4aa1db7239ffb4b4448331e38c60335f3089d861 100644 --- a/src/plugins/job_container/tmpfs/read_nsconf.h +++ b/src/plugins/job_container/tmpfs/read_jcconf.h @@ -1,5 +1,5 @@ /*****************************************************************************\ - * read_nsconf.h - parse job_container.conf configuration file. + * read_jcconf.h - parse job_container.conf configuration file. ***************************************************************************** * Copyright (C) 2019-2021 Regents of the University of California * Produced at Lawrence Berkeley National Laboratory @@ -35,8 +35,8 @@ * with SLURM; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. \*****************************************************************************/ -#ifndef _READ_NSCONF_H -#define _READ_NSCONF_H +#ifndef _READ_JCCONF_H +#define _READ_JCCONF_H #include "src/slurmd/slurmd/slurmd.h" @@ -44,16 +44,16 @@ * Slurm namespace job container plugin initialization * parameters */ -typedef struct slurm_ns_conf { +typedef struct slurm_jc_conf { bool auto_basepath; char *basepath; char *initscript; -} slurm_ns_conf_t; +} slurm_jc_conf_t; extern char *tmpfs_conf_file; -extern slurm_ns_conf_t *get_slurm_ns_conf(void); +extern slurm_jc_conf_t *get_slurm_jc_conf(void); -extern void free_ns_conf(void); +extern void free_jc_conf(void); #endif