[Lxc-users] lxc-clone -s -B lvm, deletes original lv if no space left!

zoolook nbensa+lxcusers at gmail.com
Tue Jun 18 16:01:46 UTC 2013


Hello Serge,

On Mon, Jun 17, 2013 at 4:43 PM, Serge Hallyn <serge.hallyn at ubuntu.com> wrote:
>
> Haven't tested, but the following should fix it:
>

Unfortunately, your patch didn't fix it. I put a fprintf in lxcapi_destroy:


        if (r) {
                fprintf(stderr,"!!! removing %s for  %s !!!\n",
c->lxc_conf->rootfs.path, c->name);
                if (r->ops->destroy(r) < 0) {
                        ERROR("Error destroying rootfs for %s", c->name);
                        goto out;
                }
        }


And I get:


sysadmin at lxc0:~/lxc/lxc-0.9.0.0~staging~20130612-1544$ sudo lxc-clone
-s -B lvm -p /srv/lxc -P /srv/lxc -o test1 -n test101
  Volume group "vg_vmstorage" has insufficient free space (617
extents): 2097 required.
lxc: could not create /dev/vg_vmstorage/lxc-test101-root snapshot of
/dev/vg_vmstorage/lxc-test1-root
lxc: failed getting pathnames for cloned storage:
/dev/vg_vmstorage/lxc-test1-root

lxc: error copying storage
!!! removing /dev/vg_vmstorage/lxc-test1-root for  test101 !!!
File descriptor 3 (/run/lock/lxc/srv/lxc/test101) leaked on lvremove
invocation. Parent PID 3784: lxc-clone
  Logical volume "lxc-test1-root" successfully removed
lxc: _recursive_rmdir_onedev: failed to delete /srv/lxc/test101
clone failed


Note that test101 rootfs should be lxc-test101-root, not
lxc-test1-root. So my swag is you meant:

                        c2->lxc_conf->rootfs.path = NULL;

Instead of:

                        c->lxc_conf->rootfs.path = NULL;


Is this correct?

With that small typo (?) fixed, my test now passes, but I'll feel more
confident if you can review it.


Thanks!
Norberto




More information about the lxc-users mailing list