Merge lp://staging/~mvo/snappy/snappy-snapfs-mount into lp://staging/~snappy-dev/snappy/snappy-moved-to-github

Proposed by Michael Vogt
Status: Needs review
Proposed branch: lp://staging/~mvo/snappy/snappy-snapfs-mount
Merge into: lp://staging/~snappy-dev/snappy/snappy-moved-to-github
Prerequisite: lp://staging/~mvo/snappy/snappy-snapfs-install-via-unpack
Diff against target: 948 lines (+411/-134)
11 files modified
debian/ubuntu-snappy-cli.dirs (+1/-0)
dirs/dirs.go (+2/-0)
pkg/clickdeb/deb.go (+29/-23)
pkg/file.go (+81/-0)
pkg/snapfs/snapfs.go (+47/-22)
pkg/snapfs/snapfs_test.go (+0/-9)
snappy/pkgformat.go (+0/-64)
snappy/snapp.go (+73/-5)
snappy/snapp_snapfs_test.go (+93/-11)
systemd/systemd.go (+46/-0)
systemd/systemd_test.go (+39/-0)
To merge this branch: bzr merge lp://staging/~mvo/snappy/snappy-snapfs-mount
Reviewer Review Type Date Requested Status
Gustavo Niemeyer Approve
John Lenton (community) Approve
Review via email: mp+273883@code.staging.launchpad.net

Description of the change

Add support to (auto)mount the snapfs based snaps. It will unpack the meta-data to disk (to speedup snappy list etc) but keep the rest in the squashfs blob and (auto)mount at runtime.

This is a bit of a RFC branch, I'm not yet super happy about it. It will put the blob into
  /apps/$pkg/$version/blob.snap
and will mount that to:
  /apps/$pkg/$version/run

The downside of this approach is of course that the binary/service paths of the deb backend and the squashfs backend are no longer identical which makes the code that writes that a bit ugly.

I think we have three option and would love to get feedback which one is best:
 1. keep it like its done in this branch given and cleanup once the clickdeb backend is killed
 2. change deb backend to write the actual (non-meta) data to "run/" as well
 3. put the blob.snap as "/apps/$pkg/$pkg_$version.snap" and auto-mount it to /apps/$pkg/$version
    (which complicates the removal a bit because its no longer enough to just rm -rf the /apps/$pkg/$version dir)

To post a comment you must log in.
Revision history for this message
John Lenton (chipaca) wrote :

4. put the .snap in /var/snappy/blobs?

Revision history for this message
John Lenton (chipaca) wrote :

*/var/lib/snappy/blobs i meant. But /var/lib/snappy/snaps is probably better.

A small complication of remove and purge, but other than that it'd work, right?

Revision history for this message
John Lenton (chipaca) :
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks John! So with /var/lib/snappy/snaps we would setup the automount unit to mount /apps/$name/$ver - this would mean that a "snappy list" would always automount the snaps. My current approach was to only mount them when they are used and unpack the meta/* only. But maybe thats premature optimization(?).

Revision history for this message
John Lenton (chipaca) wrote :

I think it might be. Let me tinker with list a bit tomorrow -- i think it can be made to work without loading package.yaml's.

Revision history for this message
John Lenton (chipaca) wrote :

Tinkered now instead.

To make list not load package.yaml's, you'd need to

* move it to husks, or to the rest api. Latter needs doing anyway; former would be short-term quick if needed.

* add a concreter that knew about squashfs:
 - `IsInstalled` checks for presence of blob instead of package.yaml
 - `Load` loaded a RemoteSnapPart from the locally-stored remote manifest. Would be missing InstalledSize, which list doesn't output. Would probably mean moving RemoteSnapPart to its own package (\o/)

If doing it via the REST API, /1.0/packages would need to recover the ?sources=local option, and an additional flag to tell it to do things this way. Piece of cake.

So, I'd suggest do it the clean way, mounting to /$type/$name/$ver (i think we agree it's the clean way?). Then we benchmark and decide whether to do the above now, or later.

HTH,

754. By Michael Vogt

merged lp:snappy

755. By Michael Vogt

refactor and get rid of runPrefix

Revision history for this message
Michael Vogt (mvo) wrote :

Thanks, I pondered over this too and I like the approach of /var/lib/snappy/snaps and that we can use husks^Wleightweight to introspect without the full mount dance. I will update the MP accordingly.

756. By Michael Vogt

ensure removal removes the snapfs and refactor

757. By Michael Vogt

update comments

758. By Michael Vogt

unmount after deactivate

Revision history for this message
Michael Vogt (mvo) wrote :

A new look would be welcome :)

759. By Michael Vogt

improve comments

Revision history for this message
John Lenton (chipaca) wrote :

Some comments.

Need to iterate the review a little.

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

I can't beat Chipaca on reviews but I did manage to add a bite of a comment that is not a problem today but will avoid headaches later. It is an 'if you want to do this' type of comment.

Good work

760. By Michael Vogt

address review comments

761. By Michael Vogt

refactor and ove MountUnit handling to systemd package

762. By Michael Vogt

add more tests

763. By Michael Vogt

add comment about little endian squashfs

Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for the review! I addressed the comemnts, please let me know if its sufficient.

Revision history for this message
John Lenton (chipaca) :
764. By Michael Vogt

pkg/snapfs/snapfs.go: use filepath.Clean() in BlobPath

Revision history for this message
Michael Vogt (mvo) wrote :

Thanks! Adressing more stuff.

Revision history for this message
John Lenton (chipaca) wrote :

This looks good enough, now :)

review: Approve
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

I'm adding a few comments below. Please feel free to merge this once you're personally happy about it.

review: Approve
Revision history for this message
John Lenton (chipaca) :
765. By Michael Vogt

merged lp:snappy

766. By Michael Vogt

use properly terminated sentences (thanks gustavo)

767. By Michael Vogt

more documenation and improve error reporting (thanks Gustavo)

Revision history for this message
Michael Vogt (mvo) wrote :

Thanks Gustavo for this excellent review. I started fixing some of the outlined issues and it looks like I'm running out of time. I will continue later but be assured that I will address every point in the review :)

Unmerged revisions

767. By Michael Vogt

more documenation and improve error reporting (thanks Gustavo)

766. By Michael Vogt

use properly terminated sentences (thanks gustavo)

765. By Michael Vogt

merged lp:snappy

764. By Michael Vogt

pkg/snapfs/snapfs.go: use filepath.Clean() in BlobPath

763. By Michael Vogt

add comment about little endian squashfs

762. By Michael Vogt

add more tests

761. By Michael Vogt

refactor and ove MountUnit handling to systemd package

760. By Michael Vogt

address review comments

759. By Michael Vogt

improve comments

758. By Michael Vogt

unmount after deactivate

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches