Commit 792bf0c4 authored by Pavel Emelyanov's avatar Pavel Emelyanov

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: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ac845bd1
...@@ -36,12 +36,15 @@ int check_img_inventory(void) ...@@ -36,12 +36,15 @@ int check_img_inventory(void)
fdinfo_per_id = he->has_fdinfo_per_id ? he->fdinfo_per_id : false; fdinfo_per_id = he->has_fdinfo_per_id ? he->fdinfo_per_id : false;
ret = he->img_version; ret = he->img_version;
root_ids = xmalloc(sizeof(*root_ids));
if (!root_ids)
return -1;
memcpy(root_ids, he->root_ids, sizeof(*root_ids)); if (he->root_ids) {
inventory_entry__free_unpacked(he, NULL); 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) { if (ret != CRTOOLS_IMAGES_V1) {
pr_err("Not supported images version %u\n", ret); pr_err("Not supported images version %u\n", ret);
......
...@@ -284,6 +284,11 @@ int check_ns_ids(struct pstree_item *item) ...@@ -284,6 +284,11 @@ int check_ns_ids(struct pstree_item *item)
struct pstree_item *p = item->parent; struct pstree_item *p = item->parent;
if (!p) { if (!p) {
if (!root_ids) {
current_ns_mask = opts.rst_namespaces_flags;
return 0;
}
current_ns_mask = get_clone_mask(item->ids, root_ids); current_ns_mask = get_clone_mask(item->ids, root_ids);
pr_info("Will restore in %lx namespaces\n", current_ns_mask); pr_info("Will restore in %lx namespaces\n", current_ns_mask);
return 0; return 0;
......
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