[CRIU] [PATCH] Enable manage cgroup modes in criu service (v2)
Hui Kang
hkang.sunysb at gmail.com
Wed Aug 5 10:03:45 PDT 2015
Hi,
Add another rpc option so that manage cgroup can be set in the service
mode. Please review this one. Thanks.
- Hui
>From 99a8dee55e7874c7089fa3baf1dd2aedc567b47f Mon Sep 17 00:00:00 2001
From: Hui Kang <hkang.sunysb at gmail.com>
Date: Wed, 5 Aug 2015 16:48:23 +0000
Subject: [PATCH] Enable manage cgroup modes in criu service
Signed-off-by: Hui Kang <hkang.sunysb at gmail.com>
---
cr-service.c | 4 ++++
lib/criu.c | 11 +++++++++++
lib/criu.h | 2 ++
protobuf/rpc.proto | 21 +++++++++++----------
4 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/cr-service.c b/cr-service.c
index 105787e..9bf15ed 100644
--- a/cr-service.c
+++ b/cr-service.c
@@ -400,6 +400,10 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
if (req->has_manage_cgroups)
opts.manage_cgroups = req->manage_cgroups ? CG_MODE_SOFT :
CG_MODE_IGNORE;
+ /* Override the manage_cgroup if mode is set explicitly */
+ if (req->has_manage_cgroups_mode) {
+ opts.manage_cgroups = req->manage_cgroups_mode;
+
if (req->has_auto_ext_mnt)
opts.autodetect_ext_mounts = req->auto_ext_mnt;
diff --git a/lib/criu.c b/lib/criu.c
index 3c194a1..90f909f 100644
--- a/lib/criu.c
+++ b/lib/criu.c
@@ -375,6 +375,17 @@ void criu_set_manage_cgroups(bool manage)
criu_local_set_manage_cgroups(global_opts, manage);
}
+void criu_local_set_manage_cgroups_mode(criu_opts *opts, unsigned int mode)
+{
+ opts->rpc->has_manage_cgroups_mode = true;
+ opts->rpc->manage_cgroups_mode = mode;
+}
+
+void criu_set_manage_cgroups_mode(unsigned int mode)
+{
+ criu_local_set_manage_cgroups_mode(global_opts, mode);
+}
+
void criu_local_set_auto_ext_mnt(criu_opts *opts, bool val)
{
opts->rpc->has_auto_ext_mnt = true;
diff --git a/lib/criu.h b/lib/criu.h
index 3cb0322..169b9e3 100644
--- a/lib/criu.h
+++ b/lib/criu.h
@@ -67,6 +67,7 @@ void criu_set_log_file(char *log_file);
void criu_set_cpu_cap(unsigned int cap);
void criu_set_root(char *root);
void criu_set_manage_cgroups(bool manage);
+void criu_set_manage_cgroups_mode(unsigned int mode);
void criu_set_auto_ext_mnt(bool val);
void criu_set_ext_sharing(bool val);
void criu_set_ext_masters(bool val);
@@ -166,6 +167,7 @@ void criu_local_set_log_file(criu_opts *opts, char
*log_file);
void criu_local_set_cpu_cap(criu_opts *opts, unsigned int cap);
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, unsigned int
mode);
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);
diff --git a/protobuf/rpc.proto b/protobuf/rpc.proto
index 2f4d0c0..779898a 100644
--- a/protobuf/rpc.proto
+++ b/protobuf/rpc.proto
@@ -60,20 +60,21 @@ message criu_opts {
repeated string exec_cmd = 22;
repeated ext_mount_map ext_mnt = 23;
- optional bool manage_cgroups = 24;
- repeated cgroup_root cg_root = 25;
+ optional bool manage_cgroups = 24; /* backward
compatibility */
+ optional uint32 manage_cgroups_mode = 25;
+ repeated cgroup_root cg_root = 26;
- optional bool rst_sibling = 26; /* swrk only */
- repeated inherit_fd inherit_fd = 27; /* swrk only */
+ optional bool rst_sibling = 27; /* swrk only */
+ repeated inherit_fd inherit_fd = 28; /* swrk only */
- optional bool auto_ext_mnt = 28;
- optional bool ext_sharing = 29;
- optional bool ext_masters = 30;
+ optional bool auto_ext_mnt = 29;
+ optional bool ext_sharing = 30;
+ optional bool ext_masters = 31;
- repeated string skip_mnt = 31;
- repeated string enable_fs = 32;
+ repeated string skip_mnt = 32;
+ repeated string enable_fs = 33;
- repeated unix_sk unix_sk_ino = 33;
+ repeated unix_sk unix_sk_ino = 34;
}
message criu_dump_resp {
--
1.9.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20150805/5e5f81a5/attachment.html>
More information about the CRIU
mailing list