Commit 33ddfc2a by Stéphane Graber

Deprecate lxc-checkpoint, lxc-kill and lxc-restart

Checkpoint/restart isn't currently supported, so let's not carry those binaries around until we have proper CRIU support in the API. lxc-kill is redundant with lxc-stop -k and has been known to confuse user. Signed-off-by: 's avatarStéphane Graber <stgraber@ubuntu.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com>
parent adade80c
...@@ -48,7 +48,6 @@ src/lxc/lxc-attach ...@@ -48,7 +48,6 @@ src/lxc/lxc-attach
src/lxc/lxc-autostart src/lxc/lxc-autostart
src/lxc/lxc-cgroup src/lxc/lxc-cgroup
src/lxc/lxc-checkconfig src/lxc/lxc-checkconfig
src/lxc/lxc-checkpoint
src/lxc/lxc-clone src/lxc/lxc-clone
src/lxc/lxc-console src/lxc/lxc-console
src/lxc/lxc-config src/lxc/lxc-config
...@@ -59,12 +58,10 @@ src/lxc/lxc-freeze ...@@ -59,12 +58,10 @@ src/lxc/lxc-freeze
src/lxc/lxc.functions src/lxc/lxc.functions
src/lxc/lxc-info src/lxc/lxc-info
src/lxc/lxc-init src/lxc/lxc-init
src/lxc/lxc-kill
src/lxc/lxc-monitor src/lxc/lxc-monitor
src/lxc/lxc-monitord src/lxc/lxc-monitord
src/lxc/lxc-netstat src/lxc/lxc-netstat
src/lxc/lxc-ps src/lxc/lxc-ps
src/lxc/lxc-restart
src/lxc/lxc-shutdown src/lxc/lxc-shutdown
src/lxc/lxc-snapshot src/lxc/lxc-snapshot
src/lxc/lxc-start src/lxc/lxc-start
......
...@@ -574,7 +574,6 @@ AC_CONFIG_FILES([ ...@@ -574,7 +574,6 @@ AC_CONFIG_FILES([
doc/lxc-autostart.sgml doc/lxc-autostart.sgml
doc/lxc-cgroup.sgml doc/lxc-cgroup.sgml
doc/lxc-checkconfig.sgml doc/lxc-checkconfig.sgml
doc/lxc-checkpoint.sgml
doc/lxc-clone.sgml doc/lxc-clone.sgml
doc/lxc-console.sgml doc/lxc-console.sgml
doc/lxc-create.sgml doc/lxc-create.sgml
...@@ -583,12 +582,10 @@ AC_CONFIG_FILES([ ...@@ -583,12 +582,10 @@ AC_CONFIG_FILES([
doc/lxc-execute.sgml doc/lxc-execute.sgml
doc/lxc-freeze.sgml doc/lxc-freeze.sgml
doc/lxc-info.sgml doc/lxc-info.sgml
doc/lxc-kill.sgml
doc/lxc-ls.sgml doc/lxc-ls.sgml
doc/lxc-monitor.sgml doc/lxc-monitor.sgml
doc/lxc-netstat.sgml doc/lxc-netstat.sgml
doc/lxc-ps.sgml doc/lxc-ps.sgml
doc/lxc-restart.sgml
doc/lxc-snapshot.sgml doc/lxc-snapshot.sgml
doc/lxc-start-ephemeral.sgml doc/lxc-start-ephemeral.sgml
doc/lxc-start.sgml doc/lxc-start.sgml
...@@ -624,7 +621,6 @@ AC_CONFIG_FILES([ ...@@ -624,7 +621,6 @@ AC_CONFIG_FILES([
doc/ja/lxc-autostart.sgml doc/ja/lxc-autostart.sgml
doc/ja/lxc-cgroup.sgml doc/ja/lxc-cgroup.sgml
doc/ja/lxc-checkconfig.sgml doc/ja/lxc-checkconfig.sgml
doc/ja/lxc-checkpoint.sgml
doc/ja/lxc-clone.sgml doc/ja/lxc-clone.sgml
doc/ja/lxc-console.sgml doc/ja/lxc-console.sgml
doc/ja/lxc-create.sgml doc/ja/lxc-create.sgml
...@@ -633,12 +629,10 @@ AC_CONFIG_FILES([ ...@@ -633,12 +629,10 @@ AC_CONFIG_FILES([
doc/ja/lxc-execute.sgml doc/ja/lxc-execute.sgml
doc/ja/lxc-freeze.sgml doc/ja/lxc-freeze.sgml
doc/ja/lxc-info.sgml doc/ja/lxc-info.sgml
doc/ja/lxc-kill.sgml
doc/ja/lxc-ls.sgml doc/ja/lxc-ls.sgml
doc/ja/lxc-monitor.sgml doc/ja/lxc-monitor.sgml
doc/ja/lxc-netstat.sgml doc/ja/lxc-netstat.sgml
doc/ja/lxc-ps.sgml doc/ja/lxc-ps.sgml
doc/ja/lxc-restart.sgml
doc/ja/lxc-snapshot.sgml doc/ja/lxc-snapshot.sgml
doc/ja/lxc-start-ephemeral.sgml doc/ja/lxc-start-ephemeral.sgml
doc/ja/lxc-start.sgml doc/ja/lxc-start.sgml
......
...@@ -19,7 +19,6 @@ man_MANS = \ ...@@ -19,7 +19,6 @@ man_MANS = \
lxc-autostart.1 \ lxc-autostart.1 \
lxc-cgroup.1 \ lxc-cgroup.1 \
lxc-checkconfig.1 \ lxc-checkconfig.1 \
lxc-checkpoint.1 \
lxc-clone.1 \ lxc-clone.1 \
lxc-console.1 \ lxc-console.1 \
lxc-create.1 \ lxc-create.1 \
...@@ -27,11 +26,9 @@ man_MANS = \ ...@@ -27,11 +26,9 @@ man_MANS = \
lxc-execute.1 \ lxc-execute.1 \
lxc-freeze.1 \ lxc-freeze.1 \
lxc-info.1 \ lxc-info.1 \
lxc-kill.1 \
lxc-monitor.1 \ lxc-monitor.1 \
lxc-netstat.1 \ lxc-netstat.1 \
lxc-ps.1 \ lxc-ps.1 \
lxc-restart.1 \
lxc-snapshot.1 \ lxc-snapshot.1 \
lxc-start.1 \ lxc-start.1 \
lxc-stop.1 \ lxc-stop.1 \
......
...@@ -12,7 +12,6 @@ man_MANS = \ ...@@ -12,7 +12,6 @@ man_MANS = \
lxc-autostart.1 \ lxc-autostart.1 \
lxc-cgroup.1 \ lxc-cgroup.1 \
lxc-checkconfig.1 \ lxc-checkconfig.1 \
lxc-checkpoint.1 \
lxc-clone.1 \ lxc-clone.1 \
lxc-console.1 \ lxc-console.1 \
lxc-create.1 \ lxc-create.1 \
...@@ -20,11 +19,9 @@ man_MANS = \ ...@@ -20,11 +19,9 @@ man_MANS = \
lxc-execute.1 \ lxc-execute.1 \
lxc-freeze.1 \ lxc-freeze.1 \
lxc-info.1 \ lxc-info.1 \
lxc-kill.1 \
lxc-monitor.1 \ lxc-monitor.1 \
lxc-netstat.1 \ lxc-netstat.1 \
lxc-ps.1 \ lxc-ps.1 \
lxc-restart.1 \
lxc-snapshot.1 \ lxc-snapshot.1 \
lxc-start.1 \ lxc-start.1 \
lxc-stop.1 \ lxc-stop.1 \
......
<!--
lxc: linux Container library
(C) Copyright IBM Corp. 2007, 2008
Authors:
Daniel Lezcano <daniel.lezcano at free.fr>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Translated into Japanese
by KATOH Yasufumi <karma at jazz.email.ne.jp>
-->
<!DOCTYPE refentry PUBLIC @docdtd@ [
<!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
]>
<refentry>
<docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
<refmeta>
<refentrytitle>lxc-checkpoint</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo>IBM</refmiscinfo>
</refmeta>
<refnamediv>
<refname>lxc-checkpoint</refname>
<refpurpose>
<!--
checkpoint a running container (not implemented yet)
-->
実行中のコンテナのチェックポイントの作成 (未実装)
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>lxc-checkpoint</command>
<arg choice="req">--statefile=<replaceable>FILE</replaceable></arg>
<arg choice="req">--statefd=<replaceable>FD</replaceable></arg>
<arg choice="req">--name=<replaceable>NAME</replaceable></arg>
<arg><option>-k</option>|<option>-p</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title><!-- Description --></title>
<para>
<!--
<command>lxc-checkpoint</command> is a command
to checkpoint the specified container
<replaceable>NAME</replaceable> and dumps its state into the file
<replaceable>FILE</replaceable>. If the
option <option>&#045;&#045;kill</option> is specified, the application
running in the container will terminate after the checkpoint
just before resuming its execution. If the
option <option>&#045;&#045;pause</option> is specified, the application
will be stopped after the checkpoint just before resuming
execution. The command <command>lxc-unfreeze</command> will
resume its execution.
-->
<command>lxc-checkpoint</command> は,<replaceable>NAME</replaceable> 指定したコンテナのチェックポイントを作成し,その状態を <replaceable>FILE</replaceable> で指定したファイルにダンプします.
<option>--kill</option> が指定された場合,チェックポイントの取得後,コンテナ内で実行されているアプリケーションは,実行が再開する直前に終了します.
<option>--pause</option> が指定された場合,チェックポイントの取得後,コンテナ内で実行されているアプリケーションは,実行が再開する直前に休止します.
<command>lxc-unfreeze</command> コマンドで,実行を再開させます.
</para>
</refsect1>
<refsect1>
<title><!-- Checkpoint Options -->チェックポイントのオプション</title>
<variablelist>
<varlistentry>
<term><option>-S, --statefile=<replaceable>FILE</replaceable></option></term>
<listitem>
<para>
<!--
write the state of the container in this
<replaceable>FILE</replaceable>.
This option is exclusive with <option>&#045;&#045;statefd</option> below.
-->
コンテナの実行状態を <replaceable>FILE</replaceable> に書き込みます.
このオプションは以下の <option>--statefd</option> と同時に指定できません.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-d, --statefd=<replaceable>FD</replaceable></option></term>
<listitem>
<para>
<!--
write the state of the container in this
<replaceable>FD</replaceable> file descriptor.
This option is exclusive with above <option>&#045;&#045;statefile</option>.
-->
コンテナの実行状態を指定した <replaceable>FD</replaceable> ファイルディスクリプタに書き込みます.
このオプションは前述の <option>--statefile</option> と同時に指定出来ません.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-k,--kill</option></term>
<listitem>
<para>
<!--
Kill container processes after checkpoint. the processes are sent
a <literal>SIGKILL</literal> signal.
-->
チェックポイントを取得した後,コンテナプロセスを kill します.
プロセスには <literal>SIGKILL</literal> シグナルが送られます.
</para>
<para>
<!--
This option is mutually exclusive with the following
<option>&#045;&#045;pause</option> option.
-->
このオプションは以下の <option>--pause</option> オプションと同時に指定することはできません.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-p,--pause</option></term>
<listitem>
<para>
<!--
Pause container processes after checkpoint. The container
will be stopped until you resume it. This option is
mutually exclusive with previously mentionned
<option>&#045;&#045;kill</option> option.
-->
チェックポイントを取得した後,コンテナプロセスを休止させます.
コンテナを再開させるまで止まったままとなります.
このオプションは前述の <option>--kill</option> オプションと同時に指定することはできません.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
&commonoptions;
<refsect1>
<title><!-- Examples -->例</title>
<para>
<!--
To start a new container <literal>123</literal> computing decimals of pi
-->
円周率の小数点以下を計算する新しいコンテナ <literal>123</literal> を起動させるために,以下を実行します.
</para>
<programlisting>
lxc-execute -n 123 -- pi1 -d 500000
lxc-execute --name=123 -- pi1 -d 500000
</programlisting>
<para>
<!--
to checkpoint the same container in <emphasis>dump-death</emphasis>
mode
-->
<emphasis>ダンプ後終了する</emphasis>モードで,そのコンテナのチェックポイントを取得します.
</para>
<programlisting>
lxc-checkpoint -n 123 -S /share/123/chkpt1 -k
lxc-checkpoint --name=123 -S /share/123/chkpt1 -k
</programlisting>
<para>
<!--
to checkpoint the same container and <emphasis>pause</emphasis> it
-->
同じコンテナのチェックポイントを取得し,<emphasis>休止</emphasis>させます.
</para>
<programlisting>
lxc-checkpoint -n 123 -S /share/123/chkpt1 -p
lxc-checkpoint --name=123 -S /share/123/chkpt1 -p
</programlisting>
</refsect1>
<refsect1>
<title><!-- Notes -->注意</title>
<!--
<para>Actually, this command does not operate. Its description
helps to define a CLI api for future Checkpoint / Restart
solution</para>
-->
実際はこのコマンドは動作しません.
この説明は将来的なチェックポイント/再起動機能の解決策となる CLI API を定義するのを助けるためのものです.
</refsect1>
&seealso;
<refsect1>
<title><!-- Author -->作者</title>
<para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
<!--
lxc: linux Container library
(C) Copyright IBM Corp. 2007, 2008
Authors:
Daniel Lezcano <daniel.lezcano at free.fr>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Translated into Japanese
by KATOH Yasufumi <karma at jazz.email.ne.jp>
-->
<!DOCTYPE refentry PUBLIC @docdtd@ [
<!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
]>
<refentry>
<docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
<refmeta>
<refentrytitle>lxc-kill</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo>IBM</refmiscinfo>
</refmeta>
<refnamediv>
<refname>lxc-kill</refname>
<refpurpose>
<!--
Send a signal to the process 1 of the container.
-->
コンテナの最初のプロセスへのシグナルの送出
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>lxc-kill</command>
<arg choice="req">--name=<replaceable>NAME</replaceable></arg>
<arg choice="req"><replaceable>SIGNUM</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<!--
<command>lxc-kill</command> send
the <replaceable>SIGNUM</replaceable> signal to the first process of the container.
-->
<command>lxc-kill</command> は,<replaceable>SIGNUM</replaceable> で指定されたシグナルをコンテナの最初のプロセスに送ります.
</para>
<para>
<!--
The <replaceable>SIGNUM</replaceable> is a numeric value,
the signal name is not supported.
-->
<replaceable>SIGNUM</replaceable> は数値で,シグナル名はサポートしていません.
</para>
<para>
<!--
If this command is used on an application container ran by
lxc-execute, the lxc-init will receive the signal and will forward it to
the process 2 which is the command specified in the command line. See
lxc-execute (1).
Obviously the SIGKILL and SIGSTOP signals are not able to be forwarded,
(as per the signal(7) man page).
-->
このコマンドが lxc-execute で起動したアプリケーションコンテナに対して使われた場合,lxc-init がシグナルを受け取り,(lxc-execute の) コマンドラインで指定されたコマンドである 2 番目のプロセスにそれを転送します.
</para>
</refsect1>
&commonoptions;
<refsect1>
<title><!-- Examples -->例</title>
<para>
<!--
To send the signal 26 to the process pi1 running in container
<literal>123</literal> :
-->
コンテナ名 <literal>123</literal> で実行されているプロセス pi1 に対して 26 のシグナルを送るためには:
</para>
<programlisting>
lxc-execute -n 123 -- pi1 -d 500000
lxc-kill --name=123 26
</programlisting>
</refsect1>
&seealso;
<refsect1>
<title><!-- Author -->作者</title>
<para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
<!--
lxc: linux Container library
(C) Copyright IBM Corp. 2007, 2008
Authors:
Daniel Lezcano <daniel.lezcano at free.fr>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Translated into Japanese
by KATOH Yasufumi <karma at jazz.email.ne.jp>
-->
<!DOCTYPE refentry PUBLIC @docdtd@ [
<!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
]>
<refentry>
<docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
<refmeta>
<refentrytitle>lxc-restart</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo>IBM</refmiscinfo>
</refmeta>
<refnamediv>
<refname>lxc-restart</refname>
<refpurpose>
<!--
restart a container from a file (not implemented yet)
-->
ファイルからのコンテナの再起動 (未実装)
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>lxc-restart</command>
<arg choice="opt">-f <replaceable>config_file</replaceable></arg>
<arg choice="opt">-s KEY=VAL</arg>
<arg choice="req">--statefile=<replaceable>FILE</replaceable></arg>
<arg choice="req">--statefd=<replaceable>FD</replaceable></arg>
<arg choice="req">--name=<replaceable>NAME</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title><!-- Description -->説明</title>
<para>
<!--
<command>lxc-restart</command> is a command
to restart an application from the state read in the specified
<replaceable>FILE</replaceable>, in a container with the
identifier <replaceable>NAME</replaceable>.
If the option <option>&#045;&#045;pause</option>
is specified, the application will be stopped after the
restart just before resuming execution. The command
<command>lxc-unfreeze</command> will be needed to resume its
execution.
-->
<command>lxc-restart</command> は <replaceable>FILE</replaceable> で指定したファイルから状態を読み取り,<replaceable>NAME</replaceable> で指定したコンテナ内のアプリケーションを再起動するコマンドです.
もし <option>--pause</option> が指定された場合,アプリケーションは再起動後に直前の実行状態で再開する前に停止します.
この実行状態の再開には <command>lxc-unfreeze</command> コマンドが必要になります.
</para>
</refsect1>
<refsect1>
<title><!-- Restart Options -->再起動オプション</title>
<variablelist>
<varlistentry>
<term><option>-S, --statefile=<replaceable>FILE</replaceable></option></term>
<listitem>
<para>
<!--
read the state of the container in this
<replaceable>FILE</replaceable>.
This option is exclusive with <option>&#045;&#045;statefd</option> below.
-->
コンテナの状態を <replaceable>FILE</replaceable> で指定したファイルから読み取ります.
このオプションは,後の <option>--statefd</option> と同時に指定できません.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-d, --statefd=<replaceable>FD</replaceable></option></term>
<listitem>
<para>
<!--
read the state of the container in this
<replaceable>FD</replaceable> file descriptor.
This option is exclusive with above <option>&#045;&#045;statefile</option>.
-->
コンテナの状態を <replaceable>FD</replaceable> で指定したファイル記述子から読み取ります.
このオプションは,前の <option>--statefile</option> と同時に指定できません.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-p</option></term>
<listitem>
<para>
<!--
Pause container processes after restart. The container will be
stopped until you resume it with the lxc-unfreeze command.
-->
再起動後にコンテナプロセスを一時停止します.
コンテナは lxc-unfreeze コマンドで再開するまでは停止しています.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-f, --rcfile=<replaceable>config_file</replaceable></option></term>
<listitem>
<para>
<!--
Specify the configuration file to configure the
virtualization and isolation functionalities for the
container. This parameter should be specified if it was
specified for the <command>lxc-execute</command>
or <command>lxc-start</command> commands or if the
container configuration has to be changed at restart. The
latter may fail if the needed resources are not available
for the restart. If the container was created and
configured with <command>lxc-create</command>, this option
is not needed, the configuration will be automatically
found.
-->
コンテナの仮想化および隔離機能を設定した設定ファイルを指定します.このパラメータは,<command>lxc-execute</command> コマンドや <command>lxc-start</command> コマンドで (起動時に) 指定されていた場合や,再起動後に設定を変更する場合に指定すべきです.後者の場合,再起動に必要なリソースが利用できない場合は失敗するでしょう.コンテナが <command>lxc-create</command> コマンドで作成され,設定されていた場合,このオプションは必要ありません.設定は自動的に見つけられるでしょう.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-s <replaceable>KEY=VAL</replaceable></option>
</term>
<listitem>
<para>
<!--
Assign value <replaceable>VAL</replaceable> to configuration
variable <replaceable>KEY</replaceable>. This overrides any
assignment done in <replaceable>config_file</replaceable>.
-->
設定変数 <replaceable>KEY</replaceable> の値を <replaceable>VAL</replaceable> に設定します.この設定は <replaceable>config_file</replaceable> で設定された値を上書きします.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
&commonoptions;
<refsect1>
<title><!-- Examples -->例</title>
<para>
<!--
To start a new container <literal>123</literal> computing decimals of pi
-->
円周率の小数点以下を計算する新しいコンテナ <literal>123</literal> を開始するために,
</para>
<programlisting>
lxc-execute -n 123 -- pi1 -d 500000
lxc-execute --name=123 -- pi1 -d 500000
</programlisting>
<para>
<!--
to checkpoint the same container in <emphasis>dump-death</emphasis>
mode
-->
<emphasis>dump-death</emphasis> モードで同じコンテナのチェックポイントを作成するために,
</para>
<programlisting>
lxc-checkpoint -n 123 -S /share/123/chkpt1 -k
lxc-checkpoint --name=123 --statefile=/share/123/chkpt1 -k
</programlisting>
<para>
<!--
and to restart the same container with a different id
-->
そして,異なる id で同じコンテナを再起動するために,
</para>
<programlisting>
lxc-restart -n 200 -S /share/123/chkpt1
lxc-restart --name=200 --statefile=/share/123/chkpt1
</programlisting>
</refsect1>
<refsect1>
<title><!-- Notes -->注意</title>
<para>
<!--
Actually, this command does not operate. Its description
helps to define a CLI api for future Checkpoint / Restart
solution
-->
実際はこのコマンドは動作しません.この説明は将来的なチェックポイント/再起動の解決策となる CLI API を定義するのを助けるためのものです.
</para>
</refsect1>
&seealso;
<refsect1>
<title><!-- Author -->作者</title>
<para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
...@@ -61,11 +61,6 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp> ...@@ -61,11 +61,6 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
</citerefentry>, </citerefentry>,
<citerefentry> <citerefentry>
<refentrytitle><command>lxc-kill</command></refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle><command>lxc-console</command></refentrytitle> <refentrytitle><command>lxc-console</command></refentrytitle>
<manvolnum>1</manvolnum> <manvolnum>1</manvolnum>
</citerefentry>, </citerefentry>,
......
<!--
lxc: linux Container library
(C) Copyright IBM Corp. 2007, 2008
Authors:
Daniel Lezcano <daniel.lezcano at free.fr>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-->
<!DOCTYPE refentry PUBLIC @docdtd@ [
<!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
]>
<refentry>
<docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
<refmeta>
<refentrytitle>lxc-checkpoint</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo>IBM</refmiscinfo>
</refmeta>
<refnamediv>
<refname>lxc-checkpoint</refname>
<refpurpose>
checkpoint a running container (not implemented yet)
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>lxc-checkpoint</command>
<arg choice="req">--statefile=<replaceable>FILE</replaceable></arg>
<arg choice="req">--statefd=<replaceable>FD</replaceable></arg>
<arg choice="req">--name=<replaceable>NAME</replaceable></arg>
<arg><option>-k</option>|<option>-p</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>lxc-checkpoint</command> is a command
to checkpoint the specified container
<replaceable>NAME</replaceable> and dumps its state into the file
<replaceable>FILE</replaceable>. If the
option <option>--kill</option> is specified, the application
running in the container will terminate after the checkpoint
just before resuming its execution. If the
option <option>--pause</option> is specified, the application
will be stopped after the checkpoint just before resuming
execution. The command <command>lxc-unfreeze</command> will
resume its execution.
</para>
</refsect1>
<refsect1>
<title>Checkpoint Options</title>
<variablelist>
<varlistentry>
<term><option>-S, --statefile=<replaceable>FILE</replaceable></option></term>
<listitem>
<para>
write the state of the container in this
<replaceable>FILE</replaceable>.
This option is exclusive with <option>--statefd</option> below.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-d, --statefd=<replaceable>FD</replaceable></option></term>
<listitem>
<para>
write the state of the container in this
<replaceable>FD</replaceable> file descriptor.
This option is exclusive with above <option>--statefile</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-k,--kill</option></term>
<listitem>
<para>
Kill container processes after checkpoint. the processes are sent
a <literal>SIGKILL</literal> signal.
</para>
<para>
This option is mutually exclusive with the following
<option>--pause</option> option.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-p,--pause</option></term>
<listitem>
<para>
Pause container processes after checkpoint. The container
will be stopped until you resume it. This option is
mutually exclusive with previously mentionned
<option>--kill</option> option.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
&commonoptions;
<refsect1>
<title>Examples</title>
<para>
To start a new container <literal>123</literal> computing decimals of pi
</para>
<programlisting>
lxc-execute -n 123 -- pi1 -d 500000
lxc-execute --name=123 -- pi1 -d 500000
</programlisting>
<para>
to checkpoint the same container in <emphasis>dump-death</emphasis>
mode
</para>
<programlisting>
lxc-checkpoint -n 123 -S /share/123/chkpt1 -k
lxc-checkpoint --name=123 -S /share/123/chkpt1 -k
</programlisting>
<para>
to checkpoint the same container and <emphasis>pause</emphasis> it
</para>
<programlisting>
lxc-checkpoint -n 123 -S /share/123/chkpt1 -p
lxc-checkpoint --name=123 -S /share/123/chkpt1 -p
</programlisting>
</refsect1>
<refsect1>
<title>Notes</title>
<para>Actually, this command does not operate. Its description
helps to define a CLI api for future Checkpoint / Restart
solution</para>
</refsect1>
&seealso;
<refsect1>
<title>Author</title>
<para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
...@@ -89,8 +89,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ...@@ -89,8 +89,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
<para> <para>
The above <command>lxc-init</command> is designed to forward received The above <command>lxc-init</command> is designed to forward received
signals to the started command. signals to the started command.
So <command>lxc-kill</command> (1) sent signal is received
by the user specified command (pid 2 in the container).
</para> </para>
</refsect1> </refsect1>
......
<!--
lxc: linux Container library
(C) Copyright IBM Corp. 2007, 2008
Authors:
Daniel Lezcano <daniel.lezcano at free.fr>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-->
<!DOCTYPE refentry PUBLIC @docdtd@ [
<!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
]>
<refentry>
<docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
<refmeta>
<refentrytitle>lxc-kill</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo>IBM</refmiscinfo>
</refmeta>
<refnamediv>
<refname>lxc-kill</refname>
<refpurpose>
Send a signal to the process 1 of the container.
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>lxc-kill</command>
<arg choice="req">--name=<replaceable>NAME</replaceable></arg>
<arg choice="req"><replaceable>SIGNUM</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>lxc-kill</command> send
the <replaceable>SIGNUM</replaceable> signal to the first process of the container.
</para>
<para>
The <replaceable>SIGNUM</replaceable> is a numeric value,
the signal name is not supported.
</para>
<para>
If this command is used on an application container ran by
lxc-execute, the lxc-init will receive the signal and will forward it to
the process 2 which is the command specified in the command line. See
lxc-execute (1).
Obviously the SIGKILL and SIGSTOP signals are not able to be forwarded,
(as per the signal(7) man page).
</para>
</refsect1>
&commonoptions;
<refsect1>
<title>Examples</title>
<para>
To send the signal 26 to the process pi1 running in container
<literal>123</literal> :
</para>
<programlisting>
lxc-execute -n 123 -- pi1 -d 500000
lxc-kill --name=123 26
</programlisting>
</refsect1>
&seealso;
<refsect1>
<title>Author</title>
<para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
<!--
lxc: linux Container library
(C) Copyright IBM Corp. 2007, 2008
Authors:
Daniel Lezcano <daniel.lezcano at free.fr>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-->
<!DOCTYPE refentry PUBLIC @docdtd@ [
<!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
]>
<refentry>
<docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
<refmeta>
<refentrytitle>lxc-restart</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo>IBM</refmiscinfo>
</refmeta>
<refnamediv>
<refname>lxc-restart</refname>
<refpurpose>
restart a container from a file (not implemented yet)
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>lxc-restart</command>
<arg choice="opt">-f <replaceable>config_file</replaceable></arg>
<arg choice="opt">-s KEY=VAL</arg>
<arg choice="req">--statefile=<replaceable>FILE</replaceable></arg>
<arg choice="req">--statefd=<replaceable>FD</replaceable></arg>
<arg choice="req">--name=<replaceable>NAME</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>lxc-restart</command> is a command
to restart an application from the state read in the specified
<replaceable>FILE</replaceable>, in a container with the
identifier <replaceable>NAME</replaceable>.
If the option <option>--pause</option>
is specified, the application will be stopped after the
restart just before resuming execution. The command
<command>lxc-unfreeze</command> will be needed to resume its
execution.
</para>
</refsect1>
<refsect1>
<title>Restart Options</title>
<variablelist>
<varlistentry>
<term><option>-S, --statefile=<replaceable>FILE</replaceable></option></term>
<listitem>
<para>
read the state of the container in this
<replaceable>FILE</replaceable>.
This option is exclusive with <option>--statefd</option> below.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-d, --statefd=<replaceable>FD</replaceable></option></term>
<listitem>
<para>
read the state of the container in this
<replaceable>FD</replaceable> file descriptor.
This option is exclusive with above <option>--statefile</option>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-p</option></term>
<listitem>
<para>
Pause container processes after restart. The container will be
stopped until you resume it with the lxc-unfreeze command.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-f, --rcfile=<replaceable>config_file</replaceable></option></term>
<listitem>
<para>
Specify the configuration file to configure the
virtualization and isolation functionalities for the
container. This parameter should be specified if it was
specified for the <command>lxc-execute</command>
or <command>lxc-start</command> commands or if the
container configuration has to be changed at restart. The
latter may fail if the needed resources are not available
for the restart. If the container was created and
configured with <command>lxc-create</command>, this option
is not needed, the configuration will be automatically
found.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-s <replaceable>KEY=VAL</replaceable></option>
</term>
<listitem>
<para>
Assign value <replaceable>VAL</replaceable> to configuration
variable <replaceable>KEY</replaceable>. This overrides any
assignment done in <replaceable>config_file</replaceable>.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
&commonoptions;
<refsect1>
<title>Examples</title>
<para>
To start a new container <literal>123</literal> computing decimals of pi
</para>
<programlisting>
lxc-execute -n 123 -- pi1 -d 500000
lxc-execute --name=123 -- pi1 -d 500000
</programlisting>
<para>
to checkpoint the same container in <emphasis>dump-death</emphasis>
mode
</para>
<programlisting>
lxc-checkpoint -n 123 -S /share/123/chkpt1 -k
lxc-checkpoint --name=123 --statefile=/share/123/chkpt1 -k
</programlisting>
<para>
and to restart the same container with a different id
</para>
<programlisting>
lxc-restart -n 200 -S /share/123/chkpt1
lxc-restart --name=200 --statefile=/share/123/chkpt1
</programlisting>
</refsect1>
<refsect1>
<title>Notes</title>
<para>Actually, this command does not operate. Its description
helps to define a CLI api for future Checkpoint / Restart
solution</para>
</refsect1>
&seealso;
<refsect1>
<title>Author</title>
<para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
...@@ -58,11 +58,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ...@@ -58,11 +58,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
</citerefentry>, </citerefentry>,
<citerefentry> <citerefentry>
<refentrytitle><command>lxc-kill</command></refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle><command>lxc-console</command></refentrytitle> <refentrytitle><command>lxc-console</command></refentrytitle>
<manvolnum>1</manvolnum> <manvolnum>1</manvolnum>
</citerefentry>, </citerefentry>,
......
...@@ -60,8 +60,6 @@ liblxc_so_SOURCES = \ ...@@ -60,8 +60,6 @@ liblxc_so_SOURCES = \
monitor.c monitor.h \ monitor.c monitor.h \
console.c \ console.c \
freezer.c \ freezer.c \
checkpoint.c \
restart.c \
error.h error.c \ error.h error.c \
parse.c parse.h \ parse.c parse.h \
cgroup.c cgroup.h \ cgroup.c cgroup.h \
...@@ -196,9 +194,6 @@ bin_PROGRAMS = \ ...@@ -196,9 +194,6 @@ bin_PROGRAMS = \
lxc-info \ lxc-info \
lxc-cgroup \ lxc-cgroup \
lxc-unfreeze \ lxc-unfreeze \
lxc-checkpoint \
lxc-restart \
lxc-kill \
lxc-config \ lxc-config \
lxc-destroy \ lxc-destroy \
lxc-create \ lxc-create \
...@@ -223,7 +218,6 @@ lxc_cgroup_SOURCES += cgmanager.c ...@@ -223,7 +218,6 @@ lxc_cgroup_SOURCES += cgmanager.c
lxc_cgroup_LDADD = $(CGMANAGER_LIBS) $(DBUS_LIBS) $(NIH_LIBS) $(NIH_DBUS_LIBS) $(LDADD) lxc_cgroup_LDADD = $(CGMANAGER_LIBS) $(DBUS_LIBS) $(NIH_LIBS) $(NIH_DBUS_LIBS) $(LDADD)
lxc_cgroup_CFLAGS = $(CGMANAGER_CFLAGS) $(DBUS_CFLAGS) $(NIH_CFLAGS) $(NIH_DBUS_CFLAGS) lxc_cgroup_CFLAGS = $(CGMANAGER_CFLAGS) $(DBUS_CFLAGS) $(NIH_CFLAGS) $(NIH_DBUS_CFLAGS)
#endif #endif
lxc_checkpoint_SOURCES = lxc_checkpoint.c
lxc_config_SOURCES = lxc_config.c lxc_config_SOURCES = lxc_config.c
lxc_console_SOURCES = lxc_console.c lxc_console_SOURCES = lxc_console.c
lxc_destroy_SOURCES = lxc_destroy.c lxc_destroy_SOURCES = lxc_destroy.c
...@@ -233,14 +227,12 @@ lxc_info_SOURCES = lxc_info.c ...@@ -233,14 +227,12 @@ lxc_info_SOURCES = lxc_info.c
lxc_init_SOURCES = lxc_init.c lxc_init_SOURCES = lxc_init.c
lxc_monitor_SOURCES = lxc_monitor.c lxc_monitor_SOURCES = lxc_monitor.c
lxc_monitord_SOURCES = lxc_monitord.c lxc_monitord_SOURCES = lxc_monitord.c
lxc_restart_SOURCES = lxc_restart.c
lxc_clone_SOURCES = lxc_clone.c lxc_clone_SOURCES = lxc_clone.c
lxc_start_SOURCES = lxc_start.c lxc_start_SOURCES = lxc_start.c
lxc_stop_SOURCES = lxc_stop.c lxc_stop_SOURCES = lxc_stop.c
lxc_unfreeze_SOURCES = lxc_unfreeze.c lxc_unfreeze_SOURCES = lxc_unfreeze.c
lxc_unshare_SOURCES = lxc_unshare.c lxc_unshare_SOURCES = lxc_unshare.c
lxc_wait_SOURCES = lxc_wait.c lxc_wait_SOURCES = lxc_wait.c
lxc_kill_SOURCES = lxc_kill.c
lxc_create_SOURCES = lxc_create.c lxc_create_SOURCES = lxc_create.c
lxc_snapshot_SOURCES = lxc_snapshot.c lxc_snapshot_SOURCES = lxc_snapshot.c
lxc_usernsexec_SOURCES = lxc_usernsexec.c lxc_usernsexec_SOURCES = lxc_usernsexec.c
......
...@@ -57,11 +57,6 @@ struct lxc_arguments { ...@@ -57,11 +57,6 @@ struct lxc_arguments {
/* for lxc-start */ /* for lxc-start */
const char *share_ns[32]; // size must be greater than LXC_NS_MAX const char *share_ns[32]; // size must be greater than LXC_NS_MAX
/* for lxc-checkpoint/restart */
const char *statefile;
int statefd;
int flags;
/* for lxc-console */ /* for lxc-console */
int ttynum; int ttynum;
char escape; char escape;
......
/*
* lxc: linux Container library
*
* (C) Copyright IBM Corp. 2007, 2008
*
* Authors:
* Daniel Lezcano <daniel.lezcano at free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "lxc.h"
#include "log.h"
lxc_log_define(lxc_checkpoint, lxc);
int lxc_checkpoint(const char *name, int sfd, int flags)
{
ERROR("'checkpoint' function not implemented");
return -1;
}
...@@ -172,28 +172,6 @@ extern int lxc_cgroup_get(const char *filename, char *value, size_t len, const c ...@@ -172,28 +172,6 @@ extern int lxc_cgroup_get(const char *filename, char *value, size_t len, const c
extern const char *lxc_strerror(int error); extern const char *lxc_strerror(int error);
/* /*
* Checkpoint a container
* @name : the name of the container being checkpointed
* @sfd: fd on which the container is checkpointed
* @flags : checkpoint flags (an ORed value)
* Returns 0 on success, < 0 otherwise
*/
extern int lxc_checkpoint(const char *name, int sfd, int flags);
#define LXC_FLAG_PAUSE 1
#define LXC_FLAG_HALT 2
/*
* Restart a container
* @name : the name of the container being restarted
* @sfd: fd from which the container is restarted
* @conf: lxc_conf structure.
* @flags : restart flags (an ORed value)
* @lxcpath: container path
* Returns 0 on success, < 0 otherwise
*/
extern int lxc_restart(const char *, int, struct lxc_conf *, int, const char *);
/*
* Create and return a new lxccontainer struct. * Create and return a new lxccontainer struct.
*/ */
extern struct lxc_container *lxc_container_new(const char *name, const char *configpath); extern struct lxc_container *lxc_container_new(const char *name, const char *configpath);
......
/*
* lxc: linux Container library
*
* (C) Copyright IBM Corp. 2007, 2010
*
* Authors:
* Daniel Lezcano <daniel.lezcano at free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _GNU_SOURCE
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include "lxc.h"
#include "log.h"
#include "utils.h"
#include "arguments.h"
#include "config.h"
#include "caps.h"
lxc_log_define(lxc_checkpoint_ui, lxc_checkpoint);
static int my_checker(const struct lxc_arguments* args)
{
if ((!args->statefile) && (args->statefd == -1)) {
lxc_error(args, "no statefile specified");
return -1;
}
if ((args->statefile) && (args->statefd != -1)) {
lxc_error(args, "--statefile AND --statefd abnormally set");
return -1;
}
return 0;
}
static int my_parser(struct lxc_arguments* args, int c, char* arg)
{
switch (c) {
case 'k': args->flags = LXC_FLAG_HALT; break;
case 'p': args->flags = LXC_FLAG_PAUSE; break;
case 'S': args->statefile = arg; break;
case 'd': {
int fd;
fd = lxc_arguments_str_to_int(args, arg);
if (fd < 0)
return -1;
args->statefd = fd;
break;
}
}
return 0;
}
static const struct option my_longopts[] = {
{"kill", no_argument, 0, 'k'},
{"pause", no_argument, 0, 'p'},
{"statefile", required_argument, 0, 'S'},
{"statefd", required_argument, 0, 'd'},
LXC_COMMON_OPTIONS
};
static struct lxc_arguments my_args = {
.progname = "lxc-checkpoint",
.help = "\
--name=NAME --statefile FILE\n\
\n\
lxc-checkpoint checkpoints in FILE the NAME container\n\
\n\
Options :\n\
-n, --name=NAME NAME for name of the container\n\
-k, --kill stop the container after checkpoint\n\
-p, --pause don't unfreeze the container after the checkpoint\n\
-S, --statefile=FILE write the container state into this file, or\n\
-d, --statefd=FD write the container state into this file descriptor\n",
.options = my_longopts,
.parser = my_parser,
.checker = my_checker,
.statefd = -1,
};
int main(int argc, char *argv[])
{
int ret;
int sfd = -1;
if (lxc_caps_init())
return -1;
ret = lxc_arguments_parse(&my_args, argc, argv);
if (ret)
return ret;
if (!my_args.log_file)
my_args.log_file = "none";
ret = lxc_log_init(my_args.name, my_args.log_file, my_args.log_priority,
my_args.progname, my_args.quiet, my_args.lxcpath[0]);
if (ret)
return ret;
if (my_args.statefd != -1)
sfd = my_args.statefd;
#define OPEN_WRITE_MODE O_CREAT | O_RDWR | O_EXCL | O_CLOEXEC | O_LARGEFILE
if (my_args.statefile) {
sfd = open(my_args.statefile, OPEN_WRITE_MODE, 0600);
if (sfd < 0) {
ERROR("'%s' open failure : %m", my_args.statefile);
return sfd;
}
}
ret = lxc_checkpoint(my_args.name, sfd, my_args.flags);
assert(ret == 0 || ret == -1);
if (ret)
ERROR("failed to checkpoint '%s'", my_args.name);
else
INFO("'%s' checkpointed", my_args.name);
if (my_args.statefile)
close(sfd);
return ret;
}
/*
* lxc: linux Container library
*
* (C) Copyright IBM Corp. 2007, 2010
*
* Authors:
* Daniel Lezcano <daniel.lezcano at free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <unistd.h>
#include <errno.h>
#include <sys/param.h>
#include <stdlib.h>
#include <signal.h>
#include "commands.h"
#include "arguments.h"
#include "namespace.h"
#include "log.h"
lxc_log_define(lxc_kill_ui, lxc);
static const struct option my_longopts[] = {
LXC_COMMON_OPTIONS
};
static struct lxc_arguments my_args = {
.progname = "lxc-kill",
.help = "\
--name=NAME SIGNUM\n\
\n\
Sends signal number SIGNUM to the first user process in container NAME\n\
\n\
Options :\n\
-n, --name=NAME NAME for name of the container\n",
.options = my_longopts,
.parser = NULL,
.checker = NULL,
};
int main(int argc, char *argv[], char *envp[])
{
int ret;
pid_t pid;
int sig;
ret = lxc_arguments_parse(&my_args, argc, argv);
if (ret)
return ret;
if (!my_args.log_file)
my_args.log_file = "none";
ret = lxc_log_init(my_args.name, my_args.log_file, my_args.log_priority,
my_args.progname, my_args.quiet, my_args.lxcpath[0]);
if (ret)
return ret;
if (my_args.argc) {
sig = atoi(my_args.argv[0]);
if (!sig || sig >= NSIG) {
ERROR("'%s' isn't a valid signal number",
my_args.argv[0]);
return -1;
}
} else
sig=SIGKILL;
pid = lxc_cmd_get_init_pid(my_args.name, my_args.lxcpath[0]);
if (pid < 0) {
ERROR("failed to get the init pid");
return -1;
}
ret = kill(pid, sig);
if (ret < 0) {
ERROR("failed to kill the init pid");
return -1;
}
return 0;
}
/*
* lxc: linux Container library
*
* (C) Copyright IBM Corp. 2007, 2010
*
* Authors:
* Daniel Lezcano <daniel.lezcano at free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _GNU_SOURCE
#include <stdio.h>
#undef _GNU_SOURCE
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <fcntl.h>
#include "log.h"
#include "lxc.h"
#include "caps.h"
#include "conf.h"
#include "config.h"
#include "confile.h"
#include "arguments.h"
#include "utils.h"
lxc_log_define(lxc_restart_ui, lxc_restart);
static struct lxc_list defines;
static int my_checker(const struct lxc_arguments* args)
{
if ((!args->statefile) && (args->statefd == -1)) {
lxc_error(args, "no statefile specified");
return -1;
}
if ((args->statefile) && (args->statefd != -1)) {
lxc_error(args, "--statefile AND --statefd abnormally set");
return -1;
}
return 0;
}
static int my_parser(struct lxc_arguments* args, int c, char* arg)
{
switch (c) {
case 'S': args->statefile = arg; break;
case 'f': args->rcfile = arg; break;
case 'p': args->flags = LXC_FLAG_PAUSE; break;
case 's': return lxc_config_define_add(&defines, arg);
case 'd': {
int fd;
fd = lxc_arguments_str_to_int(args, arg);
if (fd < 0)
return -1;
args->statefd = fd;
break;
}
}
return 0;
}
static const struct option my_longopts[] = {
{"statefile", required_argument, 0, 'S'},
{"statefd", required_argument, 0, 'd'},
{"rcfile", required_argument, 0, 'f'},
{"pause", no_argument, 0, 'p'},
{"define", required_argument, 0, 's'},
LXC_COMMON_OPTIONS
};
static struct lxc_arguments my_args = {
.progname = "lxc-restart",
.help = "\
--name=NAME --statefile FILE\n\
\n\
lxc-restart restarts from FILE the NAME container\n\
\n\
Options :\n\
-n, --name=NAME NAME for name of the container\n\
-p, --pause do not unfreeze the container after the restart\n\
-S, --statefile=FILE read the container state from this file, or\n\
-d, --statefd=FD read the container state from this file descriptor\n\
-f, --rcfile=FILE Load configuration file FILE\n\
-s, --define KEY=VAL Assign VAL to configuration variable KEY\n",
.options = my_longopts,
.parser = my_parser,
.checker = my_checker,
.statefd = -1,
};
int main(int argc, char *argv[])
{
int sfd = -1;
int ret;
char *rcfile = NULL;
struct lxc_conf *conf;
lxc_list_init(&defines);
if (lxc_caps_init())
return -1;
if (lxc_arguments_parse(&my_args, argc, argv))
return -1;
if (lxc_log_init(my_args.name, my_args.log_file, my_args.log_priority,
my_args.progname, my_args.quiet, my_args.lxcpath[0]))
return -1;
/* rcfile is specified in the cli option */
if (my_args.rcfile)
rcfile = (char *)my_args.rcfile;
else {
int rc;
rc = asprintf(&rcfile, "%s/%s/config", my_args.lxcpath[0], my_args.name);
if (rc == -1) {
SYSERROR("failed to allocate memory");
return -1;
}
/* container configuration does not exist */
if (access(rcfile, F_OK)) {
free(rcfile);
rcfile = NULL;
}
}
conf = lxc_conf_init();
if (!conf) {
ERROR("failed to initialize configuration");
return -1;
}
if (rcfile && lxc_config_read(rcfile, conf)) {
ERROR("failed to read configuration file");
return -1;
}
if (lxc_config_define_load(&defines, conf))
return -1;
if (my_args.statefd != -1)
sfd = my_args.statefd;
#define OPEN_READ_MODE O_RDONLY | O_CLOEXEC | O_LARGEFILE
if (my_args.statefile) {
sfd = open(my_args.statefile, OPEN_READ_MODE, 0);
if (sfd < 0) {
ERROR("'%s' open failure : %m", my_args.statefile);
return sfd;
}
}
ret = lxc_restart(my_args.name, sfd, conf, my_args.flags, my_args.lxcpath[0]);
if (my_args.statefile)
close(sfd);
return ret;
}
/*
* lxc: linux Container library
*
* (C) Copyright IBM Corp. 2007, 2010
*
* Authors:
* Daniel Lezcano <daniel.lezcano at free.fr>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#undef _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
#include "log.h"
#include "start.h" /* for struct lxc_handler */
#include "utils.h"
#include "error.h"
lxc_log_define(lxc_restart, lxc);
struct restart_args {
int sfd;
int flags;
};
static int restart(struct lxc_handler *handler, void* data)
{
struct restart_args *arg __attribute__ ((unused)) = data;
ERROR("'restart' function not implemented");
return -1;
}
static int post_restart(struct lxc_handler *handler, void* data)
{
struct restart_args *arg __attribute__ ((unused)) = data;
NOTICE("'%s' container restarting with pid '%d'", handler->name,
handler->pid);
return 0;
}
static struct lxc_operations restart_ops = {
.start = restart,
.post_start = post_restart
};
int lxc_restart(const char *name, int sfd, struct lxc_conf *conf, int flags,
const char *lxcpath)
{
struct restart_args restart_arg = {
.sfd = sfd,
.flags = flags
};
if (lxc_check_inherited(conf, sfd))
return -1;
return __lxc_start(name, conf, &restart_ops, &restart_arg, lxcpath);
}
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