Commit 46cc906d by 0x0916

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: 's avatar0x0916 <w@laoqinren.net>
parent 9dcf7b4d
...@@ -2410,7 +2410,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp> ...@@ -2410,7 +2410,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.loglevel</option> <option>lxc.log.level</option>
</term> </term>
<listitem> <listitem>
<para> <para>
...@@ -2440,7 +2440,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp> ...@@ -2440,7 +2440,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.logfile</option> <option>lxc.log</option>
</term> </term>
<listitem> <listitem>
<para> <para>
...@@ -2453,17 +2453,17 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp> ...@@ -2453,17 +2453,17 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.syslog</option> <option>lxc.log.syslog</option>
</term> </term>
<listitem> <listitem>
<para> <para>
<!-- <!--
Send logging info to syslog. It respects the log level defined in Send logging info to syslog. It respects the log level defined in
<command>lxc.loglevel</command>. The argument should be the syslog <command>lxc.log.level</command>. The argument should be the syslog
facility to use, valid ones are: daemon, local0, local1, local2, facility to use, valid ones are: daemon, local0, local1, local2,
local3, local4, local5, local5, local7. local3, local4, local5, local5, local7.
--> -->
ログ情報を syslog に送ります。ログレベルとして <command>lxc.loglevel</command> の値を使用します。指定する値は使用する syslog の facility です。有効な値は daemon, local0, local1, local2, local3, local4, local5, local5, local6, local7 のいずれかです。 ログ情報を syslog に送ります。ログレベルとして <command>lxc.log.level</command> の値を使用します。指定する値は使用する syslog の facility です。有効な値は daemon, local0, local1, local2, local3, local4, local5, local5, local6, local7 のいずれかです。
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
......
...@@ -2308,7 +2308,7 @@ mknod errno 0 ...@@ -2308,7 +2308,7 @@ mknod errno 0
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.loglevel</option> <option>lxc.log.level</option>
</term> </term>
<listitem> <listitem>
<para> <para>
...@@ -2338,7 +2338,7 @@ mknod errno 0 ...@@ -2338,7 +2338,7 @@ mknod errno 0
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.logfile</option> <option>lxc.log</option>
</term> </term>
<listitem> <listitem>
<para> <para>
...@@ -2351,17 +2351,17 @@ mknod errno 0 ...@@ -2351,17 +2351,17 @@ mknod errno 0
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.syslog</option> <option>lxc.log.syslog</option>
</term> </term>
<listitem> <listitem>
<para> <para>
<!-- <!--
Send logging info to syslog. It respects the log level defined in Send logging info to syslog. It respects the log level defined in
<command>lxc.loglevel</command>. The argument should be the syslog <command>lxc.log.level</command>. The argument should be the syslog
facility to use, valid ones are: daemon, local0, local1, local2, facility to use, valid ones are: daemon, local0, local1, local2,
local3, local4, local5, local5, local7. local3, local4, local5, local5, local7.
--> -->
로그정보를 syslog에 보낸다. 로그 수준은 <command>lxc.loglevel</command>로 지정할 수 있다. 인자는 syslog에 정의된 값으로만 지정할 수 있다. 사용 가능한 값은 다음과 같다 : daemon, local0, local1, local2, local3, local4, local5, local5, local7 로그정보를 syslog에 보낸다. 로그 수준은 <command>lxc.log.level</command>로 지정할 수 있다. 인자는 syslog에 정의된 값으로만 지정할 수 있다. 사용 가능한 값은 다음과 같다 : daemon, local0, local1, local2, local3, local4, local5, local5, local7
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
......
...@@ -1741,7 +1741,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ...@@ -1741,7 +1741,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.loglevel</option> <option>lxc.log.level</option>
</term> </term>
<listitem> <listitem>
<para> <para>
...@@ -1761,7 +1761,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
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.logfile</option> <option>lxc.log</option>
</term> </term>
<listitem> <listitem>
<para> <para>
...@@ -1771,12 +1771,12 @@ 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
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.syslog</option> <option>lxc.log.syslog</option>
</term> </term>
<listitem> <listitem>
<para> <para>
Send logging info to syslog. It respects the log level defined in Send logging info to syslog. It respects the log level defined in
<command>lxc.loglevel</command>. The argument should be the syslog <command>lxc.log.level</command>. The argument should be the syslog
facility to use, valid ones are: daemon, local0, local1, local2, facility to use, valid ones are: daemon, local0, local1, local2,
local3, local4, local5, local5, local6, local7. local3, local4, local5, local5, local6, local7.
</para> </para>
......
...@@ -83,8 +83,8 @@ lxc_config_define(apparmor_allow_incomplete); ...@@ -83,8 +83,8 @@ lxc_config_define(apparmor_allow_incomplete);
lxc_config_define(selinux_context); lxc_config_define(selinux_context);
lxc_config_define(cgroup); lxc_config_define(cgroup);
lxc_config_define(idmaps); lxc_config_define(idmaps);
lxc_config_define(loglevel); lxc_config_define(log_level);
lxc_config_define(logfile); lxc_config_define(log_file);
lxc_config_define(mount); lxc_config_define(mount);
lxc_config_define(mount_auto); lxc_config_define(mount_auto);
lxc_config_define(fstab); lxc_config_define(fstab);
...@@ -129,7 +129,7 @@ lxc_config_define(init_cmd); ...@@ -129,7 +129,7 @@ lxc_config_define(init_cmd);
lxc_config_define(init_uid); lxc_config_define(init_uid);
lxc_config_define(init_gid); lxc_config_define(init_gid);
lxc_config_define(ephemeral); lxc_config_define(ephemeral);
lxc_config_define(syslog); lxc_config_define(log_syslog);
lxc_config_define(no_new_privs); lxc_config_define(no_new_privs);
lxc_config_define(prlimit); lxc_config_define(prlimit);
...@@ -151,8 +151,6 @@ static struct lxc_config_t config[] = { ...@@ -151,8 +151,6 @@ static struct lxc_config_t config[] = {
{ "lxc.cgroup", set_config_cgroup, get_config_cgroup, clr_config_cgroup, }, { "lxc.cgroup", set_config_cgroup, get_config_cgroup, clr_config_cgroup, },
{ "lxc.id_map", set_config_idmaps, get_config_idmaps, clr_config_idmaps, }, { "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.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.auto", set_config_mount_auto, get_config_mount_auto, clr_config_mount_auto, },
{ "lxc.mount", set_config_fstab, get_config_fstab, clr_config_fstab, }, { "lxc.mount", set_config_fstab, get_config_fstab, clr_config_fstab, },
...@@ -227,16 +225,21 @@ static struct lxc_config_t config[] = { ...@@ -227,16 +225,21 @@ static struct lxc_config_t config[] = {
{ "lxc.group", set_config_group, get_config_group, clr_config_group, }, { "lxc.group", set_config_group, get_config_group, clr_config_group, },
{ "lxc.environment", set_config_environment, get_config_environment, clr_config_environment, }, { "lxc.environment", set_config_environment, get_config_environment, clr_config_environment, },
{ "lxc.ephemeral", set_config_ephemeral, get_config_ephemeral, clr_config_ephemeral, }, { "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, }, { "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]*/ /* 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_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_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.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, }, { "lxc.limit", set_config_limit, get_config_limit, clr_config_limit, },
/* REMOVE IN LXC 3.0: legacy keys [END]*/ /* 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.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.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.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, ...@@ -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); 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) struct lxc_conf *c, void *data)
{ {
int ret; int ret;
...@@ -1347,7 +1350,7 @@ static int set_config_logfile(const char *key, const char *value, ...@@ -1347,7 +1350,7 @@ static int set_config_logfile(const char *key, const char *value,
return ret; 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) struct lxc_conf *lxc_conf, void *data)
{ {
int newlevel; int newlevel;
...@@ -2677,7 +2680,7 @@ static int set_config_ephemeral(const char *key, const char *value, ...@@ -2677,7 +2680,7 @@ static int set_config_ephemeral(const char *key, const char *value,
return 0; 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) struct lxc_conf *lxc_conf, void *data)
{ {
int facility; int facility;
...@@ -2695,7 +2698,7 @@ static int set_config_syslog(const char *key, const char *value, ...@@ -2695,7 +2698,7 @@ static int set_config_syslog(const char *key, const char *value,
/* Parse value. */ /* Parse value. */
facility = lxc_syslog_priority_to_int(value); facility = lxc_syslog_priority_to_int(value);
if (facility == -EINVAL) { if (facility == -EINVAL) {
ERROR("Wrong value for lxc.syslog."); ERROR("Wrong value for lxc.log.syslog.");
return -1; return -1;
} }
...@@ -2886,7 +2889,7 @@ static int get_config_idmaps(const char *key, char *retv, int inlen, ...@@ -2886,7 +2889,7 @@ static int get_config_idmaps(const char *key, char *retv, int inlen,
return fulllen; 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) struct lxc_conf *c, void *data)
{ {
const char *v; const char *v;
...@@ -2894,7 +2897,7 @@ static int get_config_loglevel(const char *key, char *retv, int inlen, ...@@ -2894,7 +2897,7 @@ static int get_config_loglevel(const char *key, char *retv, int inlen,
return lxc_get_conf_str(retv, inlen, v); 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) struct lxc_conf *c, void *data)
{ {
return lxc_get_conf_str(retv, inlen, c->logfile); 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, ...@@ -3187,7 +3190,7 @@ static int get_config_start(const char *key, char *retv, int inlen,
return -1; 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) struct lxc_conf *c, void *data)
{ {
return lxc_get_conf_str(retv, inlen, c->syslog); 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, ...@@ -3388,14 +3391,14 @@ static inline int clr_config_idmaps(const char *key, struct lxc_conf *c,
return lxc_clear_idmaps(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) void *data)
{ {
c->loglevel = LXC_LOG_LEVEL_NOTSET; c->loglevel = LXC_LOG_LEVEL_NOTSET;
return 0; 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) void *data)
{ {
free(c->logfile); free(c->logfile);
...@@ -3554,7 +3557,7 @@ static inline int clr_config_start(const char *key, struct lxc_conf *c, ...@@ -3554,7 +3557,7 @@ static inline int clr_config_start(const char *key, struct lxc_conf *c,
return 0; 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) void *data)
{ {
free(c->syslog); free(c->syslog);
......
...@@ -463,10 +463,10 @@ extern void lxc_log_close(void) ...@@ -463,10 +463,10 @@ extern void lxc_log_close(void)
/* /*
* This can be called: * This can be called:
* 1. when a program calls lxc_log_init with no logfile parameter (in which * 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 * 2. when a program calls lxc_log_init with a logfile parameter. In this
* case we don't want lxc.logfile to override this. * case we don't want lxc.log to override this.
* 3. When a lxc.logfile entry is found in config file. * 3. When a lxc.log entry is found in config file.
*/ */
static int __lxc_log_set_file(const char *fname, int create_dirs) 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) ...@@ -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 * happens after processing command line arguments, which override the .conf
* settings. So only set the level if previously unset. * settings. So only set the level if previously unset.
*/ */
......
...@@ -387,7 +387,7 @@ class Container(_lxc.Container): ...@@ -387,7 +387,7 @@ class Container(_lxc.Container):
new_value = self.get_config_item(key) new_value = self.get_config_item(key)
# loglevel is special and won't match the string we set # loglevel is special and won't match the string we set
if key == "lxc.loglevel": if key == "lxc.log.level":
new_value = value new_value = value
if (isinstance(value, str) and isinstance(new_value, str) and if (isinstance(value, str) and isinstance(new_value, str) and
......
...@@ -85,8 +85,8 @@ static void do_function(void *arguments) ...@@ -85,8 +85,8 @@ static void do_function(void *arguments)
} }
if (debug) { if (debug) {
c->set_config_item(c, "lxc.loglevel", "DEBUG"); c->set_config_item(c, "lxc.log.level", "DEBUG");
c->set_config_item(c, "lxc.logfile", name); c->set_config_item(c, "lxc.log", name);
} }
if (strcmp(args->mode, "create") == 0) { if (strcmp(args->mode, "create") == 0) {
......
...@@ -431,20 +431,39 @@ int main(int argc, char *argv[]) ...@@ -431,20 +431,39 @@ int main(int argc, char *argv[])
c->clear_config(c); c->clear_config(c);
c->lxc_conf = NULL; 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, if (set_get_compare_clear_save_load(c, "lxc.loglevel", "DEBUG", tmpf,
true) < 0) { true) < 0) {
lxc_error("%s\n", "lxc.loglevel"); lxc_error("%s\n", "lxc.loglevel");
goto non_test_error; 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", if (set_get_compare_clear_save_load(c, "lxc.logfile", "/some/path",
tmpf, true) < 0) { tmpf, true) < 0) {
lxc_error("%s\n", "lxc.logfile"); lxc_error("%s\n", "lxc.logfile");
goto non_test_error; 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 */ /* lxc.mount */
if (set_get_compare_clear_save_load(c, "lxc.mount", "/some/path", NULL, if (set_get_compare_clear_save_load(c, "lxc.mount", "/some/path", NULL,
true) < 0) { true) < 0) {
...@@ -659,10 +678,10 @@ int main(int argc, char *argv[]) ...@@ -659,10 +678,10 @@ int main(int argc, char *argv[])
goto non_test_error; goto non_test_error;
} }
/* lxc.syslog */ /* lxc.log.syslog */
if (set_get_compare_clear_save_load(c, "lxc.syslog", "local0", tmpf, if (set_get_compare_clear_save_load(c, "lxc.log.syslog", "local0", tmpf,
true) < 0) { true) < 0) {
lxc_error("%s\n", "lxc.syslog"); lxc_error("%s\n", "lxc.log.syslog");
goto non_test_error; goto non_test_error;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment