<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi,<br>
<br>
<br>
<div class="moz-cite-prefix">On 08/05/2015 08:03 PM, Hui Kang wrote:<br>
</div>
<blockquote
cite="mid:CAPd85sKn0E4n93m3Y4+OptkBLM_bgEtfG4-tqkqcw7Hoyja-3A@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>Hi,<br>
</div>
Add another rpc option so that manage cgroup can be set in the
service mode. Please review this one. Thanks.<br>
<br>
</div>
- Hui<br>
<div>
<div>
<div>
<div><br>
From 99a8dee55e7874c7089fa3baf1dd2aedc567b47f Mon Sep 17
00:00:00 2001<br>
From: Hui Kang <<a moz-do-not-send="true"
href="mailto:hkang.sunysb@gmail.com">hkang.sunysb@gmail.com</a>><br>
Date: Wed, 5 Aug 2015 16:48:23 +0000<br>
Subject: [PATCH] Enable manage cgroup modes in criu
service<br>
<br>
Signed-off-by: Hui Kang <<a moz-do-not-send="true"
href="mailto:hkang.sunysb@gmail.com">hkang.sunysb@gmail.com</a>><br>
---<br>
cr-service.c | 4 ++++<br>
lib/criu.c | 11 +++++++++++<br>
lib/criu.h | 2 ++<br>
protobuf/rpc.proto | 21 +++++++++++----------<br>
4 files changed, 28 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/cr-service.c b/cr-service.c<br>
index 105787e..9bf15ed 100644<br>
--- a/cr-service.c<br>
+++ b/cr-service.c<br>
@@ -400,6 +400,10 @@ static int setup_opts_from_req(int
sk, CriuOpts *req)<br>
if (req->has_manage_cgroups)<br>
opts.manage_cgroups = req->manage_cgroups ?
CG_MODE_SOFT : CG_MODE_IGNORE;<br>
<br>
+ /* Override the manage_cgroup if mode is set
explicitly */<br>
+ if (req->has_manage_cgroups_mode) {<br>
+ opts.manage_cgroups =
req->manage_cgroups_mode;<br>
+<br>
if (req->has_auto_ext_mnt)<br>
opts.autodetect_ext_mounts =
req->auto_ext_mnt;<br>
<br>
diff --git a/lib/criu.c b/lib/criu.c<br>
index 3c194a1..90f909f 100644<br>
--- a/lib/criu.c<br>
+++ b/lib/criu.c<br>
@@ -375,6 +375,17 @@ void criu_set_manage_cgroups(bool
manage)<br>
criu_local_set_manage_cgroups(global_opts, manage);<br>
}<br>
<br>
+void criu_local_set_manage_cgroups_mode(criu_opts
*opts, unsigned int mode)<br>
+{<br>
+ opts->rpc->has_manage_cgroups_mode = true;<br>
+ opts->rpc->manage_cgroups_mode = mode;<br>
+}<br>
+<br>
+void criu_set_manage_cgroups_mode(unsigned int mode)<br>
+{<br>
+ criu_local_set_manage_cgroups_mode(global_opts,
mode);<br>
+}<br>
+<br>
void criu_local_set_auto_ext_mnt(criu_opts *opts, bool
val)<br>
{<br>
opts->rpc->has_auto_ext_mnt = true;<br>
diff --git a/lib/criu.h b/lib/criu.h<br>
index 3cb0322..169b9e3 100644<br>
--- a/lib/criu.h<br>
+++ b/lib/criu.h<br>
@@ -67,6 +67,7 @@ void criu_set_log_file(char
*log_file);<br>
void criu_set_cpu_cap(unsigned int cap);<br>
void criu_set_root(char *root);<br>
void criu_set_manage_cgroups(bool manage);<br>
+void criu_set_manage_cgroups_mode(unsigned int mode);<br>
void criu_set_auto_ext_mnt(bool val);<br>
void criu_set_ext_sharing(bool val);<br>
void criu_set_ext_masters(bool val);<br>
@@ -166,6 +167,7 @@ void
criu_local_set_log_file(criu_opts *opts, char
*log_file);<br>
void criu_local_set_cpu_cap(criu_opts *opts, unsigned
int cap);<br>
void criu_local_set_root(criu_opts *opts, char *root);<br>
void criu_local_set_manage_cgroups(criu_opts *opts,
bool manage);<br>
+void criu_local_set_manage_cgroups_mode(criu_opts
*opts, unsigned int mode);<br>
void criu_local_set_auto_ext_mnt(criu_opts *opts, bool
val);<br>
void criu_local_set_ext_sharing(criu_opts *opts, bool
val);<br>
void criu_local_set_ext_masters(criu_opts *opts, bool
val);<br>
diff --git a/protobuf/rpc.proto b/protobuf/rpc.proto<br>
index 2f4d0c0..779898a 100644<br>
--- a/protobuf/rpc.proto<br>
+++ b/protobuf/rpc.proto<br>
@@ -60,20 +60,21 @@ message criu_opts {<br>
repeated string exec_cmd = 22;<br>
<br>
repeated ext_mount_map ext_mnt = 23;<br>
- optional bool manage_cgroups = 24;<br>
- repeated cgroup_root cg_root = 25;<br>
+ optional bool manage_cgroups = 24; /*
backward compatibility */<br>
+ optional uint32
manage_cgroups_mode = 25;<br>
+ repeated cgroup_root cg_root = 26;<br>
<br>
- optional bool rst_sibling = 26; /*
swrk only */<br>
- repeated inherit_fd inherit_fd = 27; /*
swrk only */<br>
+ optional bool rst_sibling = 27; /*
swrk only */<br>
+ repeated inherit_fd inherit_fd = 28; /*
swrk only */<br>
<br>
- optional bool auto_ext_mnt = 28;<br>
- optional bool ext_sharing = 29;<br>
- optional bool ext_masters = 30;<br>
+ optional bool auto_ext_mnt = 29;<br>
+ optional bool ext_sharing = 30;<br>
+ optional bool ext_masters = 31;<br>
<br>
- repeated string skip_mnt = 31;<br>
- repeated string enable_fs = 32;<br>
+ repeated string skip_mnt = 32;<br>
+ repeated string enable_fs = 33;<br>
<br>
- repeated unix_sk unix_sk_ino =
33;<br>
+ repeated unix_sk unix_sk_ino =
34;<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
You should not change numbers for existing fields, as it will break
backward compatibilty.<br>
Just add manage_cgroups_mode field last, with the next available
field number(i.e. 34).<br>
<br>
<blockquote
cite="mid:CAPd85sKn0E4n93m3Y4+OptkBLM_bgEtfG4-tqkqcw7Hoyja-3A@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>
<div> }<br>
<br>
message criu_dump_resp {<br>
-- <br>
1.9.1<br>
<br>
<br>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
<br>
Thanks,<br>
Ruslan<br>
</body>
</html>