From: 0x0916 Date: Wed, 28 Jun 2017 09:30:41 +0000 (+0800) Subject: confile: namespace lxc.log keys X-Git-Tag: lxc-2.1.0~75^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=46cc906dc0f1f030c3642a1a7d3e0b9294fe28e2;p=thirdparty%2Flxc.git confile: namespace lxc.log keys * rename lxc.logfile to lxc.log.file * renaem lxc.loglevel to lxc.log.level * rename lxc.syslog to lxc.log.syslog the legacy keys will be kept around until LXC 3.0 and then will be removed. Signed-off-by: 0x0916 --- diff --git a/doc/ja/lxc.container.conf.sgml.in b/doc/ja/lxc.container.conf.sgml.in index 8ac4189e5..2835b0507 100644 --- a/doc/ja/lxc.container.conf.sgml.in +++ b/doc/ja/lxc.container.conf.sgml.in @@ -2410,7 +2410,7 @@ by KATOH Yasufumi - + @@ -2440,7 +2440,7 @@ by KATOH Yasufumi - + @@ -2453,17 +2453,17 @@ by KATOH Yasufumi - + - ログ情報を syslog に送ります。ログレベルとして lxc.loglevel の値を使用します。指定する値は使用する syslog の facility です。有効な値は daemon, local0, local1, local2, local3, local4, local5, local5, local6, local7 のいずれかです。 + ログ情報を syslog に送ります。ログレベルとして lxc.log.level の値を使用します。指定する値は使用する syslog の facility です。有効な値は daemon, local0, local1, local2, local3, local4, local5, local5, local6, local7 のいずれかです。 diff --git a/doc/ko/lxc.container.conf.sgml.in b/doc/ko/lxc.container.conf.sgml.in index 9dba8a96a..1bbf8f440 100644 --- a/doc/ko/lxc.container.conf.sgml.in +++ b/doc/ko/lxc.container.conf.sgml.in @@ -2308,7 +2308,7 @@ mknod errno 0 - + @@ -2338,7 +2338,7 @@ mknod errno 0 - + @@ -2351,17 +2351,17 @@ mknod errno 0 - + - 로그정보를 syslog에 보낸다. 로그 수준은 lxc.loglevel로 지정할 수 있다. 인자는 syslog에 정의된 값으로만 지정할 수 있다. 사용 가능한 값은 다음과 같다 : daemon, local0, local1, local2, local3, local4, local5, local5, local7 + 로그정보를 syslog에 보낸다. 로그 수준은 lxc.log.level로 지정할 수 있다. 인자는 syslog에 정의된 값으로만 지정할 수 있다. 사용 가능한 값은 다음과 같다 : daemon, local0, local1, local2, local3, local4, local5, local5, local7 diff --git a/doc/lxc.container.conf.sgml.in b/doc/lxc.container.conf.sgml.in index cf47e1224..0ef45c494 100644 --- a/doc/lxc.container.conf.sgml.in +++ b/doc/lxc.container.conf.sgml.in @@ -1741,7 +1741,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - + @@ -1761,7 +1761,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - + @@ -1771,12 +1771,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - + Send logging info to syslog. It respects the log level defined in - lxc.loglevel. The argument should be the syslog + lxc.log.level. The argument should be the syslog facility to use, valid ones are: daemon, local0, local1, local2, local3, local4, local5, local5, local6, local7. diff --git a/src/lxc/confile.c b/src/lxc/confile.c index df2a5056a..1af6f5f66 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -83,8 +83,8 @@ lxc_config_define(apparmor_allow_incomplete); lxc_config_define(selinux_context); lxc_config_define(cgroup); lxc_config_define(idmaps); -lxc_config_define(loglevel); -lxc_config_define(logfile); +lxc_config_define(log_level); +lxc_config_define(log_file); lxc_config_define(mount); lxc_config_define(mount_auto); lxc_config_define(fstab); @@ -129,7 +129,7 @@ lxc_config_define(init_cmd); lxc_config_define(init_uid); lxc_config_define(init_gid); lxc_config_define(ephemeral); -lxc_config_define(syslog); +lxc_config_define(log_syslog); lxc_config_define(no_new_privs); lxc_config_define(prlimit); @@ -151,8 +151,6 @@ static struct lxc_config_t config[] = { { "lxc.cgroup", set_config_cgroup, get_config_cgroup, clr_config_cgroup, }, { "lxc.id_map", set_config_idmaps, get_config_idmaps, clr_config_idmaps, }, - { "lxc.loglevel", set_config_loglevel, get_config_loglevel, clr_config_loglevel, }, - { "lxc.logfile", set_config_logfile, get_config_logfile, clr_config_logfile, }, { "lxc.mount.entry", set_config_mount, get_config_mount, clr_config_mount, }, { "lxc.mount.auto", set_config_mount_auto, get_config_mount_auto, clr_config_mount_auto, }, { "lxc.mount", set_config_fstab, get_config_fstab, clr_config_fstab, }, @@ -227,16 +225,21 @@ static struct lxc_config_t config[] = { { "lxc.group", set_config_group, get_config_group, clr_config_group, }, { "lxc.environment", set_config_environment, get_config_environment, clr_config_environment, }, { "lxc.ephemeral", set_config_ephemeral, get_config_ephemeral, clr_config_ephemeral, }, - { "lxc.syslog", set_config_syslog, get_config_syslog, clr_config_syslog, }, { "lxc.no_new_privs", set_config_no_new_privs, get_config_no_new_privs, clr_config_no_new_privs, }, /* REMOVE IN LXC 3.0: legacy keys [START]*/ + { "lxc.syslog", set_config_log_syslog, get_config_log_syslog, clr_config_log_syslog, }, + { "lxc.loglevel", set_config_log_level, get_config_log_level, clr_config_log_level, }, + { "lxc.logfile", set_config_log_file, get_config_log_file, clr_config_log_file, }, { "lxc.init_cmd", set_config_init_cmd, get_config_init_cmd, clr_config_init_cmd, }, { "lxc.init_uid", set_config_init_uid, get_config_init_uid, clr_config_init_uid, }, { "lxc.init_gid", set_config_init_gid, get_config_init_gid, clr_config_init_gid, }, { "lxc.limit", set_config_limit, get_config_limit, clr_config_limit, }, /* REMOVE IN LXC 3.0: legacy keys [END]*/ + { "lxc.log.syslog", set_config_log_syslog, get_config_log_syslog, clr_config_log_syslog, }, + { "lxc.log.level", set_config_log_level, get_config_log_level, clr_config_log_level, }, + { "lxc.log.file", set_config_log_file, get_config_log_file, clr_config_log_file, }, { "lxc.init.cmd", set_config_init_cmd, get_config_init_cmd, clr_config_init_cmd, }, { "lxc.init.uid", set_config_init_uid, get_config_init_uid, clr_config_init_uid, }, { "lxc.init.gid", set_config_init_gid, get_config_init_gid, clr_config_init_gid, }, @@ -1327,7 +1330,7 @@ static int set_config_selinux_context(const char *key, const char *value, return set_config_string_item(&lxc_conf->lsm_se_context, value); } -static int set_config_logfile(const char *key, const char *value, +static int set_config_log_file(const char *key, const char *value, struct lxc_conf *c, void *data) { int ret; @@ -1347,7 +1350,7 @@ static int set_config_logfile(const char *key, const char *value, return ret; } -static int set_config_loglevel(const char *key, const char *value, +static int set_config_log_level(const char *key, const char *value, struct lxc_conf *lxc_conf, void *data) { int newlevel; @@ -2677,7 +2680,7 @@ static int set_config_ephemeral(const char *key, const char *value, return 0; } -static int set_config_syslog(const char *key, const char *value, +static int set_config_log_syslog(const char *key, const char *value, struct lxc_conf *lxc_conf, void *data) { int facility; @@ -2695,7 +2698,7 @@ static int set_config_syslog(const char *key, const char *value, /* Parse value. */ facility = lxc_syslog_priority_to_int(value); if (facility == -EINVAL) { - ERROR("Wrong value for lxc.syslog."); + ERROR("Wrong value for lxc.log.syslog."); return -1; } @@ -2886,7 +2889,7 @@ static int get_config_idmaps(const char *key, char *retv, int inlen, return fulllen; } -static int get_config_loglevel(const char *key, char *retv, int inlen, +static int get_config_log_level(const char *key, char *retv, int inlen, struct lxc_conf *c, void *data) { const char *v; @@ -2894,7 +2897,7 @@ static int get_config_loglevel(const char *key, char *retv, int inlen, return lxc_get_conf_str(retv, inlen, v); } -static int get_config_logfile(const char *key, char *retv, int inlen, +static int get_config_log_file(const char *key, char *retv, int inlen, struct lxc_conf *c, void *data) { return lxc_get_conf_str(retv, inlen, c->logfile); @@ -3187,7 +3190,7 @@ static int get_config_start(const char *key, char *retv, int inlen, return -1; } -static int get_config_syslog(const char *key, char *retv, int inlen, +static int get_config_log_syslog(const char *key, char *retv, int inlen, struct lxc_conf *c, void *data) { return lxc_get_conf_str(retv, inlen, c->syslog); @@ -3388,14 +3391,14 @@ static inline int clr_config_idmaps(const char *key, struct lxc_conf *c, return lxc_clear_idmaps(c); } -static inline int clr_config_loglevel(const char *key, struct lxc_conf *c, +static inline int clr_config_log_level(const char *key, struct lxc_conf *c, void *data) { c->loglevel = LXC_LOG_LEVEL_NOTSET; return 0; } -static inline int clr_config_logfile(const char *key, struct lxc_conf *c, +static inline int clr_config_log_file(const char *key, struct lxc_conf *c, void *data) { free(c->logfile); @@ -3554,7 +3557,7 @@ static inline int clr_config_start(const char *key, struct lxc_conf *c, return 0; } -static inline int clr_config_syslog(const char *key, struct lxc_conf *c, +static inline int clr_config_log_syslog(const char *key, struct lxc_conf *c, void *data) { free(c->syslog); diff --git a/src/lxc/log.c b/src/lxc/log.c index edbd785ef..8105aca7c 100644 --- a/src/lxc/log.c +++ b/src/lxc/log.c @@ -463,10 +463,10 @@ extern void lxc_log_close(void) /* * This can be called: * 1. when a program calls lxc_log_init with no logfile parameter (in which - * case the default is used). In this case lxc.logfile can override this. + * case the default is used). In this case lxc.loge can override this. * 2. when a program calls lxc_log_init with a logfile parameter. In this - * case we don't want lxc.logfile to override this. - * 3. When a lxc.logfile entry is found in config file. + * case we don't want lxc.log to override this. + * 3. When a lxc.log entry is found in config file. */ static int __lxc_log_set_file(const char *fname, int create_dirs) { @@ -614,7 +614,7 @@ extern int lxc_log_init(struct lxc_log *log) } /* - * This is called when we read a lxc.loglevel entry in a lxc.conf file. This + * This is called when we read a lxc.log.level entry in a lxc.conf file. This * happens after processing command line arguments, which override the .conf * settings. So only set the level if previously unset. */ diff --git a/src/python-lxc/lxc/__init__.py b/src/python-lxc/lxc/__init__.py index 989b1b409..ccc4d18bb 100644 --- a/src/python-lxc/lxc/__init__.py +++ b/src/python-lxc/lxc/__init__.py @@ -387,7 +387,7 @@ class Container(_lxc.Container): new_value = self.get_config_item(key) # loglevel is special and won't match the string we set - if key == "lxc.loglevel": + if key == "lxc.log.level": new_value = value if (isinstance(value, str) and isinstance(new_value, str) and diff --git a/src/tests/concurrent.c b/src/tests/concurrent.c index bfefa4809..af63c6a07 100644 --- a/src/tests/concurrent.c +++ b/src/tests/concurrent.c @@ -85,8 +85,8 @@ static void do_function(void *arguments) } if (debug) { - c->set_config_item(c, "lxc.loglevel", "DEBUG"); - c->set_config_item(c, "lxc.logfile", name); + c->set_config_item(c, "lxc.log.level", "DEBUG"); + c->set_config_item(c, "lxc.log", name); } if (strcmp(args->mode, "create") == 0) { diff --git a/src/tests/parse_config_file.c b/src/tests/parse_config_file.c index 815553f78..b2988d646 100644 --- a/src/tests/parse_config_file.c +++ b/src/tests/parse_config_file.c @@ -431,20 +431,39 @@ int main(int argc, char *argv[]) c->clear_config(c); c->lxc_conf = NULL; - /* lxc.loglevel */ + /* REMOVE IN LXC 3.0 + legacy lxc.loglevel key + */ if (set_get_compare_clear_save_load(c, "lxc.loglevel", "DEBUG", tmpf, true) < 0) { lxc_error("%s\n", "lxc.loglevel"); goto non_test_error; } - /* lxc.logfile */ + /* REMOVE IN LXC 3.0 + legacy lxc.logfile key + */ if (set_get_compare_clear_save_load(c, "lxc.logfile", "/some/path", tmpf, true) < 0) { lxc_error("%s\n", "lxc.logfile"); goto non_test_error; } + + /* lxc.log.level */ + if (set_get_compare_clear_save_load(c, "lxc.log.level", "DEBUG", tmpf, + true) < 0) { + lxc_error("%s\n", "lxc.log.level"); + goto non_test_error; + } + + /* lxc.log */ + if (set_get_compare_clear_save_load(c, "lxc.log.file", "/some/path", + tmpf, true) < 0) { + lxc_error("%s\n", "lxc.log.file"); + goto non_test_error; + } + /* lxc.mount */ if (set_get_compare_clear_save_load(c, "lxc.mount", "/some/path", NULL, true) < 0) { @@ -659,10 +678,10 @@ int main(int argc, char *argv[]) goto non_test_error; } - /* lxc.syslog */ - if (set_get_compare_clear_save_load(c, "lxc.syslog", "local0", tmpf, + /* lxc.log.syslog */ + if (set_get_compare_clear_save_load(c, "lxc.log.syslog", "local0", tmpf, true) < 0) { - lxc_error("%s\n", "lxc.syslog"); + lxc_error("%s\n", "lxc.log.syslog"); goto non_test_error; }