]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: support 'lxc.include' option to include other config files
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Thu, 9 Aug 2012 23:00:58 +0000 (18:00 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 12 Nov 2012 17:04:30 +0000 (12:04 -0500)
For instance

lxc.include = /var/lib/lxc/commonopts

in /var/lib/lxc/q1/config would cause the configuration in
/var/lib/lxc/commonopts to be loaded when container q1 starts.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/confile.c

index 367a92cd07963898d907e635531599d63d4af056..2b5e73c91e44c4f8c1c02bf8e58a68e4e1629574 100644 (file)
@@ -76,6 +76,7 @@ static int config_network_ipv6_gateway(const char *, char *, struct lxc_conf *);
 static int config_cap_drop(const char *, char *, struct lxc_conf *);
 static int config_console(const char *, char *, struct lxc_conf *);
 static int config_seccomp(const char *, char *, struct lxc_conf *);
+static int config_includefile(const char *, char *, struct lxc_conf *);
 
 typedef int (*config_cb)(const char *, char *, struct lxc_conf *);
 
@@ -120,6 +121,7 @@ static struct config config[] = {
        { "lxc.cap.drop",             config_cap_drop             },
        { "lxc.console",              config_console              },
        { "lxc.seccomp",              config_seccomp              },
+       { "lxc.include",              config_includefile          },
 };
 
 static const size_t config_size = sizeof(config)/sizeof(struct config);
@@ -894,6 +896,12 @@ static int config_console(const char *key, char *value,
        return 0;
 }
 
+static int config_includefile(const char *key, char *value,
+                         struct lxc_conf *lxc_conf)
+{
+       return lxc_config_read(value, lxc_conf);
+}
+
 static int config_rootfs(const char *key, char *value, struct lxc_conf *lxc_conf)
 {
        if (strlen(value) >= MAXPATHLEN) {