mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-08-03 07:12:48 +00:00
cr: Fix namespaces restore from older images
In old images we had no clue whether the root task is to be created in new namespaces. Remember using the --namespaces option for explicitl specification of this fact. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
ac845bd1d8
commit
792bf0c494
2 changed files with 13 additions and 5 deletions
13
image.c
13
image.c
|
|
@ -36,12 +36,15 @@ int check_img_inventory(void)
|
|||
fdinfo_per_id = he->has_fdinfo_per_id ? he->fdinfo_per_id : false;
|
||||
|
||||
ret = he->img_version;
|
||||
root_ids = xmalloc(sizeof(*root_ids));
|
||||
if (!root_ids)
|
||||
return -1;
|
||||
|
||||
memcpy(root_ids, he->root_ids, sizeof(*root_ids));
|
||||
inventory_entry__free_unpacked(he, NULL);
|
||||
if (he->root_ids) {
|
||||
root_ids = xmalloc(sizeof(*root_ids));
|
||||
if (!root_ids)
|
||||
return -1;
|
||||
|
||||
memcpy(root_ids, he->root_ids, sizeof(*root_ids));
|
||||
inventory_entry__free_unpacked(he, NULL);
|
||||
}
|
||||
|
||||
if (ret != CRTOOLS_IMAGES_V1) {
|
||||
pr_err("Not supported images version %u\n", ret);
|
||||
|
|
|
|||
|
|
@ -284,6 +284,11 @@ int check_ns_ids(struct pstree_item *item)
|
|||
struct pstree_item *p = item->parent;
|
||||
|
||||
if (!p) {
|
||||
if (!root_ids) {
|
||||
current_ns_mask = opts.rst_namespaces_flags;
|
||||
return 0;
|
||||
}
|
||||
|
||||
current_ns_mask = get_clone_mask(item->ids, root_ids);
|
||||
pr_info("Will restore in %lx namespaces\n", current_ns_mask);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue