Commit 853391e5 authored by Adrian Reber's avatar Adrian Reber Committed by Pavel Emelyanov

RPC: make status-fd option available via RPC

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.

travis-ci: success for RPC: make status-fd option available via RPC (rev3)
Signed-off-by: 's avatarAdrian Reber <areber@redhat.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent ffc288fb
...@@ -227,6 +227,7 @@ static int setup_opts_from_req(int sk, CriuOpts *req) ...@@ -227,6 +227,7 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
socklen_t ids_len = sizeof(struct ucred); socklen_t ids_len = sizeof(struct ucred);
char images_dir_path[PATH_MAX]; char images_dir_path[PATH_MAX];
char work_dir_path[PATH_MAX]; char work_dir_path[PATH_MAX];
char status_fd[PATH_MAX];
int i; int i;
if (getsockopt(sk, SOL_SOCKET, SO_PEERCRED, &ids, &ids_len)) { if (getsockopt(sk, SOL_SOCKET, SO_PEERCRED, &ids, &ids_len)) {
...@@ -504,6 +505,13 @@ static int setup_opts_from_req(int sk, CriuOpts *req) ...@@ -504,6 +505,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);
if (opts.status_fd < 0)
goto err;
}
if (check_namespace_opts()) if (check_namespace_opts())
goto err; goto err;
......
...@@ -108,6 +108,7 @@ message criu_opts { ...@@ -108,6 +108,7 @@ message criu_opts {
optional uint32 timeout = 45; optional uint32 timeout = 45;
optional bool tcp_skip_in_flight = 46; optional bool tcp_skip_in_flight = 46;
optional bool weak_sysctls = 47; optional bool weak_sysctls = 47;
optional int32 status_fd = 49;
} }
message criu_dump_resp { message criu_dump_resp {
......
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