[lxc-devel] [lxc/master] c/r: add support for ghost-limit in CRIU

tych0 on Github lxc-bot at linuxcontainers.org
Tue Jul 19 21:36:08 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 435 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160719/a0caeace/attachment.bin>
-------------- next part --------------
From b2b7b0d22395929f822a0c524e31bdc099e758d0 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Tue, 19 Jul 2016 14:27:26 -0600
Subject: [PATCH] c/r: add support for ghost-limit in CRIU

This is an old option that we probably should have exposed long ago :)

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 src/lxc/criu.c         | 17 +++++++++++++++++
 src/lxc/lxccontainer.h |  6 ++++++
 2 files changed, 23 insertions(+)

diff --git a/src/lxc/criu.c b/src/lxc/criu.c
index 804fd41..d330d72 100644
--- a/src/lxc/criu.c
+++ b/src/lxc/criu.c
@@ -169,6 +169,10 @@ static void exec_criu(struct criu_opts *opts)
 		/* --force-irmap */
 		if (!opts->user->preserves_inodes)
 			static_args++;
+
+		/* --ghost-limit 1024 */
+		if (opts->user->ghost_limit)
+			static_args += 2;
 	} else if (strcmp(opts->action, "restore") == 0) {
 		/* --root $(lxc_mount_point) --restore-detached
 		 * --restore-sibling --pidfile $foo --cgroup-root $foo
@@ -300,6 +304,19 @@ static void exec_criu(struct criu_opts *opts)
 		if (!opts->user->preserves_inodes)
 			DECLARE_ARG("--force-irmap");
 
+		if (opts->user->ghost_limit) {
+			char ghost_limit[32];
+
+			ret = sprintf(ghost_limit, "%lu", opts->user->ghost_limit);
+			if (ret < 0 || ret >= sizeof(ghost_limit)) {
+				ERROR("failed to print ghost limit %lu", opts->user->ghost_limit);
+				goto err;
+			}
+
+			DECLARE_ARG("--ghost-limit");
+			DECLARE_ARG(ghost_limit);
+		}
+
 		/* only for final dump */
 		if (strcmp(opts->action, "dump") == 0 && !opts->user->stop)
 			DECLARE_ARG("--leave-running");
diff --git a/src/lxc/lxccontainer.h b/src/lxc/lxccontainer.h
index e4915d2..06bec58 100644
--- a/src/lxc/lxccontainer.h
+++ b/src/lxc/lxccontainer.h
@@ -902,6 +902,12 @@ struct migrate_opts {
 	 * unconditionally disable this feature. In-flight connections are
 	 * not fully established TCP connections: SYN, SYN-ACK */
 	bool disable_skip_in_flight;
+
+	/* This is the maximum file size for deleted files (which CRIU calls
+	 * "ghost" files) that will be handled. 0 indicates the CRIU default,
+	 * which at this time is 1MB.
+	 */
+	uint64_t ghost_limit;
 };
 
 /*!


More information about the lxc-devel mailing list