[CRIU] [PATCH] RPC: make status-fd option available via RPC
Pavel Emelyanov
xemul at virtuozzo.com
Mon Feb 6 02:23:21 PST 2017
On 02/06/2017 11:52 AM, Adrian Reber wrote:
> 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..12cef70 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, 0600);
But why O_CREAT is needed here? The path in question should exist.
> + 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 {
>
More information about the CRIU
mailing list