diff options
author | Daniel Lezcano <dlezcano@fr.ibm.com> | 2009-10-09 11:38:38 +0200 |
---|---|---|
committer | Daniel Lezcano <dlezcano@fr.ibm.com> | 2009-10-09 11:38:38 +0200 |
commit | df83bf6f97e5ddbe50a31aaa75078014d52c0288 (patch) | |
tree | 6cb62f2c5354ae49cd0716c1bc69572c872d3d48 | |
parent | make container to die when parent dies (diff) | |
download | lxc-df83bf6f97e5ddbe50a31aaa75078014d52c0288.tar.gz lxc-df83bf6f97e5ddbe50a31aaa75078014d52c0288.tar.bz2 lxc-df83bf6f97e5ddbe50a31aaa75078014d52c0288.zip |
Read the config file at restart
This patch makes the configuration to read the configuration
file in order to pass the configuration to the different functions.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
-rw-r--r-- | src/lxc/Makefile.am | 5 | ||||
-rw-r--r-- | src/lxc/conf.c | 20 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am index 641abf6..eb90e3e 100644 --- a/src/lxc/Makefile.am +++ b/src/lxc/Makefile.am @@ -37,6 +37,7 @@ liblxc_la_SOURCES = \ lock.c lock.h \ namespace.h namespace.c \ conf.c conf.h \ + confile.c confile.h \ list.h \ state.c state.h \ log.c log.h \ @@ -88,7 +89,7 @@ lxc_unshare_LDADD = liblxc.la lxc_init_SOURCES = lxc_init.c lxc_init_LDADD = liblxc.la -lxc_create_SOURCES = lxc_create.c confile.c confile.h +lxc_create_SOURCES = lxc_create.c lxc_create_LDADD = liblxc.la lxc_destroy_SOURCES = lxc_destroy.c @@ -100,7 +101,7 @@ lxc_start_LDADD = liblxc.la lxc_stop_SOURCES = lxc_stop.c lxc_stop_LDADD = liblxc.la -lxc_execute_SOURCES = lxc_execute.c confile.c confile.h +lxc_execute_SOURCES = lxc_execute.c lxc_execute_LDADD = liblxc.la lxc_monitor_SOURCES = lxc_monitor.c diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 78b2e24..c00d407 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -1850,6 +1850,8 @@ static long make_conf_flagset(const char *name, const char *cons, return flags; } +extern int lxc_config_read(const char *file, struct lxc_conf *conf); + int lxc_setup(const char *name, const char *cons, const struct lxc_tty_info *tty_info) @@ -1858,6 +1860,24 @@ int lxc_setup(const char *name, const char *cons, * work after chrooting */ long flags = make_conf_flagset(name, cons, tty_info); + struct lxc_conf lxc_conf; + char path[MAXPATHLEN]; + + if (lxc_conf_init(&lxc_conf)) { + ERROR("failed to initialize the configuration"); + return -1; + } + + snprintf(path, sizeof(path), LXCPATH "/%s/config", name); + + if (!access(path, F_OK)) { + + if (lxc_config_read(path, &lxc_conf)) { + ERROR("failed to read the configuration file"); + return -1; + } + } + if (conf_is_set(flags, utsname) && setup_utsname(name)) { ERROR("failed to setup the utsname for '%s'", name); return -1; |