From 8869eb5f8358b61f3e9e2cf7540311dc46fb4b4e Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Tue, 5 Apr 2016 20:43:02 +0200 Subject: [PATCH] set lxc.rootfs.backend on copy/snapshot as well Signed-off-by: Christian Brauner --- src/lxc/lxccontainer.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 29cbd330c..a6003a661 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -2845,6 +2845,8 @@ static int copy_storage(struct lxc_container *c0, struct lxc_container *c, } free(c->lxc_conf->rootfs.path); c->lxc_conf->rootfs.path = strdup(bdev->src); + free(c->lxc_conf->rootfs.bdev_type); + c->lxc_conf->rootfs.bdev_type = strdup(bdev->type); bdev_put(bdev); if (!c->lxc_conf->rootfs.path) { ERROR("Out of memory while setting storage path"); @@ -2856,6 +2858,11 @@ static int copy_storage(struct lxc_container *c0, struct lxc_container *c, ERROR("Error saving new rootfs to cloned config"); return -1; } + clear_unexp_config_line(c->lxc_conf, "lxc.rootfs.backend", false); + if (!do_append_unexp_config_line(c->lxc_conf, "lxc.rootfs.backend", c->lxc_conf->rootfs.bdev_type)) { + ERROR("Error saving new rootfs to cloned config"); + return -1; + } if (flags & LXC_CLONE_SNAPSHOT) copy_rdepends(c, c0); if (need_rdep) { -- 2.47.2