[CRIU] [PATCH] RPC: make status-fd option available via RPC

Adrian Reber adrian at lisas.de
Tue Jan 31 06:41:29 PST 2017


From: Adrian Reber <areber at redhat.com>

As runc uses the RPC interface to run criu it is necessary to expose
the newly added status-fd feature via RPC. Using the status-fd interface
makes it possible to use lazy migration with runc.

Signed-off-by: Adrian Reber <areber at redhat.com>
---
 criu/cr-service.c | 8 ++++++++
 images/rpc.proto  | 1 +
 2 files changed, 9 insertions(+)

diff --git a/criu/cr-service.c b/criu/cr-service.c
index 4bac50d..1d1673d 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -227,6 +227,7 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
 	socklen_t ids_len = sizeof(struct ucred);
 	char images_dir_path[PATH_MAX];
 	char work_dir_path[PATH_MAX];
+	char status_fd[PATH_MAX];
 	int i;
 
 	if (getsockopt(sk, SOL_SOCKET, SO_PEERCRED, &ids, &ids_len)) {
@@ -511,6 +512,13 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
 		}
 	}
 
+	if (req->has_status_fd) {
+		sprintf(status_fd, "/proc/%d/fd/%d", ids.pid, req->status_fd);
+		opts.status_fd = open(status_fd, O_WRONLY | O_CREAT);
+		if (opts.status_fd < 0)
+			goto err;
+	}
+
 	if (check_namespace_opts())
 		goto err;
 
diff --git a/images/rpc.proto b/images/rpc.proto
index 4811738..9ed5331 100644
--- a/images/rpc.proto
+++ b/images/rpc.proto
@@ -109,6 +109,7 @@ message criu_opts {
 	optional bool			tcp_skip_in_flight	= 46;
 	optional bool			weak_sysctls		= 47;
 	optional bool			lazy_pages		= 48;
+	optional int32			status_fd		= 49;
 }
 
 message criu_dump_resp {
-- 
2.9.3



More information about the CRIU mailing list