confile: namespace lxc.init keys

* rename lxc.init_cmd to lxc.init.cmd
* rename lxc.init_uid to lxc.init.uid
* rename lxc.init_gid to lxc.init.gid

the legacy keys will be kept around until LXC 3.0 and then will be
removed.

Signed-off-by: 0x0916 <w@laoqinren.net>
This commit is contained in:
0x0916 2017-06-28 16:32:04 +08:00
parent 240d4b74ce
commit 9dcf7b4d23
11 changed files with 58 additions and 29 deletions

View File

@ -94,12 +94,12 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
<para> <para>
<!-- <!--
If no command is specified, <command>lxc-start</command> will If no command is specified, <command>lxc-start</command> will
use the command defined in lxc.init_cmd or if not set, the default use the command defined in lxc.init.cmd or if not set, the default
<command>"/sbin/init"</command> command to run a system <command>"/sbin/init"</command> command to run a system
container. container.
--> -->
もし command が指定されない場合は、<command>lxc-start</command> はシステムコンテナを実行するためのコマンドとして、lxc.init_cmd で設定されたコマンドを使用します。 もし command が指定されない場合は、<command>lxc-start</command> はシステムコンテナを実行するためのコマンドとして、lxc.init.cmd で設定されたコマンドを使用します。
もし lxc.init_cmd が設定されていない場合は、デフォルトで <command>"/sbin/init"</command> を使用します。 もし lxc.init.cmd が設定されていない場合は、デフォルトで <command>"/sbin/init"</command> を使用します。
</para> </para>
</refsect1> </refsect1>

View File

@ -349,7 +349,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.init_cmd</option> <option>lxc.init.cmd</option>
</term> </term>
<listitem> <listitem>
<para> <para>
@ -381,7 +381,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.init_uid</option> <option>lxc.init.uid</option>
</term> </term>
<listitem> <listitem>
<para> <para>
@ -394,7 +394,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.init_gid</option> <option>lxc.init.gid</option>
</term> </term>
<listitem> <listitem>
<para> <para>

View File

@ -556,12 +556,12 @@ rootfs
command into the container. command into the container.
The pid of the first process is 1. If no command is The pid of the first process is 1. If no command is
specified <command>lxc-start</command> will specified <command>lxc-start</command> will
run the command defined in lxc.init_cmd or if not set, run the command defined in lxc.init.cmd or if not set,
<filename>/sbin/init</filename> . <filename>/sbin/init</filename> .
--> -->
<command>lxc-start</command> コマンドは、コンテナ内の特定のコマンドを直接実行します。 <command>lxc-start</command> コマンドは、コンテナ内の特定のコマンドを直接実行します。
最初のプロセスの pid が 1 となります。 最初のプロセスの pid が 1 となります。
もし、実行するコマンドが指定されない場合は、<command>lxc-start</command> は lxc.init_cmd で設定されたコマンドを実行します。もし lxc.init_cmd が設定されていない場合は <filename>/sbin/init</filename> を実行します。 もし、実行するコマンドが指定されない場合は、<command>lxc-start</command> は lxc.init.cmd で設定されたコマンドを実行します。もし lxc.init.cmd が設定されていない場合は <filename>/sbin/init</filename> を実行します。
</para> </para>
<para> <para>

View File

@ -95,11 +95,11 @@ by Sungbae Yoo <sungbae.yoo at samsung.com>
<para> <para>
<!-- <!--
If no command is specified, <command>lxc-start</command> will If no command is specified, <command>lxc-start</command> will
use the command defined in lxc.init_cmd or if not set, the default use the command defined in lxc.init.cmd or if not set, the default
<command>"/sbin/init"</command> command to run a system <command>"/sbin/init"</command> command to run a system
container. container.
--> -->
만약 명령어가 지정되지 않았다면, <command>lxc-start</command>는 lxc.init_cmd에 정의된 명령어를 사용한다. 만약 그마저도 없다면 <command>"/sbin/init"</command>명령어를 사용한다. 만약 명령어가 지정되지 않았다면, <command>lxc-start</command>는 lxc.init.cmd에 정의된 명령어를 사용한다. 만약 그마저도 없다면 <command>"/sbin/init"</command>명령어를 사용한다.
</para> </para>
</refsect1> </refsect1>

View File

@ -308,7 +308,7 @@ by Sungbae Yoo <sungbae.yoo at samsung.com>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.init_cmd</option> <option>lxc.init.cmd</option>
</term> </term>
<listitem> <listitem>
<para> <para>
@ -343,7 +343,7 @@ by Sungbae Yoo <sungbae.yoo at samsung.com>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.init_uid</option> <option>lxc.init.uid</option>
</term> </term>
<listitem> <listitem>
<para> <para>
@ -356,7 +356,7 @@ by Sungbae Yoo <sungbae.yoo at samsung.com>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.init_gid</option> <option>lxc.init.gid</option>
</term> </term>
<listitem> <listitem>
<para> <para>

View File

@ -542,10 +542,10 @@ rootfs
command into the container. command into the container.
The pid of the first process is 1. If no command is The pid of the first process is 1. If no command is
specified <command>lxc-start</command> will specified <command>lxc-start</command> will
run the command defined in lxc.init_cmd or if not set, run the command defined in lxc.init.cmd or if not set,
<filename>/sbin/init</filename> . <filename>/sbin/init</filename> .
--> -->
<command>lxc-start</command> 명령어는 지정한 명령어를 컨테이너 내에서 직접 실행한다. 첫 프로세스의 pid는 1번이다. 만약 어떤 명령어도 지정되지 않으면, lxc.init_cmd에 지정된 명령어를 실행한다. 이마저도 지정되있지 않으면, <filename>/sbin/init</filename>를 실행한다. <command>lxc-start</command> 명령어는 지정한 명령어를 컨테이너 내에서 직접 실행한다. 첫 프로세스의 pid는 1번이다. 만약 어떤 명령어도 지정되지 않으면, lxc.init.cmd에 지정된 명령어를 실행한다. 이마저도 지정되있지 않으면, <filename>/sbin/init</filename>를 실행한다.
</para> </para>
<para> <para>

View File

@ -80,7 +80,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
</para> </para>
<para> <para>
If no command is specified, <command>lxc-start</command> will If no command is specified, <command>lxc-start</command> will
use the command defined in lxc.init_cmd or if not set, the default use the command defined in lxc.init.cmd or if not set, the default
<command>"/sbin/init"</command> command to run a system <command>"/sbin/init"</command> command to run a system
container. container.
</para> </para>

View File

@ -263,7 +263,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.init_cmd</option> <option>lxc.init.cmd</option>
</term> </term>
<listitem> <listitem>
<para> <para>
@ -287,7 +287,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.init_uid</option> <option>lxc.init.uid</option>
</term> </term>
<listitem> <listitem>
<para> <para>
@ -297,7 +297,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<option>lxc.init_gid</option> <option>lxc.init.gid</option>
</term> </term>
<listitem> <listitem>
<para> <para>

View File

@ -376,7 +376,7 @@ rootfs
command into the container. command into the container.
The pid of the first process is 1. If no command is The pid of the first process is 1. If no command is
specified <command>lxc-start</command> will specified <command>lxc-start</command> will
run the command defined in lxc.init_cmd or if not set, run the command defined in lxc.init.cmd or if not set,
<filename>/sbin/init</filename> . <filename>/sbin/init</filename> .
</para> </para>

View File

@ -226,18 +226,20 @@ static struct lxc_config_t config[] = {
{ "lxc.monitor.unshare", set_config_monitor, get_config_monitor, clr_config_monitor, }, { "lxc.monitor.unshare", set_config_monitor, get_config_monitor, clr_config_monitor, },
{ "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.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.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.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 /* REMOVE IN LXC 3.0: legacy keys [START]*/
legacy keys { "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, }, { "lxc.limit", set_config_limit, get_config_limit, clr_config_limit, },
/* REMOVE IN LXC 3.0: legacy keys [END]*/
{ "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.prlimit", set_config_prlimit, get_config_prlimit, clr_config_prlimit, }, { "lxc.prlimit", set_config_prlimit, get_config_prlimit, clr_config_prlimit, },
}; };

View File

@ -694,27 +694,54 @@ int main(int argc, char *argv[])
goto non_test_error; goto non_test_error;
} }
/* lxc.init_cmd */ /* REMOVE IN LXC 3.0
legacy lxc.init_cmd key
*/
if (set_get_compare_clear_save_load(c, "lxc.init_cmd", "/bin/bash", if (set_get_compare_clear_save_load(c, "lxc.init_cmd", "/bin/bash",
tmpf, true) < 0) { tmpf, true) < 0) {
lxc_error("%s\n", "lxc.init_cmd"); lxc_error("%s\n", "lxc.init_cmd");
goto non_test_error; goto non_test_error;
} }
/* lxc.init_uid */ /* lxc.init.cmd */
if (set_get_compare_clear_save_load(c, "lxc.init.cmd", "/bin/bash",
tmpf, true) < 0) {
lxc_error("%s\n", "lxc.init.cmd");
goto non_test_error;
}
/* REMOVE IN LXC 3.0
legacy lxc.init_uid key
*/
if (set_get_compare_clear_save_load(c, "lxc.init_uid", "1000", tmpf, if (set_get_compare_clear_save_load(c, "lxc.init_uid", "1000", tmpf,
true) < 0) { true) < 0) {
lxc_error("%s\n", "lxc.init_uid"); lxc_error("%s\n", "lxc.init_uid");
goto non_test_error; goto non_test_error;
} }
/* lxc.init_gid */ /* lxc.init.uid */
if (set_get_compare_clear_save_load(c, "lxc.init.uid", "1000", tmpf,
true) < 0) {
lxc_error("%s\n", "lxc.init.uid");
goto non_test_error;
}
/* REMOVE IN LXC 3.0
legacy lxc.init_gid key
*/
if (set_get_compare_clear_save_load(c, "lxc.init_gid", "1000", tmpf, if (set_get_compare_clear_save_load(c, "lxc.init_gid", "1000", tmpf,
true) < 0) { true) < 0) {
lxc_error("%s\n", "lxc.init_gid"); lxc_error("%s\n", "lxc.init_gid");
goto non_test_error; goto non_test_error;
} }
/* lxc.init.gid */
if (set_get_compare_clear_save_load(c, "lxc.init.gid", "1000", tmpf,
true) < 0) {
lxc_error("%s\n", "lxc.init.gid");
goto non_test_error;
}
/* lxc.ephemeral */ /* lxc.ephemeral */
if (set_get_compare_clear_save_load(c, "lxc.ephemeral", "1", tmpf, if (set_get_compare_clear_save_load(c, "lxc.ephemeral", "1", tmpf,
true) < 0) { true) < 0) {