From 33ddfc2adef00e3571137ef60d20de328e32d299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Fri, 17 Jan 2014 12:56:48 -0500 Subject: [PATCH] Deprecate lxc-checkpoint, lxc-kill and lxc-restart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Stéphane Graber Acked-by: Serge E. Hallyn --- .gitignore | 3 - configure.ac | 6 - doc/Makefile.am | 3 - doc/ja/Makefile.am | 3 - doc/ja/lxc-checkpoint.sgml.in | 243 -------------------------------- doc/ja/lxc-kill.sgml.in | 138 ------------------ doc/ja/lxc-restart.sgml.in | 254 ---------------------------------- doc/ja/see_also.sgml.in | 5 - doc/lxc-checkpoint.sgml.in | 198 -------------------------- doc/lxc-execute.sgml.in | 2 - doc/lxc-kill.sgml.in | 120 ---------------- doc/lxc-restart.sgml.in | 211 ---------------------------- doc/see_also.sgml.in | 5 - src/lxc/Makefile.am | 8 -- src/lxc/arguments.h | 5 - src/lxc/checkpoint.c | 32 ----- src/lxc/lxc.h | 22 --- src/lxc/lxc_checkpoint.c | 149 -------------------- src/lxc/lxc_kill.c | 96 ------------- src/lxc/lxc_restart.c | 180 ------------------------ src/lxc/restart.c | 79 ----------- 21 files changed, 1762 deletions(-) delete mode 100644 doc/ja/lxc-checkpoint.sgml.in delete mode 100644 doc/ja/lxc-kill.sgml.in delete mode 100644 doc/ja/lxc-restart.sgml.in delete mode 100644 doc/lxc-checkpoint.sgml.in delete mode 100644 doc/lxc-kill.sgml.in delete mode 100644 doc/lxc-restart.sgml.in delete mode 100644 src/lxc/checkpoint.c delete mode 100644 src/lxc/lxc_checkpoint.c delete mode 100644 src/lxc/lxc_kill.c delete mode 100644 src/lxc/lxc_restart.c delete mode 100644 src/lxc/restart.c diff --git a/.gitignore b/.gitignore index 2b2c8d5ced..f416f39a83 100644 --- a/.gitignore +++ b/.gitignore @@ -48,7 +48,6 @@ src/lxc/lxc-attach src/lxc/lxc-autostart src/lxc/lxc-cgroup src/lxc/lxc-checkconfig -src/lxc/lxc-checkpoint src/lxc/lxc-clone src/lxc/lxc-console src/lxc/lxc-config @@ -59,12 +58,10 @@ src/lxc/lxc-freeze src/lxc/lxc.functions src/lxc/lxc-info src/lxc/lxc-init -src/lxc/lxc-kill src/lxc/lxc-monitor src/lxc/lxc-monitord src/lxc/lxc-netstat src/lxc/lxc-ps -src/lxc/lxc-restart src/lxc/lxc-shutdown src/lxc/lxc-snapshot src/lxc/lxc-start diff --git a/configure.ac b/configure.ac index 3fcf030c42..6c8156bc91 100644 --- a/configure.ac +++ b/configure.ac @@ -574,7 +574,6 @@ AC_CONFIG_FILES([ doc/lxc-autostart.sgml doc/lxc-cgroup.sgml doc/lxc-checkconfig.sgml - doc/lxc-checkpoint.sgml doc/lxc-clone.sgml doc/lxc-console.sgml doc/lxc-create.sgml @@ -583,12 +582,10 @@ AC_CONFIG_FILES([ doc/lxc-execute.sgml doc/lxc-freeze.sgml doc/lxc-info.sgml - doc/lxc-kill.sgml doc/lxc-ls.sgml doc/lxc-monitor.sgml doc/lxc-netstat.sgml doc/lxc-ps.sgml - doc/lxc-restart.sgml doc/lxc-snapshot.sgml doc/lxc-start-ephemeral.sgml doc/lxc-start.sgml @@ -624,7 +621,6 @@ AC_CONFIG_FILES([ doc/ja/lxc-autostart.sgml doc/ja/lxc-cgroup.sgml doc/ja/lxc-checkconfig.sgml - doc/ja/lxc-checkpoint.sgml doc/ja/lxc-clone.sgml doc/ja/lxc-console.sgml doc/ja/lxc-create.sgml @@ -633,12 +629,10 @@ AC_CONFIG_FILES([ doc/ja/lxc-execute.sgml doc/ja/lxc-freeze.sgml doc/ja/lxc-info.sgml - doc/ja/lxc-kill.sgml doc/ja/lxc-ls.sgml doc/ja/lxc-monitor.sgml doc/ja/lxc-netstat.sgml doc/ja/lxc-ps.sgml - doc/ja/lxc-restart.sgml doc/ja/lxc-snapshot.sgml doc/ja/lxc-start-ephemeral.sgml doc/ja/lxc-start.sgml diff --git a/doc/Makefile.am b/doc/Makefile.am index f5482383cb..ba3a234bb0 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -19,7 +19,6 @@ man_MANS = \ lxc-autostart.1 \ lxc-cgroup.1 \ lxc-checkconfig.1 \ - lxc-checkpoint.1 \ lxc-clone.1 \ lxc-console.1 \ lxc-create.1 \ @@ -27,11 +26,9 @@ man_MANS = \ lxc-execute.1 \ lxc-freeze.1 \ lxc-info.1 \ - lxc-kill.1 \ lxc-monitor.1 \ lxc-netstat.1 \ lxc-ps.1 \ - lxc-restart.1 \ lxc-snapshot.1 \ lxc-start.1 \ lxc-stop.1 \ diff --git a/doc/ja/Makefile.am b/doc/ja/Makefile.am index cfb033b632..31d6f0846a 100644 --- a/doc/ja/Makefile.am +++ b/doc/ja/Makefile.am @@ -12,7 +12,6 @@ man_MANS = \ lxc-autostart.1 \ lxc-cgroup.1 \ lxc-checkconfig.1 \ - lxc-checkpoint.1 \ lxc-clone.1 \ lxc-console.1 \ lxc-create.1 \ @@ -20,11 +19,9 @@ man_MANS = \ lxc-execute.1 \ lxc-freeze.1 \ lxc-info.1 \ - lxc-kill.1 \ lxc-monitor.1 \ lxc-netstat.1 \ lxc-ps.1 \ - lxc-restart.1 \ lxc-snapshot.1 \ lxc-start.1 \ lxc-stop.1 \ diff --git a/doc/ja/lxc-checkpoint.sgml.in b/doc/ja/lxc-checkpoint.sgml.in deleted file mode 100644 index e8db9431f6..0000000000 --- a/doc/ja/lxc-checkpoint.sgml.in +++ /dev/null @@ -1,243 +0,0 @@ - - - - -]> - - - - @LXC_GENERATE_DATE@ - - - lxc-checkpoint - 1 - IBM - - - - lxc-checkpoint - - - - 実行中のコンテナのチェックポイントの作成 (未実装) - - - - - - lxc-checkpoint - --statefile=FILE - --statefd=FD - --name=NAME - | - - - - - <!-- Description --> - - - - lxc-checkpoint は,NAME 指定したコンテナのチェックポイントを作成し,その状態を FILE で指定したファイルにダンプします. - が指定された場合,チェックポイントの取得後,コンテナ内で実行されているアプリケーションは,実行が再開する直前に終了します. - が指定された場合,チェックポイントの取得後,コンテナ内で実行されているアプリケーションは,実行が再開する直前に休止します. - lxc-unfreeze コマンドで,実行を再開させます. - - - - - - <!-- Checkpoint Options -->チェックポイントのオプション - - - - - - - - - コンテナの実行状態を FILE に書き込みます. - このオプションは以下の と同時に指定できません. - - - - - - - - - - コンテナの実行状態を指定した FD ファイルディスクリプタに書き込みます. - このオプションは前述の と同時に指定出来ません. - - - - - - - - - - チェックポイントを取得した後,コンテナプロセスを kill します. - プロセスには SIGKILL シグナルが送られます. - - - - このオプションは以下の オプションと同時に指定することはできません. - - - - - - - - - - チェックポイントを取得した後,コンテナプロセスを休止させます. - コンテナを再開させるまで止まったままとなります. - このオプションは前述の オプションと同時に指定することはできません. - - - - - - - - - &commonoptions; - - - <!-- Examples -->例 - - - 円周率の小数点以下を計算する新しいコンテナ 123 を起動させるために,以下を実行します. - - - lxc-execute -n 123 -- pi1 -d 500000 - lxc-execute --name=123 -- pi1 -d 500000 - - - - - ダンプ後終了するモードで,そのコンテナのチェックポイントを取得します. - - - lxc-checkpoint -n 123 -S /share/123/chkpt1 -k - lxc-checkpoint --name=123 -S /share/123/chkpt1 -k - - - - - 同じコンテナのチェックポイントを取得し,休止させます. - - - lxc-checkpoint -n 123 -S /share/123/chkpt1 -p - lxc-checkpoint --name=123 -S /share/123/chkpt1 -p - - - - - - <!-- Notes -->注意 - - 実際はこのコマンドは動作しません. - この説明は将来的なチェックポイント/再起動機能の解決策となる CLI API を定義するのを助けるためのものです. - - - &seealso; - - - <!-- Author -->作者 - Daniel Lezcano daniel.lezcano@free.fr - - - - - diff --git a/doc/ja/lxc-kill.sgml.in b/doc/ja/lxc-kill.sgml.in deleted file mode 100644 index 59a319b733..0000000000 --- a/doc/ja/lxc-kill.sgml.in +++ /dev/null @@ -1,138 +0,0 @@ - - - - -]> - - - - @LXC_GENERATE_DATE@ - - - lxc-kill - 1 - IBM - - - - lxc-kill - - - - コンテナの最初のプロセスへのシグナルの送出 - - - - - - lxc-kill - --name=NAME - SIGNUM - - - - - Description - - - - lxc-kill は,SIGNUM で指定されたシグナルをコンテナの最初のプロセスに送ります. - - - - SIGNUM は数値で,シグナル名はサポートしていません. - - - - このコマンドが lxc-execute で起動したアプリケーションコンテナに対して使われた場合,lxc-init がシグナルを受け取り,(lxc-execute の) コマンドラインで指定されたコマンドである 2 番目のプロセスにそれを転送します. - - - - &commonoptions; - - - <!-- Examples -->例 - - - - コンテナ名 123 で実行されているプロセス pi1 に対して 26 のシグナルを送るためには: - - - - lxc-execute -n 123 -- pi1 -d 500000 - lxc-kill --name=123 26 - - - - - &seealso; - - - <!-- Author -->作者 - Daniel Lezcano daniel.lezcano@free.fr - - - - - diff --git a/doc/ja/lxc-restart.sgml.in b/doc/ja/lxc-restart.sgml.in deleted file mode 100644 index 2b45ce3ae0..0000000000 --- a/doc/ja/lxc-restart.sgml.in +++ /dev/null @@ -1,254 +0,0 @@ - - - - -]> - - - - @LXC_GENERATE_DATE@ - - - lxc-restart - 1 - IBM - - - - lxc-restart - - - - ファイルからのコンテナの再起動 (未実装) - - - - - - lxc-restart - -f config_file - -s KEY=VAL - --statefile=FILE - --statefd=FD - --name=NAME - - - - - <!-- Description -->説明 - - - - lxc-restartFILE で指定したファイルから状態を読み取り,NAME で指定したコンテナ内のアプリケーションを再起動するコマンドです. - もし が指定された場合,アプリケーションは再起動後に直前の実行状態で再開する前に停止します. - この実行状態の再開には lxc-unfreeze コマンドが必要になります. - - - - - <!-- Restart Options -->再起動オプション - - - - - - - - コンテナの状態を FILE で指定したファイルから読み取ります. - このオプションは,後の と同時に指定できません. - - - - - - - - - - コンテナの状態を FD で指定したファイル記述子から読み取ります. - このオプションは,前の と同時に指定できません. - - - - - - - - - - 再起動後にコンテナプロセスを一時停止します. - コンテナは lxc-unfreeze コマンドで再開するまでは停止しています. - - - - - - - - - - コンテナの仮想化および隔離機能を設定した設定ファイルを指定します.このパラメータは,lxc-execute コマンドや lxc-start コマンドで (起動時に) 指定されていた場合や,再起動後に設定を変更する場合に指定すべきです.後者の場合,再起動に必要なリソースが利用できない場合は失敗するでしょう.コンテナが lxc-create コマンドで作成され,設定されていた場合,このオプションは必要ありません.設定は自動的に見つけられるでしょう. - - - - - - - - - - - - 設定変数 KEY の値を VAL に設定します.この設定は config_file で設定された値を上書きします. - - - - - - - - - &commonoptions; - - - <!-- Examples -->例 - - - 円周率の小数点以下を計算する新しいコンテナ 123 を開始するために, - - - lxc-execute -n 123 -- pi1 -d 500000 - lxc-execute --name=123 -- pi1 -d 500000 - - - - - dump-death モードで同じコンテナのチェックポイントを作成するために, - - - lxc-checkpoint -n 123 -S /share/123/chkpt1 -k - lxc-checkpoint --name=123 --statefile=/share/123/chkpt1 -k - - - - - そして,異なる id で同じコンテナを再起動するために, - - - lxc-restart -n 200 -S /share/123/chkpt1 - lxc-restart --name=200 --statefile=/share/123/chkpt1 - - - - - - <!-- Notes -->注意 - - - 実際はこのコマンドは動作しません.この説明は将来的なチェックポイント/再起動の解決策となる CLI API を定義するのを助けるためのものです. - - - - &seealso; - - - <!-- Author -->作者 - Daniel Lezcano daniel.lezcano@free.fr - - - - - diff --git a/doc/ja/see_also.sgml.in b/doc/ja/see_also.sgml.in index 8ffdcfe66e..4c579f4b76 100644 --- a/doc/ja/see_also.sgml.in +++ b/doc/ja/see_also.sgml.in @@ -60,11 +60,6 @@ by KATOH Yasufumi 1 , - - lxc-kill - 1 - , - lxc-console 1 diff --git a/doc/lxc-checkpoint.sgml.in b/doc/lxc-checkpoint.sgml.in deleted file mode 100644 index 6d3b757458..0000000000 --- a/doc/lxc-checkpoint.sgml.in +++ /dev/null @@ -1,198 +0,0 @@ - - - - -]> - - - - @LXC_GENERATE_DATE@ - - - lxc-checkpoint - 1 - IBM - - - - lxc-checkpoint - - - checkpoint a running container (not implemented yet) - - - - - - lxc-checkpoint - --statefile=FILE - --statefd=FD - --name=NAME - | - - - - - Description - - - lxc-checkpoint is a command - to checkpoint the specified container - NAME and dumps its state into the file - FILE. If the - option is specified, the application - running in the container will terminate after the checkpoint - just before resuming its execution. If the - option is specified, the application - will be stopped after the checkpoint just before resuming - execution. The command lxc-unfreeze will - resume its execution. - - - - - - Checkpoint Options - - - - - - - - write the state of the container in this - FILE. - This option is exclusive with below. - - - - - - - - - write the state of the container in this - FD file descriptor. - This option is exclusive with above . - - - - - - - - - Kill container processes after checkpoint. the processes are sent - a SIGKILL signal. - - - This option is mutually exclusive with the following - option. - - - - - - - - - Pause container processes after checkpoint. The container - will be stopped until you resume it. This option is - mutually exclusive with previously mentionned - option. - - - - - - - - - &commonoptions; - - - Examples - - To start a new container 123 computing decimals of pi - - - lxc-execute -n 123 -- pi1 -d 500000 - lxc-execute --name=123 -- pi1 -d 500000 - - - - to checkpoint the same container in dump-death - mode - - - lxc-checkpoint -n 123 -S /share/123/chkpt1 -k - lxc-checkpoint --name=123 -S /share/123/chkpt1 -k - - - - to checkpoint the same container and pause it - - - lxc-checkpoint -n 123 -S /share/123/chkpt1 -p - lxc-checkpoint --name=123 -S /share/123/chkpt1 -p - - - - - - Notes - Actually, this command does not operate. Its description - helps to define a CLI api for future Checkpoint / Restart - solution - - - &seealso; - - - Author - Daniel Lezcano daniel.lezcano@free.fr - - - - - diff --git a/doc/lxc-execute.sgml.in b/doc/lxc-execute.sgml.in index bab4658fd8..4ec7c1b940 100644 --- a/doc/lxc-execute.sgml.in +++ b/doc/lxc-execute.sgml.in @@ -89,8 +89,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA The above lxc-init is designed to forward received signals to the started command. - So lxc-kill (1) sent signal is received - by the user specified command (pid 2 in the container). diff --git a/doc/lxc-kill.sgml.in b/doc/lxc-kill.sgml.in deleted file mode 100644 index 1a9f10ed87..0000000000 --- a/doc/lxc-kill.sgml.in +++ /dev/null @@ -1,120 +0,0 @@ - - - - -]> - - - - @LXC_GENERATE_DATE@ - - - lxc-kill - 1 - IBM - - - - lxc-kill - - - Send a signal to the process 1 of the container. - - - - - - lxc-kill - --name=NAME - SIGNUM - - - - - Description - - - lxc-kill send - the SIGNUM signal to the first process of the container. - - - The SIGNUM is a numeric value, - the signal name is not supported. - - - 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). - - - - &commonoptions; - - - Examples - - - To send the signal 26 to the process pi1 running in container - 123 : - - - - lxc-execute -n 123 -- pi1 -d 500000 - lxc-kill --name=123 26 - - - - - &seealso; - - - Author - Daniel Lezcano daniel.lezcano@free.fr - - - - - diff --git a/doc/lxc-restart.sgml.in b/doc/lxc-restart.sgml.in deleted file mode 100644 index ceb4a9d897..0000000000 --- a/doc/lxc-restart.sgml.in +++ /dev/null @@ -1,211 +0,0 @@ - - - - -]> - - - - @LXC_GENERATE_DATE@ - - - lxc-restart - 1 - IBM - - - - lxc-restart - - - restart a container from a file (not implemented yet) - - - - - - lxc-restart - -f config_file - -s KEY=VAL - --statefile=FILE - --statefd=FD - --name=NAME - - - - - Description - - - lxc-restart is a command - to restart an application from the state read in the specified - FILE, in a container with the - identifier NAME. - If the option - is specified, the application will be stopped after the - restart just before resuming execution. The command - lxc-unfreeze will be needed to resume its - execution. - - - - - Restart Options - - - - - - - read the state of the container in this - FILE. - This option is exclusive with below. - - - - - - - - - read the state of the container in this - FD file descriptor. - This option is exclusive with above . - - - - - - - - - Pause container processes after restart. The container will be - stopped until you resume it with the lxc-unfreeze command. - - - - - - - - - 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 lxc-execute - or lxc-start 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 lxc-create, this option - is not needed, the configuration will be automatically - found. - - - - - - - - - - - Assign value VAL to configuration - variable KEY. This overrides any - assignment done in config_file. - - - - - - - - - &commonoptions; - - - Examples - - To start a new container 123 computing decimals of pi - - - lxc-execute -n 123 -- pi1 -d 500000 - lxc-execute --name=123 -- pi1 -d 500000 - - - - to checkpoint the same container in dump-death - mode - - - lxc-checkpoint -n 123 -S /share/123/chkpt1 -k - lxc-checkpoint --name=123 --statefile=/share/123/chkpt1 -k - - - - and to restart the same container with a different id - - - lxc-restart -n 200 -S /share/123/chkpt1 - lxc-restart --name=200 --statefile=/share/123/chkpt1 - - - - - - Notes - Actually, this command does not operate. Its description - helps to define a CLI api for future Checkpoint / Restart - solution - - - &seealso; - - - Author - Daniel Lezcano daniel.lezcano@free.fr - - - - - diff --git a/doc/see_also.sgml.in b/doc/see_also.sgml.in index c365590b40..16530f3894 100644 --- a/doc/see_also.sgml.in +++ b/doc/see_also.sgml.in @@ -57,11 +57,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 1 , - - lxc-kill - 1 - , - lxc-console 1 diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am index 1a63fca0c7..602447e37a 100644 --- a/src/lxc/Makefile.am +++ b/src/lxc/Makefile.am @@ -60,8 +60,6 @@ liblxc_so_SOURCES = \ monitor.c monitor.h \ console.c \ freezer.c \ - checkpoint.c \ - restart.c \ error.h error.c \ parse.c parse.h \ cgroup.c cgroup.h \ @@ -196,9 +194,6 @@ bin_PROGRAMS = \ lxc-info \ lxc-cgroup \ lxc-unfreeze \ - lxc-checkpoint \ - lxc-restart \ - lxc-kill \ lxc-config \ lxc-destroy \ lxc-create \ @@ -223,7 +218,6 @@ lxc_cgroup_SOURCES += cgmanager.c 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) #endif -lxc_checkpoint_SOURCES = lxc_checkpoint.c lxc_config_SOURCES = lxc_config.c lxc_console_SOURCES = lxc_console.c lxc_destroy_SOURCES = lxc_destroy.c @@ -233,14 +227,12 @@ lxc_info_SOURCES = lxc_info.c lxc_init_SOURCES = lxc_init.c lxc_monitor_SOURCES = lxc_monitor.c lxc_monitord_SOURCES = lxc_monitord.c -lxc_restart_SOURCES = lxc_restart.c lxc_clone_SOURCES = lxc_clone.c lxc_start_SOURCES = lxc_start.c lxc_stop_SOURCES = lxc_stop.c lxc_unfreeze_SOURCES = lxc_unfreeze.c lxc_unshare_SOURCES = lxc_unshare.c lxc_wait_SOURCES = lxc_wait.c -lxc_kill_SOURCES = lxc_kill.c lxc_create_SOURCES = lxc_create.c lxc_snapshot_SOURCES = lxc_snapshot.c lxc_usernsexec_SOURCES = lxc_usernsexec.c diff --git a/src/lxc/arguments.h b/src/lxc/arguments.h index 4bbfc71677..d99f79b468 100644 --- a/src/lxc/arguments.h +++ b/src/lxc/arguments.h @@ -57,11 +57,6 @@ struct lxc_arguments { /* for lxc-start */ 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 */ int ttynum; char escape; diff --git a/src/lxc/checkpoint.c b/src/lxc/checkpoint.c deleted file mode 100644 index b50273a846..0000000000 --- a/src/lxc/checkpoint.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2008 - * - * Authors: - * Daniel Lezcano - * - * 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; -} diff --git a/src/lxc/lxc.h b/src/lxc/lxc.h index 0682f86808..56f9fe2517 100644 --- a/src/lxc/lxc.h +++ b/src/lxc/lxc.h @@ -171,28 +171,6 @@ extern int lxc_cgroup_get(const char *filename, char *value, size_t len, const c */ 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. */ diff --git a/src/lxc/lxc_checkpoint.c b/src/lxc/lxc_checkpoint.c deleted file mode 100644 index 7f7d53ed08..0000000000 --- a/src/lxc/lxc_checkpoint.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2010 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include -#include -#include -#include -#include - -#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; -} diff --git a/src/lxc/lxc_kill.c b/src/lxc/lxc_kill.c deleted file mode 100644 index 62c76bd465..0000000000 --- a/src/lxc/lxc_kill.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2010 - * - * Authors: - * Daniel Lezcano - * - * 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 -#include -#include -#include -#include - -#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; -} diff --git a/src/lxc/lxc_restart.c b/src/lxc/lxc_restart.c deleted file mode 100644 index 85afb1e677..0000000000 --- a/src/lxc/lxc_restart.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2010 - * - * Authors: - * Daniel Lezcano - * - * 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 -#undef _GNU_SOURCE -#include -#include -#include -#include -#include - -#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; -} diff --git a/src/lxc/restart.c b/src/lxc/restart.c deleted file mode 100644 index 8d5b7923e5..0000000000 --- a/src/lxc/restart.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * lxc: linux Container library - * - * (C) Copyright IBM Corp. 2007, 2010 - * - * Authors: - * Daniel Lezcano - * - * 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 -#undef _GNU_SOURCE -#include -#include -#include -#include - -#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); -}