mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 14:25:49 +00:00
Add ability to restore with missing sysctls on the target node
Do it through new --weak-sysctls option to "criu restore". When we migrate from source with newer kernel with some modern sysctl to destination with older kernel without it or just with a kernel configured without it (e.g. no CONFIG_IPV6_ROUTER_PREF), we face a problem that not all of dumped sysctls can be successfuly restored on the destination. So to address these problem introduce weak sysctls migration, where we restore only available sysctls and skip others. https://github.com/xemul/criu/issues/248 While on it, fix workaround for stable_secret eio skip. travis-ci: success for Add ability to restore with missing sysctls on the target node Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
26ccb06a74
commit
22140b97c9
@@ -281,6 +281,7 @@ int main(int argc, char *argv[], char *envp[])
|
||||
{ SK_INFLIGHT_PARAM, no_argument, 0, 1083 },
|
||||
{ "deprecated", no_argument, 0, 1084 },
|
||||
{ "display-stats", no_argument, 0, 1086 },
|
||||
{ "weak-sysctls", no_argument, 0, 1087 },
|
||||
{ },
|
||||
};
|
||||
|
||||
@@ -596,6 +597,10 @@ int main(int argc, char *argv[], char *envp[])
|
||||
case 1086:
|
||||
opts.display_stats = true;
|
||||
break;
|
||||
case 1087:
|
||||
pr_msg("Will skip non-existant sysctls on restore\n");
|
||||
opts.weak_sysctls = true;
|
||||
break;
|
||||
case 'V':
|
||||
pr_msg("Version: %s\n", CRIU_VERSION);
|
||||
if (strcmp(CRIU_GITID, "0"))
|
||||
@@ -814,6 +819,9 @@ usage:
|
||||
" --exec-cmd execute the command specified after '--' on successful\n"
|
||||
" restore making it the parent of the restored process\n"
|
||||
" --freeze-cgroup use cgroup freezer to collect processes\n"
|
||||
" --weak-sysctls silently skip restoring sysctl if it is not available,\n"
|
||||
" these helps to overcome problems with restore on older\n"
|
||||
" kernel or with some kernel configuration disabled\n"
|
||||
"\n"
|
||||
"* External resources support:\n"
|
||||
" --external RES dump objects from this list as external resources:\n"
|
||||
|
@@ -116,6 +116,7 @@ struct cr_options {
|
||||
*/
|
||||
bool deprecated_ok;
|
||||
bool display_stats;
|
||||
bool weak_sysctls;
|
||||
};
|
||||
|
||||
extern struct cr_options opts;
|
||||
|
@@ -185,6 +185,9 @@ static int net_conf_op(char *tgt, SysctlEntry **conf, int n, int op, char *proto
|
||||
if (n > size)
|
||||
pr_warn("The image contains unknown sysctl-s\n");
|
||||
|
||||
if (opts.weak_sysctls)
|
||||
flags = CTL_FLAGS_OPTIONAL;
|
||||
|
||||
rconf = xmalloc(sizeof(SysctlEntry *) * size);
|
||||
if (!rconf)
|
||||
return -1;
|
||||
@@ -216,6 +219,7 @@ static int net_conf_op(char *tgt, SysctlEntry **conf, int n, int op, char *proto
|
||||
|
||||
snprintf(path[i], MAX_CONF_OPT_PATH, CONF_OPT_PATH, proto, tgt, devconfs[i]);
|
||||
req[ri].name = path[i];
|
||||
req[ri].flags = flags;
|
||||
switch (conf[i]->type) {
|
||||
case SYSCTL_TYPE__CTL_32:
|
||||
req[ri].type = CTL_32;
|
||||
@@ -228,7 +232,7 @@ static int net_conf_op(char *tgt, SysctlEntry **conf, int n, int op, char *proto
|
||||
break;
|
||||
case SYSCTL_TYPE__CTL_STR:
|
||||
req[ri].type = CTL_STR(MAX_STR_CONF_LEN);
|
||||
flags |= op == CTL_READ && !strcmp(devconfs[i], "stable_secret")
|
||||
req[ri].flags |= op == CTL_READ && !strcmp(devconfs[i], "stable_secret")
|
||||
? CTL_FLAGS_READ_EIO_SKIP : 0;
|
||||
|
||||
/* skip non-existing sysctl */
|
||||
@@ -240,7 +244,6 @@ static int net_conf_op(char *tgt, SysctlEntry **conf, int n, int op, char *proto
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
req[ri].flags = flags;
|
||||
rconf[ri] = conf[i];
|
||||
ri++;
|
||||
}
|
||||
|
Reference in New Issue
Block a user