Interrupted lxc-snapshot deletes snapshot *and* vm
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxc (Ubuntu) |
Triaged
|
High
|
Unassigned |
Bug Description
lxc is configured for limited user usage, i.e. the backing store is always "dir". Let's create a container, and snapshot it in its pristine state:
% lxc-create -n restorebug -t download -- -d ubuntu -r utopic -a amd64 && lxc-snapshot -n restorebug
[...]
lxc_container: lxccontainer.c: lxcapi_snapshot: 3011 Snapshot of directory-backed container requested.
lxc_container: lxccontainer.c: lxcapi_snapshot: 3012 Making a copy-clone.
[...]
% ls ~/.local/
.local/
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
.local/
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
Everything went to plan. Now, try restoring the snapshot, and ctrl+c'ing lxc-snapshot while it's running:
% lxc-snapshot -n restorebug -r snap0
[ctrl+c, bang!]
Depending on when you press it, you might get some rsync output, but never anything from the lxc-snapshot command itself. This isn't unexpected, it's probably just copying the snapshot over to the vm, right?! That sounds cancellable. e.g.
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(632) [sender=3.1.1]
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at io.c(504) [generator=3.1.1]
Now, let's run lxc-snapshot again, no need to ctrl+c it:
% lxc-snapshot -n restorebug -r snap0
lxc_container: bdev.c: bdev_copy: 3253 failed to detect blockdev type for ...local/
lxc_container: lxccontainer.c: copy_storage: 2543 Error copying storage
lxc_container: lxccontainer.c: lxcapi_destroy: 2141 Container restorebug has snapshots; not removing
lxc_container: lxc_snapshot.c: do_restore_
% ls -a ~/.local/
.local/
. ..
.local/
. .. config ts
It's deleted both the snapshot, and the original container. Further attempts to run lxc-snapshot give similar errors:
% lxc-snapshot -n restorebug -r snap0
lxc_container: lxccontainer.c: lxcapi_
lxc_container: lxc_snapshot.c: do_restore_
Also reproduced on cleaner utopic server installs, this bug report is from my laptop.
(We hit this on our build server: a typical job is to restore a vm, then run some commands in it. Jobs are cancellable, which just interrupts any running process.)
ProblemType: Bug
DistroRelease: Ubuntu 14.10
Package: lxc 1.1.0~alpha2-
ProcVersionSign
Uname: Linux 3.16.0-29-generic x86_64
ApportVersion: 2.14.7-0ubuntu8
Architecture: amd64
Date: Wed Jan 14 10:11:15 2015
InstallationDate: Installed on 2014-08-01 (165 days ago)
InstallationMedia: Ubuntu 14.04.1 LTS "Trusty Tahr" - Release amd64 (20140722.2)
SourcePackage: lxc
UpgradeStatus: Upgraded to utopic on 2014-09-11 (125 days ago)
defaults.conf:
lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.network.flags = up
lxc.network.hwaddr = 00:16:3e:xx:xx:xx
Thanks, that definately should be fixed if possible.
status: triaged
importance: high