[lxc-users] [BUG] lxc-destroy destroying wrong containers
Serge Hallyn
serge.hallyn at ubuntu.com
Thu Nov 12 19:32:39 UTC 2015
Quoting Christian Brauner (christian.brauner at mailbox.org):
> On Tue, 10 Nov 2015 14:19:41 +0900, Tomasz Chmielewski <mangoo at wpkg.org>:
> > lxc-destroy may be destroying wrong containers!
> >
> > To reproduce:
> >
> > 1) have a container you want to clone - here, testvm012d:
> >
> > # lxc-ls -f
> > NAME STATE IPV4
> > IPV6 GROUPS AUTOSTART
> > ---------------------------------------------------------------------------------------------------
> > testvm012d STOPPED -
> > - - NO
> >
> >
> > 2) clone it - but before the command returns, press ctrl+c (say, you
> > realized you used a wrong name and want to interrupt):
> >
> > # lxc-clone -B dir testvm012d testvm13d
> > [ctrl+c]
> >
> >
> > 3) lxc-ls will now show two containers:
> >
> > # lxc-ls -f
> > NAME STATE IPV4
> > IPV6 GROUPS AUTOSTART
> > ---------------------------------------------------------------------------------------------------
> > testvm012d STOPPED -
> > - - NO
> > testvm13d STOPPED -
> > - - NO
> >
> >
> > 4) we can see that the "interrupted" container was not fully copied - let's
> > remove it then with lxc-destroy:
> >
> > # du -sh testvm012d testvm13d
> > 462M testvm012d
> > 11M testvm13d
> >
> > # lxc-destroy -n testvm13d
> >
> > # echo $?
> > 0
> >
> >
> > 5) as expected, lxc-ls only lists the original container now:
> >
> > # lxc-ls -f
> > NAME STATE IPV4
> > IPV6 GROUPS AUTOSTART
> > ---------------------------------------------------------------------------------------------------
> > testvm012d STOPPED -
> > - - NO
> >
> >
> > 6) unfortunately rootfs for the original container is gone:
> >
> > # du -sh testvm012d
> > 4.0K testvm012d
> >
> > # ls testvm012d/
> > config
> This may not have something to do with lxc-destroy but with how clones work. Can
> you only proceed up to step 2) you listed:
>
> > 2) clone it - but before the command returns, press ctrl+c (say, you
> > realized you used a wrong name and want to interrupt):
> >
> > # lxc-clone -B dir testvm012d testvm13d
> > [ctrl+c]
>
> and immediately afterwards check whether the rootfs of the original container
> testvm012d is still present?
Sorry, this was in the deferred queue for some reason, and I just let it through.
Presumably you saw the fix hit the mailing list yesterday.
More information about the lxc-users
mailing list