[CRIU] [PATCH] rpc: Add interface for @timeout option

Cyrill Gorcunov gorcunov at openvz.org
Fri Jun 17 04:22:20 PDT 2016


From: Nikita Spiridonov <nspiridonov at virtuozzo.com>

Needed for container migration, where arguments are
set via p.haul as rpc request.

Signed-off-by: Nikita Spiridonov <nspiridonov at virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 criu/cr-service.c |  3 +++
 images/rpc.proto  |  1 +
 lib/c/criu.c      | 10 ++++++++++
 lib/c/criu.h      |  2 ++
 4 files changed, 16 insertions(+)

diff --git a/criu/cr-service.c b/criu/cr-service.c
index 1a32e3b0bf1f..f1d94c125d68 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -457,6 +457,9 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
 	if (req->freeze_cgroup)
 		opts.freeze_cgroup = req->freeze_cgroup;
 
+	if (req->has_timeout)
+		opts.timeout = req->timeout;
+
 	if (req->cgroup_props)
 		opts.cgroup_props = req->cgroup_props;
 
diff --git a/images/rpc.proto b/images/rpc.proto
index c14e68ae276a..8e6cfd05af94 100644
--- a/images/rpc.proto
+++ b/images/rpc.proto
@@ -104,6 +104,7 @@ message criu_opts {
 	repeated string			cgroup_dump_controller	= 43;
 
 	optional string			freeze_cgroup		= 44;
+	optional uint32			timeout			= 45;
 }
 
 message criu_dump_resp {
diff --git a/lib/c/criu.c b/lib/c/criu.c
index c5802af25cb6..05425a38ec14 100644
--- a/lib/c/criu.c
+++ b/lib/c/criu.c
@@ -395,6 +395,16 @@ void criu_set_freeze_cgroup(char *name)
 	criu_local_set_freeze_cgroup(global_opts, name);
 }
 
+void criu_local_set_timeout(criu_opts *opts, unsigned int timeout)
+{
+	opts->rpc->timeout = timeout;
+}
+
+void criu_set_timeout(unsigned int timeout)
+{
+	criu_local_set_timeout(global_opts, timeout);
+}
+
 void criu_local_set_auto_ext_mnt(criu_opts *opts, bool val)
 {
 	opts->rpc->has_auto_ext_mnt = true;
diff --git a/lib/c/criu.h b/lib/c/criu.h
index bd31666c8444..7ed1750d58e6 100644
--- a/lib/c/criu.h
+++ b/lib/c/criu.h
@@ -79,6 +79,7 @@ void criu_set_root(char *root);
 void criu_set_manage_cgroups(bool manage);
 void criu_set_manage_cgroups_mode(enum criu_cg_mode mode);
 void criu_set_freeze_cgroup(char *name);
+void criu_set_timeout(unsigned int timeout);
 void criu_set_auto_ext_mnt(bool val);
 void criu_set_ext_sharing(bool val);
 void criu_set_ext_masters(bool val);
@@ -182,6 +183,7 @@ void criu_local_set_root(criu_opts *opts, char *root);
 void criu_local_set_manage_cgroups(criu_opts *opts, bool manage);
 void criu_local_set_manage_cgroups_mode(criu_opts *opts, enum criu_cg_mode mode);
 void criu_local_set_freeze_cgroup(criu_opts *opts, char *name);
+void criu_local_set_timeout(criu_opts *opts, unsigned int timeout);
 void criu_local_set_auto_ext_mnt(criu_opts *opts, bool val);
 void criu_local_set_ext_sharing(criu_opts *opts, bool val);
 void criu_local_set_ext_masters(criu_opts *opts, bool val);
-- 
2.5.5



More information about the CRIU mailing list