[lxc-devel] [PATCH] snapshots: move snapshot directory (v5)

S.Çağlar Onur caglar at 10ur.org
Sun Jun 1 00:11:59 UTC 2014


On Fri, May 30, 2014 at 11:54 PM, S.Çağlar Onur <caglar at 10ur.org> wrote:
> On Fri, May 30, 2014 at 6:41 PM, Serge Hallyn <serge.hallyn at ubuntu.com> wrote:
>> Quoting Serge Hallyn (serge.hallyn at ubuntu.com):
>>> Quoting S.Çağlar Onur (caglar at 10ur.org):
>>> > On Wed, May 28, 2014 at 8:32 PM, S.Çağlar Onur <caglar at 10ur.org> wrote:
>>> > > Hi Serge,
>>> > >
>>> > > On Tue, May 27, 2014 at 5:24 PM, Serge Hallyn <serge.hallyn at ubuntu.com> wrote:
>>> > >> Originally we kept snapshots under /var/lib/lxcsnaps.  If a
>>> > >> separate btrfs is mounted at /var/lib/lxc, then we can't
>>> > >> make btrfs snapshots under /var/lib/lxcsnaps.
>>> > >>
>>> > >> This patch moves the default directory to /var/lib/lxc/c/snaps.
>>> > >> If /var/lib/lxcsnaps already exists, then we continue to use that.
>>> > >>
>>> > >> add c->destroy_with_snapshots() and c->snapshot_destroy_all()
>>> > >> API methods.  c->snashot_destroy_all() can be triggered from
>>> > >> lxc-snapshot using '-d ALL'.  There is no command to call
>>> > >> c->destroy_with_snapshots(c) as of yet.
>>> > >>
>>> > >> lxclock: use ".$lxcname" for container lock files
>>> > >> that way we can use /run/lock/lxc/$lxcpath/$lxcname/snaps as a
>>> > >> directory when locking snapshots without having to worry about
>>> > >> /run/lock//lxc/$lxcpath/$lxcname being a file.
>>> > >>
>>> > >> destroy: split off a container_destroy
>>> > >> container_destroy() doesn't check for snapshots, so snapshot_rename can
>>> > >> use it.  api_destroy() now does check for snapshots (previously it only
>>> > >> checked for fs - i.e. overlayfs/aufs - snapshots).
>>> > >>
>>> > >> Add destroy to the manpage, as it was previously undocumented.
>>> > >>
>>> > >> Update snapshot testcase accordingly.
>>> > >>
>>> > >> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
>>> > >
>>> > > This version is not cleanly getting applied on top of current master
>>> > > so I ended up modifying the patch locally. I might have introduced a
>>> > > problem or two while doing that cause my tests started to fail with
>>> > > this. Unfortunately I haven't been able to find some time to debug it
>>> > > further. Will try again and catch you on irc tomorrow.
>>> >
>>> > So I found why my tests are failing and my first reaction was blaming
>>> > the Go bindings but then I realized that python bindings are also not
>>> > working. Somehow this patch is causing create to fail and I'm not
>>> > seeing how. Please see below, same thing happens with Go (a file named
>>> > as template argument appears in the directory but nothing else
>>> > happens) but lxc-create works just fine.
>>> >
>>> > [caglar at qop:~/t] pwd
>>> > /home/caglar/t
>>> > [caglar at qop:~/t] sudo lxc-ls
>>> > [caglar at qop:~/t] ls
>>> > [caglar at qop:~/t] sudo python3
>>> > Python 3.4.0 (default, Apr 11 2014, 13:05:11)
>>> > [GCC 4.8.2] on linux
>>> > Type "help", "copyright", "credits" or "license" for more information.
>>> > >>> import lxc
>>> > >>> c = lxc.Container("r")
>>> > >>> c.create("ubuntu")
>>> > True
>>> > >>>
>>> > [caglar at qop:~/t] cat ubuntu
>>> > lxc.network.type = veth
>>> > lxc.network.flags = up
>>> > lxc.network.link = lxcbr0
>>> > lxc.network.hwaddr = 00:16:3e:e6:0b:a0
>>>
>>> Hey,
>>>
>>> ok so I tried to reproduce this just now and couldn't.  Which tree did
>>> you apply this to?  Can you maybe push the result as a git tree?  Before
>>
>> Or, the whole tree I originally was using is at git://github.com/hallyn #snaps5
>
> I was testing this patch on top of current master (head is at
> c83462d56d). I have limited connectivity right now but I'll push it to
> a branch tomorrow and will let you know.

I pushed it to a branch called serge at https://github.com/caglar10ur/lxc

As a sanity check, I started with current master which was working
fine then installed the branch and problem appeared again

[caglar at qop:~] mkdir t
[caglar at qop:~] cd t
/home/caglar/t
[caglar at qop:~/t] sudo lxc-ls
[caglar at qop:~/t] sudo python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lxc
>>> c = lxc.Container("t")
>>> c.create("ubuntu")
Checking cache download in /var/cache/lxc/trusty/rootfs-amd64 ...
Copy /var/cache/lxc/trusty/rootfs-amd64 to /var/lib/lxc/t/rootfs ...
Copying rootfs to /var/lib/lxc/t/rootfs ...
Generating locales...
  en_US.UTF-8... up-to-date
Generation complete.
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
Creating SSH2 ED25519 key; this may take some time ...
update-rc.d: warning: default stop runlevel arguments (0 1 6) do not
match ssh Default-Stop values (none)
invoke-rc.d: policy-rc.d denied execution of start.

Current default time zone: 'America/New_York'
Local time is now:      Sat May 31 20:08:44 EDT 2014.
Universal Time is now:  Sun Jun  1 00:08:44 UTC 2014.


##
# The default user is 'ubuntu' with password 'ubuntu'!
# Use the 'sudo' command to run tasks as root in the container.
##

True
>>>
[caglar at qop:~/t] sudo lxc-destroy -n t

[caglar at qop:~/t] cd /home/caglar/Projects/lxc
[caglar at qop:~/Projects/lxc(serge)] sudo make install
[...]
[caglar at qop:~/Projects/lxc(serge)] cd /home/caglar/t
[caglar at qop:~/t]

[caglar at qop:~/t] sudo lxc-destroy -n t
[caglar at qop:~/t] sudo python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lxc
>>> c = lxc.Container("t")
>>> c.create("ubuntu")
True
>>>
[caglar at qop:~/t] ls
ubuntu
[caglar at qop:~/t] cat ubuntu
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxcbr0
lxc.network.hwaddr = 00:16:3e:35:4e:31
[caglar at qop:~/t]



>>> I was just building from git and had no problems.  This time I
>>> pushed against https://launchpad.net/~ubuntu-lxc/+archive/daily/+files/lxc_1.0.3%2Bmaster%7E20140525-1523-0ubuntu1%7Etrusty.dsc
>>> (which required some twiddling as the ppa appears to be out of date),
>>> but still creation through the api is working fine for me.  Tried
>>> both busybox and ubuntu templates.
>>>
>>> Is it possible that you installed in a way that there are no available
>>> templates (or they are in the wrong place)?  Still doesn't explain
>>> why 'ubuntu' would show up in your current path...
>> _______________________________________________
>> lxc-devel mailing list
>> lxc-devel at lists.linuxcontainers.org
>> http://lists.linuxcontainers.org/listinfo/lxc-devel
>
>
>
> --
> S.Çağlar Onur <caglar at 10ur.org>



-- 
S.Çağlar Onur <caglar at 10ur.org>


More information about the lxc-devel mailing list