Commit 8c063fd2 authored by Pavel Emelyanov's avatar Pavel Emelyanov

criu: Introduce the --deprecated/CRIU_DEPRECATED option

This is the option that would enable the deprecated (to be removed)
functionality. For convenience it's also possible to set one via
the environment.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent c7e58be7
......@@ -206,6 +206,17 @@ int add_external(char *key)
return 0;
}
bool deprecated_ok(char *what)
{
if (opts.deprecated_ok)
return true;
pr_err("Deprecated functionality (%s) rejected.\n", what);
pr_err("Use the --deprecated option or set CRIU_DEPRECATED environment.\n");
pr_err("For details visit https://criu.org/Deprecation\n");
return false;
}
int main(int argc, char *argv[], char *envp[])
{
pid_t pid = 0, tree_id = 0;
......@@ -279,6 +290,7 @@ int main(int argc, char *argv[], char *envp[])
{ "cgroup-props-file", required_argument, 0, 1081 },
{ "cgroup-dump-controller", required_argument, 0, 1082 },
{ SK_INFLIGHT_PARAM, no_argument, 0, 1083 },
{ "deprecated", no_argument, 0, 1084 },
{ },
};
......@@ -587,6 +599,10 @@ int main(int argc, char *argv[], char *envp[])
pr_msg("Will skip in-flight TCP connections\n");
opts.tcp_skip_in_flight = true;
break;
case 1084:
pr_msg("Turn deprecated stuff ON\n");
opts.deprecated_ok = true;
break;
case 'V':
pr_msg("Version: %s\n", CRIU_VERSION);
if (strcmp(CRIU_GITID, "0"))
......@@ -600,6 +616,11 @@ int main(int argc, char *argv[], char *envp[])
}
}
if (getenv("CRIU_DEPRECATED")) {
pr_msg("Turn deprecated stuff ON via env\n");
opts.deprecated_ok = true;
}
if (check_namespace_opts()) {
pr_msg("Error: namespace flags confict\n");
return 1;
......@@ -674,6 +695,8 @@ int main(int argc, char *argv[], char *envp[])
return 1;
pr_debug("Version: %s (gitid %s)\n", CRIU_VERSION, CRIU_GITID);
if (opts.deprecated_ok)
pr_debug("DEPRECATED ON\n");
if (!list_empty(&opts.inherit_fds)) {
if (strcmp(argv[optind], "restore")) {
......
......@@ -111,6 +111,14 @@ struct cr_options {
unsigned int empty_ns;
bool tcp_skip_in_flight;
char *work_dir;
/*
* When we scheduler for removal some functionality we first
* deprecate it and it sits in criu for some time. By default
* the deprecated stuff is not working, but it's still possible
* to turn one ON while the code is in.
*/
bool deprecated_ok;
};
extern struct cr_options opts;
......
......@@ -15,7 +15,7 @@ extern int check_img_inventory(void);
extern int write_img_inventory(InventoryEntry *he);
extern int prepare_inventory(InventoryEntry *he);
extern int add_post_prepare_cb(int (*actor)(void *data), void *data);
extern bool deprecated_ok(char *what);
extern int cr_dump_tasks(pid_t pid);
extern int cr_pre_dump_tasks(pid_t pid);
extern int cr_restore_tasks(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment