Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@openvz.org>2016-05-30 18:49:00 +0300
committerPavel Emelyanov <xemul@virtuozzo.com>2016-06-28 13:05:52 +0300
commit900e71cbec452057743f8fcf15e584b0030cf0bb (patch)
treede08fb22a9e458abbf14c2ab66fff487175d330e
parent92486c9015e4cecb45c0cd560087b8b9732357d6 (diff)
cg: rpc -- Add bindings for custom cgroup props engine
For handling --cgroup-props, --cgroup-props-file and --cgroup-dump-controller from RPC interface. Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
-rw-r--r--criu/cr-service.c12
-rw-r--r--images/rpc.proto4
-rw-r--r--lib/c/criu.c46
-rw-r--r--lib/c/criu.h3
4 files changed, 65 insertions, 0 deletions
diff --git a/criu/cr-service.c b/criu/cr-service.c
index 219a98624..0f806f7f8 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -28,6 +28,7 @@
#include "net.h"
#include "mount.h"
#include "cgroup.h"
+#include "cgroup-props.h"
#include "action-scripts.h"
#include "sockets.h"
#include "irmap.h"
@@ -453,6 +454,17 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
opts.manage_cgroups = mode;
}
+ if (req->cgroup_props)
+ opts.cgroup_props = req->cgroup_props;
+
+ if (req->cgroup_props_file)
+ opts.cgroup_props_file = req->cgroup_props_file;
+
+ for (i = 0; i < req->n_cgroup_dump_controller; i++) {
+ if (!cgp_add_dump_controller(req->cgroup_dump_controller[i]))
+ goto err;
+ }
+
if (req->has_auto_ext_mnt)
opts.autodetect_ext_mounts = req->auto_ext_mnt;
diff --git a/images/rpc.proto b/images/rpc.proto
index 9ece4dabb..7377bf83d 100644
--- a/images/rpc.proto
+++ b/images/rpc.proto
@@ -97,6 +97,10 @@ message criu_opts {
repeated string external = 37;
optional uint32 empty_ns = 38;
repeated join_namespace join_ns = 39;
+
+ optional string cgroup_props = 41;
+ optional string cgroup_props_file = 42;
+ repeated string cgroup_dump_controller = 43;
}
message criu_dump_resp {
diff --git a/lib/c/criu.c b/lib/c/criu.c
index 52d1b61d6..2e9ad75ac 100644
--- a/lib/c/criu.c
+++ b/lib/c/criu.c
@@ -700,6 +700,52 @@ err:
return -ENOMEM;
}
+int criu_local_add_cg_props(criu_opts *opts, char *stream)
+{
+ char *new;
+
+ new = strdup(stream);
+ if (!new)
+ return -ENOMEM;
+
+ free(opts->rpc->cgroup_props);
+ opts->rpc->cgroup_props = new;
+ return 0;
+}
+
+int criu_local_add_cg_props_file(criu_opts *opts, char *path)
+{
+ char *new;
+
+ new = strdup(path);
+ if (!new)
+ return -ENOMEM;
+
+ free(opts->rpc->cgroup_props_file);
+ opts->rpc->cgroup_props_file = new;
+ return 0;
+}
+
+int criu_local_add_cg_dump_controller(criu_opts *opts, char *name)
+{
+ char **new;
+ size_t nr;
+
+ nr = opts->n_cgroup_dump_controller + 1;
+ new = realloc(opts->cgroup_dump_controller, nr * sizeof(char *));
+ if (!new)
+ return -ENOMEM;
+
+ new[opts->n_cgroup_dump_controller] = strdup(name);
+ if (!new[opts->n_cgroup_dump_controller])
+ return -ENOMEM;
+
+ opts->n_cgroup_dump_controller = nr;
+ opts->cgroup_dump_controller = new;
+
+ return 0;
+}
+
int criu_add_skip_mnt(char *mnt)
{
return criu_local_add_skip_mnt(global_opts, mnt);
diff --git a/lib/c/criu.h b/lib/c/criu.h
index 0898be024..1085cd3de 100644
--- a/lib/c/criu.h
+++ b/lib/c/criu.h
@@ -191,6 +191,9 @@ int criu_local_add_enable_fs(criu_opts *opts, char *fs);
int criu_local_add_skip_mnt(criu_opts *opts, char *mnt);
void criu_local_set_ghost_limit(criu_opts *opts, unsigned int limit);
int criu_local_add_irmap_path(criu_opts *opts, char *path);
+int criu_local_add_cg_props(criu_opts *opts, char *stream);
+int criu_local_add_cg_props_file(criu_opts *opts, char *path);
+int criu_local_add_cg_dump_controller(criu_opts *opts, char *name);
void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char *action, criu_notify_arg_t na));