From: Christian Brauner Date: Tue, 5 Apr 2016 18:43:02 +0000 (+0200) Subject: set lxc.rootfs.backend on copy/snapshot as well X-Git-Tag: lxc-2.0.0~5^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F945%2Fhead;p=thirdparty%2Flxc.git set lxc.rootfs.backend on copy/snapshot as well Signed-off-by: Christian Brauner --- 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) {