[CRIU] [PATCH v2 1/6] opts/rpc/lib: add log-dirty option to criu
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Fri May 27 01:01:45 PDT 2016
v2: add help text
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
criu/cr-service.c | 3 +++
criu/crtools.c | 9 +++++++++
criu/include/cr_options.h | 1 +
images/rpc.proto | 1 +
lib/c/criu.c | 11 +++++++++++
lib/c/criu.h | 2 ++
6 files changed, 27 insertions(+)
diff --git a/criu/cr-service.c b/criu/cr-service.c
index 93d146f..8bb20e9 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -474,6 +474,9 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
if (req->has_unshare)
opts.unshare_flags = req->unshare;
+ if (req->has_log_dirty)
+ opts.log_dirty = req->log_dirty;
+
if (req->n_irmap_scan_paths) {
for (i = 0; i < req->n_irmap_scan_paths; i++) {
if (irmap_scan_path_add(req->irmap_scan_paths[i]))
diff --git a/criu/crtools.c b/criu/crtools.c
index 996b3a3..6ca0232 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -323,6 +323,7 @@ int main(int argc, char *argv[], char *envp[])
{ "all", no_argument, 0, 1079 },
{ "cgroup-props", required_argument, 0, 1080 },
{ "cgroup-props-file", required_argument, 0, 1081 },
+ { "log-dirty", no_argument, 0, 1082 },
{ },
};
@@ -630,6 +631,9 @@ int main(int argc, char *argv[], char *envp[])
case 1081:
opts.cgroup_props_file = optarg;
break;
+ case 1082:
+ opts.log_dirty = true;
+ break;
case 'V':
pr_msg("Version: %s\n", CRIU_VERSION);
if (strcmp(CRIU_GITID, "0"))
@@ -950,6 +954,11 @@ int main(int argc, char *argv[], char *envp[])
" pages images of previous dump\n"
" when used on restore, as soon as page is restored, it\n"
" will be punched from the image.\n"
+" --log-dirty when used with predump it will save the dirty memory log to\n"
+" dirty-log image while doing memory pages transfer; this log\n"
+" will collect values of total memory dirtyed by transfered\n"
+" program in time intervals since unfreeze, intervals depend\n"
+" on size of total memory of programm\n"
"\n"
"Page/Service server options:\n"
" --address ADDR address of server or service\n"
diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h
index e36c362..9438acd 100644
--- a/criu/include/cr_options.h
+++ b/criu/include/cr_options.h
@@ -111,6 +111,7 @@ struct cr_options {
unsigned int timeout;
unsigned int empty_ns;
bool lazy_pages;
+ bool log_dirty;
};
extern struct cr_options opts;
diff --git a/images/rpc.proto b/images/rpc.proto
index 0bd4ef7..605db9c 100644
--- a/images/rpc.proto
+++ b/images/rpc.proto
@@ -98,6 +98,7 @@ message criu_opts {
optional uint32 empty_ns = 38;
repeated join_namespace join_ns = 39;
optional uint32 unshare = 40;
+ optional bool log_dirty = 41;
}
message criu_dump_resp {
diff --git a/lib/c/criu.c b/lib/c/criu.c
index 52d1b61..53a8d21 100644
--- a/lib/c/criu.c
+++ b/lib/c/criu.c
@@ -196,6 +196,17 @@ void criu_set_auto_dedup(bool auto_dedup)
criu_local_set_auto_dedup(global_opts, auto_dedup);
}
+void criu_local_set_log_dirty(criu_opts *opts, bool log_dirty)
+{
+ opts->rpc->has_log_dirty = true;
+ opts->rpc->log_dirty = log_dirty;
+}
+
+void criu_set_log_dirty(bool log_dirty)
+{
+ criu_local_set_log_dirty(global_opts, log_dirty);
+}
+
void criu_local_set_force_irmap(criu_opts *opts, bool force_irmap)
{
opts->rpc->has_force_irmap = true;
diff --git a/lib/c/criu.h b/lib/c/criu.h
index 0898be0..bb3bdb3 100644
--- a/lib/c/criu.h
+++ b/lib/c/criu.h
@@ -89,6 +89,7 @@ int criu_add_enable_fs(char *fs);
int criu_add_skip_mnt(char *mnt);
void criu_set_ghost_limit(unsigned int limit);
int criu_add_irmap_path(char *path);
+void criu_set_log_dirty(bool log_dirty);
/*
* The criu_notify_arg_t na argument is an opaque
@@ -191,6 +192,7 @@ 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);
+void criu_local_set_log_dirty(criu_opts *opts, bool log_dirty);
void criu_local_set_notify_cb(criu_opts *opts, int (*cb)(char *action, criu_notify_arg_t na));
--
2.5.5
More information about the CRIU
mailing list