From 9a3325960fe5cd722ddc1c327316a63debe2c733 Mon Sep 17 00:00:00 2001
From: Nate Rini <nate@schedmd.com>
Date: Thu, 15 Apr 2021 13:52:13 -0600
Subject: [PATCH] Add OCI container config to slurmd_conf_t

Bug 11380
---
 src/slurmd/common/slurmstepd_init.c | 5 +++++
 src/slurmd/slurmd/slurmd.c          | 4 ++++
 src/slurmd/slurmd/slurmd.h          | 2 ++
 3 files changed, 11 insertions(+)

diff --git a/src/slurmd/common/slurmstepd_init.c b/src/slurmd/common/slurmstepd_init.c
index f161878de92..35643d5ae19 100644
--- a/src/slurmd/common/slurmstepd_init.c
+++ b/src/slurmd/common/slurmstepd_init.c
@@ -68,6 +68,8 @@ extern void pack_slurmd_conf_lite(slurmd_conf_t *conf, buf_t *buffer)
 	pack32(conf->daemonize, buffer);
 	packstr(conf->node_topo_addr, buffer);
 	packstr(conf->node_topo_pattern, buffer);
+	packstr(conf->oci_container_id_pattern, buffer);
+	packstr(conf->oci_runtime, buffer);
 	pack16(conf->port, buffer);
 	packstr(conf->gres, buffer);
 }
@@ -106,6 +108,9 @@ extern int unpack_slurmd_conf_lite_no_alloc(slurmd_conf_t *conf, buf_t *buffer)
 		conf->daemonize = uint32_tmp;
 		safe_unpackstr_xmalloc(&conf->node_topo_addr, &uint32_tmp, buffer);
 		safe_unpackstr_xmalloc(&conf->node_topo_pattern, &uint32_tmp, buffer);
+		safe_unpackstr_xmalloc(&conf->oci_container_id_pattern,
+				       &uint32_tmp, buffer);
+		safe_unpackstr_xmalloc(&conf->oci_runtime, &uint32_tmp, buffer);
 		safe_unpack16(&conf->port, buffer);
 		safe_unpackstr_xmalloc(&conf->gres, &uint32_tmp, buffer);
 	}
diff --git a/src/slurmd/slurmd/slurmd.c b/src/slurmd/slurmd/slurmd.c
index 68f2c1b2463..5b480cf4d0c 100644
--- a/src/slurmd/slurmd/slurmd.c
+++ b/src/slurmd/slurmd/slurmd.c
@@ -1059,6 +1059,10 @@ _read_config(void)
 
 	if (cf->control_addr == NULL)
 		fatal("Unable to establish controller machine");
+
+	conf->oci_container_id_pattern = xstrdup(cf->oci_container_id_pattern);
+	conf->oci_runtime = xstrdup(cf->oci_runtime);
+
 	if (cf->slurmctld_port == 0)
 		fatal("Unable to establish controller port");
 
diff --git a/src/slurmd/slurmd/slurmd.h b/src/slurmd/slurmd/slurmd.h
index b7bab8b375c..d4d09ed709a 100644
--- a/src/slurmd/slurmd/slurmd.h
+++ b/src/slurmd/slurmd/slurmd.h
@@ -113,6 +113,8 @@ typedef struct slurmd_config {
 	char         *node_name;	/* node name                       */
 	char         *node_topo_addr;   /* node's topology address         */
 	char         *node_topo_pattern;/* node's topology address pattern */
+	char *oci_container_id_pattern;	/* OCI Container id pattern        */
+	char *oci_runtime;		/* OCI Container runtime command   */
 	char         *conffile;		/* config filename                 */
 	char         *logfile;		/* slurmd logfile, if any          */
 	uint32_t     syslog_debug;	/* send output to both logfile and
-- 
GitLab