confile: namespace lxc.signal keys

* rename lxc.haltsignal to lxc.signal.halt
* rename lxc.rebootsignal to lxc.signal.reboot
* rename lxc.stopsignal to lxc.signal.stop

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 19:26:02 +08:00
parent 46cc906dc0
commit 55c84efcba
12 changed files with 81 additions and 46 deletions

View File

@ -5,8 +5,8 @@ lxc.include = @LXCTEMPLATECONFIG@/common.conf
lxc.tty = 6
# Set the halt/stop signals
lxc.haltsignal=SIGRTMIN+4
lxc.stopsignal=SIGRTMIN+14
lxc.signal.halt=SIGRTMIN+4
lxc.signal.stop=SIGRTMIN+14
# Uncomment to disable creating tty devices subdirectory in /dev
# lxc.devttydir =

View File

@ -8,7 +8,7 @@ lxc.tty = 6
lxc.environment=VIRTUALIZATION=lxc
# Set the halt/stop signals
lxc.haltsignal=SIGCONT
lxc.signal.halt=SIGCONT
# Uncomment to disable creating tty devices subdirectory in /dev

View File

@ -5,4 +5,4 @@ lxc.include = @LXCTEMPLATECONFIG@/userns.conf
lxc.environment=VIRTUALIZATION=lxc
# Set the halt/stop signals
lxc.haltsignal=SIGCONT
lxc.signal.halt=SIGCONT

View File

@ -73,18 +73,18 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
<command>lxc-stop</command> reboots, cleanly shuts down, or kills
all the processes inside the container. By default, it will
request a clean shutdown of the container by sending
<command>lxc.haltsignal</command> (defaults to SIGPWR) to
<command>lxc.signal.halt</command> (defaults to SIGPWR) to
the container's init process, waiting up to 60 seconds for the container
to exit, and then returning. If the container fails to cleanly exit in
60 seconds, it will be sent the <command>lxc.stopsignal</command>
60 seconds, it will be sent the <command>lxc.signal.stop</command>
(defaults to SIGKILL) to force it to shut down. A request to reboot will
send the <command>lxc.rebootsignal</command> (defaults to SIGINT) to the
send the <command>lxc.signal.reboot</command> (defaults to SIGINT) to the
container's init process.
-->
<command>lxc-stop</command> は、リブート、クリーンシャットダウン、コンテナ内の全てのプロセスの kill のどれかを行います。
デフォルトでは、コンテナのクリーンなシャットダウンを <command>lxc.haltsignal</command> (デフォルトでは SIGPWR) をコンテナの init プロセスに送ることでリクエストし、コンテナの終了を 60 秒待ち、return します。
コンテナが 60 秒の間にクリーンに終了するのに失敗した場合、<command>lxc.stopsignal</command> (デフォルトは SIGKILL です) を送り、強制的にシャットダウンします。
リブートのリクエストは <command>lxc.rebootsignal</command> に設定されたシグナルをコンテナの init プロセスに送ります (デフォルトは SIGINT です)。
デフォルトでは、コンテナのクリーンなシャットダウンを <command>lxc.signal.halt</command> (デフォルトでは SIGPWR) をコンテナの init プロセスに送ることでリクエストし、コンテナの終了を 60 秒待ち、return します。
コンテナが 60 秒の間にクリーンに終了するのに失敗した場合、<command>lxc.signal.stop</command> (デフォルトは SIGKILL です) を送り、強制的にシャットダウンします。
リブートのリクエストは <command>lxc.signal.reboot</command> に設定されたシグナルをコンテナの init プロセスに送ります (デフォルトは SIGINT です)。
</para>
<para>

View File

@ -260,7 +260,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
<variablelist>
<varlistentry>
<term>
<option>lxc.haltsignal</option>
<option>lxc.signal.halt</option>
</term>
<listitem>
<para>
@ -289,7 +289,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
<variablelist>
<varlistentry>
<term>
<option>lxc.rebootsignal</option>
<option>lxc.signal.reboot</option>
</term>
<listitem>
<para>
@ -318,7 +318,7 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
<variablelist>
<varlistentry>
<term>
<option>lxc.stopsignal</option>
<option>lxc.signal.stop</option>
</term>
<listitem>
<para>

View File

@ -73,16 +73,16 @@ by Sungbae Yoo <sungbae.yoo at samsung.com>
<command>lxc-stop</command> reboots, cleanly shuts down, or kills
all the processes inside the container. By default, it will
request a clean shutdown of the container by sending
<command>lxc.haltsignal</command> (defaults to SIGPWR) to
<command>lxc.signal.halt</command> (defaults to SIGPWR) to
the container's init process, waiting up to 60 seconds for the container
to exit, and then returning. If the container fails to cleanly exit in
60 seconds, it will be sent the <command>lxc.stopsignal</command>
60 seconds, it will be sent the <command>lxc.signal.stop</command>
(defaults to SIGKILL) to force it to shut down. A request to reboot will
send the <command>lxc.rebootsignal</command> (defaults to SIGINT) to the
send the <command>lxc.signal.reboot</command> (defaults to SIGINT) to the
container's init process.
-->
<command>lxc-stop</command> 는 재뷰탕, 종료, 또는 컨테이너 내의 모든 프로세스를 강제종료 시킨다. 기본 동작은 컨테이너에게 <command>lxc.haltsignal</command> 시그널(기본값은 SIGPWR)을 컨테이너 init 프로세스에게 날려, 컨테이너가 종료되게 요청하는 것이다. 60초 동안 컨테이너가 종료되는 것을 기다리고 리턴된다.
만약 컨테이너가 60초안에 종료되지 않는다면 <command>lxc.stopsignal</command> 시그널(기본값은 SIGKILL)을 날려 강제로 종료시킨다. 재부팅 요청시에는 <command>lxc.rebootsignal</command> 시그널(기본값은 SIGINT)를 컨테이너 init 프로세스에게 날린다.
<command>lxc-stop</command> 는 재뷰탕, 종료, 또는 컨테이너 내의 모든 프로세스를 강제종료 시킨다. 기본 동작은 컨테이너에게 <command>lxc.signal.halt</command> 시그널(기본값은 SIGPWR)을 컨테이너 init 프로세스에게 날려, 컨테이너가 종료되게 요청하는 것이다. 60초 동안 컨테이너가 종료되는 것을 기다리고 리턴된다.
만약 컨테이너가 60초안에 종료되지 않는다면 <command>lxc.signal.stop</command> 시그널(기본값은 SIGKILL)을 날려 강제로 종료시킨다. 재부팅 요청시에는 <command>lxc.signal.reboot</command> 시그널(기본값은 SIGINT)를 컨테이너 init 프로세스에게 날린다.
</para>
<para>

View File

@ -219,7 +219,7 @@ by Sungbae Yoo <sungbae.yoo at samsung.com>
<variablelist>
<varlistentry>
<term>
<option>lxc.haltsignal</option>
<option>lxc.signal.halt</option>
</term>
<listitem>
<para>
@ -248,7 +248,7 @@ by Sungbae Yoo <sungbae.yoo at samsung.com>
<variablelist>
<varlistentry>
<term>
<option>lxc.rebootsignal</option>
<option>lxc.signal.reboot</option>
</term>
<listitem>
<para>
@ -277,7 +277,7 @@ by Sungbae Yoo <sungbae.yoo at samsung.com>
<variablelist>
<varlistentry>
<term>
<option>lxc.stopsignal</option>
<option>lxc.signal.stop</option>
</term>
<listitem>
<para>

View File

@ -66,12 +66,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<command>lxc-stop</command> reboots, cleanly shuts down, or kills
all the processes inside the container. By default, it will
request a clean shutdown of the container by sending
<command>lxc.haltsignal</command> (defaults to SIGPWR) to
<command>lxc.signal.halt</command> (defaults to SIGPWR) to
the container's init process, waiting up to 60 seconds for the container
to exit, and then returning. If the container fails to cleanly exit in
60 seconds, it will be sent the <command>lxc.stopsignal</command>
60 seconds, it will be sent the <command>lxc.signal.stop</command>
(defaults to SIGKILL) to force it to shut down. A request to reboot will
send the <command>lxc.rebootsignal</command> (defaults to SIGINT) to the
send the <command>lxc.signal.reboot</command> (defaults to SIGINT) to the
container's init process.
</para>
<para>

View File

@ -196,7 +196,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<variablelist>
<varlistentry>
<term>
<option>lxc.haltsignal</option>
<option>lxc.signal.halt</option>
</term>
<listitem>
<para>
@ -218,7 +218,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<variablelist>
<varlistentry>
<term>
<option>lxc.rebootsignal</option>
<option>lxc.signal.reboot</option>
</term>
<listitem>
<para>
@ -240,7 +240,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<variablelist>
<varlistentry>
<term>
<option>lxc.stopsignal</option>
<option>lxc.signal.stop</option>
</term>
<listitem>
<para>

View File

@ -118,9 +118,9 @@ lxc_config_define(console);
lxc_config_define(seccomp);
lxc_config_define(includefiles);
lxc_config_define(autodev);
lxc_config_define(haltsignal);
lxc_config_define(rebootsignal);
lxc_config_define(stopsignal);
lxc_config_define(signal_halt);
lxc_config_define(signal_reboot);
lxc_config_define(signal_stop);
lxc_config_define(start);
lxc_config_define(monitor);
lxc_config_define(group);
@ -215,9 +215,17 @@ static struct lxc_config_t config[] = {
{ "lxc.seccomp", set_config_seccomp, get_config_seccomp, clr_config_seccomp, },
{ "lxc.include", set_config_includefiles, get_config_includefiles, clr_config_includefiles, },
{ "lxc.autodev", set_config_autodev, get_config_autodev, clr_config_autodev, },
{ "lxc.haltsignal", set_config_haltsignal, get_config_haltsignal, clr_config_haltsignal, },
{ "lxc.rebootsignal", set_config_rebootsignal, get_config_rebootsignal, clr_config_rebootsignal, },
{ "lxc.stopsignal", set_config_stopsignal, get_config_stopsignal, clr_config_stopsignal, },
/* REMOVE IN LXC 3.0
legacy singal keys
*/
{ "lxc.haltsignal", set_config_signal_halt, get_config_signal_halt, clr_config_signal_halt, },
{ "lxc.rebootsignal", set_config_signal_reboot, get_config_signal_reboot, clr_config_signal_reboot, },
{ "lxc.stopsignal", set_config_signal_stop, get_config_signal_stop, clr_config_signal_stop, },
{ "lxc.signal.halt", set_config_signal_halt, get_config_signal_halt, clr_config_signal_halt, },
{ "lxc.signal.reboot", set_config_signal_reboot, get_config_signal_reboot, clr_config_signal_reboot, },
{ "lxc.signal.stop", set_config_signal_stop, get_config_signal_stop, clr_config_signal_stop, },
{ "lxc.start.auto", set_config_start, get_config_start, clr_config_start, },
{ "lxc.start.delay", set_config_start, get_config_start, clr_config_start, },
{ "lxc.start.order", set_config_start, get_config_start, clr_config_start, },
@ -1446,7 +1454,7 @@ static int sig_parse(const char *signame)
return -1;
}
static int set_config_haltsignal(const char *key, const char *value,
static int set_config_signal_halt(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data)
{
int sig_n;
@ -1467,7 +1475,7 @@ static int set_config_haltsignal(const char *key, const char *value,
return 0;
}
static int set_config_rebootsignal(const char *key, const char *value,
static int set_config_signal_reboot(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data)
{
int sig_n;
@ -1487,7 +1495,7 @@ static int set_config_rebootsignal(const char *key, const char *value,
return 0;
}
static int set_config_stopsignal(const char *key, const char *value,
static int set_config_signal_stop(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data)
{
int sig_n;
@ -3159,19 +3167,19 @@ static int get_config_autodev(const char *key, char *retv, int inlen,
return lxc_get_conf_int(c, retv, inlen, c->autodev);
}
static int get_config_haltsignal(const char *key, char *retv, int inlen,
static int get_config_signal_halt(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
{
return lxc_get_conf_int(c, retv, inlen, c->haltsignal);
}
static int get_config_rebootsignal(const char *key, char *retv, int inlen,
static int get_config_signal_reboot(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
{
return lxc_get_conf_int(c, retv, inlen, c->rebootsignal);
}
static int get_config_stopsignal(const char *key, char *retv, int inlen,
static int get_config_signal_stop(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
{
return lxc_get_conf_int(c, retv, inlen, c->stopsignal);
@ -3523,21 +3531,21 @@ static inline int clr_config_autodev(const char *key, struct lxc_conf *c,
return 0;
}
static inline int clr_config_haltsignal(const char *key, struct lxc_conf *c,
static inline int clr_config_signal_halt(const char *key, struct lxc_conf *c,
void *data)
{
c->haltsignal = 0;
return 0;
}
static inline int clr_config_rebootsignal(const char *key, struct lxc_conf *c,
static inline int clr_config_signal_reboot(const char *key, struct lxc_conf *c,
void *data)
{
c->rebootsignal = 0;
return 0;
}
static inline int clr_config_stopsignal(const char *key, struct lxc_conf *c,
static inline int clr_config_signal_stop(const char *key, struct lxc_conf *c,
void *data)
{
c->stopsignal = 0;

View File

@ -636,27 +636,54 @@ int main(int argc, char *argv[])
goto non_test_error;
}
/* lxc.haltsignal */
/* REMOVE IN LXC 3.0
legacy lxc.haltsignal key
*/
if (set_get_compare_clear_save_load(c, "lxc.haltsignal", "1", tmpf,
true) < 0) {
lxc_error("%s\n", "lxc.haltsignal");
goto non_test_error;
}
/* lxc.rebootsignal */
/* lxc.signal.halt */
if (set_get_compare_clear_save_load(c, "lxc.signal.halt", "1", tmpf,
true) < 0) {
lxc_error("%s\n", "lxc.signal.halt");
goto non_test_error;
}
/* REMOVE IN LXC 3.0
legacy lxc.rebootsignal key
*/
if (set_get_compare_clear_save_load(c, "lxc.rebootsignal", "1", tmpf,
true) < 0) {
lxc_error("%s\n", "lxc.rebootsignal");
goto non_test_error;
}
/* lxc.stopsignal */
/* lxc.signal.reboot */
if (set_get_compare_clear_save_load(c, "lxc.signal.reboot", "1", tmpf,
true) < 0) {
lxc_error("%s\n", "lxc.signal.reboot");
goto non_test_error;
}
/* REMOVE IN LXC 3.0
legacy lxc.stopsignal key
*/
if (set_get_compare_clear_save_load(c, "lxc.stopsignal", "1", tmpf,
true) < 0) {
lxc_error("%s\n", "lxc.stopsignal");
goto non_test_error;
}
/* lxc.signal.stop */
if (set_get_compare_clear_save_load(c, "lxc.signal.stop", "1", tmpf,
true) < 0) {
lxc_error("%s\n", "lxc.signal.stop");
goto non_test_error;
}
/* lxc.start.auto */
if (set_get_compare_clear_save_load(c, "lxc.start.auto", "1", tmpf,
true) < 0) {

View File

@ -341,7 +341,7 @@ copy_configuration()
grep -q "^lxc.rootfs" $path/config 2>/dev/null || echo "lxc.rootfs = $rootfs" >> $path/config
cat <<EOF >> $path/config
lxc.haltsignal = SIGUSR1
lxc.signal.halt = SIGUSR1
lxc.rebootsignal = SIGTERM
lxc.utsname = $name
lxc.tty = 1