[Lxc-users] lxc-clone -s -B lvm, deletes original lv if no space left!
Serge Hallyn
serge.hallyn at ubuntu.com
Tue Jun 18 16:09:02 UTC 2013
Quoting zoolook (nbensa+lxcusers at gmail.com):
> 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;
Uh, yeah. I did :)
> 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.
Great, I'm setting up a test vm for it, then will push it out. Thanks!
Though, I'm currently trying to reproduce with the lxc in ubuntu-lxc
saucy ppa, and failing. It's not deleting the original lv for me. I
just see:
serge at ubuntu:~$ sudo lxc-clone -o x1 -n x2
Volume group "lxc" has insufficient free space (559 extents): 2097 required.
lxc: Error creating new lvm blockdev
lxc: failed getting pathnames for cloned storage: /dev/lxc/x1
lxc: error copying storage
clone failed
serge at ubuntu:~$ sudo lvscan
ACTIVE '/dev/lxc/x1' [7.81 GiB] inherit
thanks,
-serge
More information about the lxc-users
mailing list