Commit Graph

40 Commits

Author SHA1 Message Date
Daniel Nephin
a05e5fd77a restore deferred cleanup in rootfs.init
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-28 13:14:39 -05:00
Daniel Nephin
ee04cfa3f9 Add staticcheck linter
Fix issues with sync.Pool being passed an array and not a pointer.
See https://github.com/dominikh/go-tools/blob/master/cmd/staticcheck/docs/checks/SA6002

Add missing tests for content.Copy

Fix T.Fatal being called in a goroutine

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-28 13:05:30 -05:00
Derek McGowan
7884707c2f
Add reference labels to snapshots and content
Ensure all snapshots and content are referenced on commit and
protected from cleanup.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-10-11 10:42:47 -07:00
Derek McGowan
d9db1d112d
Refactor differ into separate package
Add differ options and package with interface.
Update optional values on diff interface to use options.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-10-11 10:02:29 -07:00
Michael Crosby
451421b615 Comment more packages to pass go lint
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-02 13:54:56 -04:00
Derek McGowan
597d0d76ae
Support simultaneous unpacking of same layer
Prevent unpack failures due to id collision or the need to
wait for another process to finish unpacking. Always attempt
to unpack a layer and handle collisions on commit. Commit
collisions are easily handled as it could be considered the
same as a successful unpack.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-09-06 15:45:31 -07:00
Stephen J Day
4d8f7895e4
Revert "rootfs: remove unused functions"
This reverts commit 4e2337794c.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-09-06 11:00:21 -07:00
Stephen Day
72159bf4a4 Merge pull request #1325 from dmcgowan/diffid-labels
content: commit options
2017-08-14 15:17:37 -07:00
Akihiro Suda
4e2337794c rootfs: remove unused functions
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-08-12 07:08:28 +00:00
Derek McGowan
da34812db6
Update differ to support compressed archives
Differ is updated to set a label for the uncompressed hash
of compressed content. This allows compressed blobs to
be used and looked up for their uncompressed hashes.
Uses commit options to set labels.
Updates rootfs default to create compressed archives.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-11 14:19:04 -07:00
Derek McGowan
4f388e0e27
Add documentation to rootfs functions
Clarifies role of varies rootfs functions as well as their return values.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-12 13:59:17 -07:00
Derek McGowan
fba7463ed3
Add labels and fileters to content
Update list content command to support filters
Add label subcommand to content in dist tool to update labels
Add uncompressed label on unpack

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-12 13:59:17 -07:00
Derek McGowan
5b105f86ce
Fix rootfs error message extra format variable
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-06-29 16:16:26 -07:00
Stephen J Day
a4fadc596b
errdefs: centralize error handling
Now that we have most of the services required for use with containerd,
it was found that common patterns were used throughout services. By
defining a central `errdefs` package, we ensure that services will map
errors to and from grpc consistently and cleanly. One can decorate an
error with as much context as necessary, using `pkg/errors` and still
have the error mapped correctly via grpc.

We make a few sacrifices. At this point, the common errors we use across
the repository all map directly to grpc error codes. While this seems
positively crazy, it actually works out quite well. The error conditions
that were specific weren't super necessary and the ones that were
necessary now simply have better context information. We lose the
ability to add new codes, but this constraint may not be a bad thing.

Effectively, as long as one uses the errors defined in `errdefs`, the
error class will be mapped correctly across the grpc boundary and
everything will be good. If you don't use those definitions, the error
maps to "unknown" and the error message is preserved.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-29 15:00:47 -07:00
Tonis Tiigi
39d55cc498 Fix context package imports
Conflicting with definition of plugin.Differ

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-06-09 10:58:29 -07:00
Michael Crosby
d7af92e00c Move Mount into mount pkg
This moves both the Mount type and mountinfo into a single mount
package.

This also opens up the root of the repo to hold the containerd client
implementation.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-05-22 16:41:12 -07:00
Derek McGowan
3ae69c43d8
Add diff service implementation
Add snapshot subcommand to ctr for creating diffs of RW layers.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-05-16 13:48:53 -07:00
Derek McGowan
098ff94b24
Add snapshot and diff service
Remove rootfs service in place of snapshot service. Adds
diff service for extracting and creating diffs. Diff
creation is not yet implemented. This service allows
pulling or creating images without needing root access to
mount. Additionally in the future this will allow containerd
to ensure extractions happen safely in a chroot if needed.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-05-15 16:50:16 -07:00
Stephen Day
d0c7f13e39 Merge pull request #755 from miaoyq/avoid-creating-snapshots-repeatedly
Avoid creating snapshots repeatedly
2017-04-26 15:02:14 -05:00
Phil Estes
a12b20ebc4 Merge pull request #748 from miaoyq/del-tmpdir
Delete the temporary diractory at the end of the function "ApplyLayer"
2017-04-20 00:10:35 -05:00
Yanqiang Miao
df8ece5a41 Avoid creating snapshots repeatedly
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-04-20 12:59:33 +08:00
Yanqiang Miao
c5c6f36e83 Delete the temporary diractory at the end of the function
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-04-19 09:52:44 +08:00
Yanqiang Miao
d95e98d049 Remove the redundant type conversion
The type of ocispec.Descriptor.Digest is digest.Digest now,
so the type conversion is redundant.

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-04-18 16:55:19 +08:00
Michael Crosby
4f2b443a27 Rewrite imports for new github org
This rewrites the Go imports after switching to the new github org.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-04-03 14:05:44 -07:00
Stephen Day
bb3fbded9c Merge pull request #632 from dmcgowan/rootfs-fixes
Fix rootfs digest computation
2017-03-16 12:04:49 -07:00
Akihiro Suda
6089c1525b new package: compression (ported from docker/pkg/archive)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-03-16 05:29:27 +00:00
Derek McGowan
4492a2cee3
Fix rootfs digest computation
Compute digest from uncompressed archive.
Properly propagate error on unpack.
Rename dist cmd commands to match command name.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-15 17:17:25 -07:00
Derek McGowan
212efa578a
Remove get function from rootfs
The service can use the snapshotter directly to get the rootfs.
Removed debug line for mount response.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-15 16:32:21 -07:00
Derek McGowan
b1bc82726f
Rename prepare to unpack and init to prepare
Unpack and prepare better map to the actions done by rootfs.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-15 16:32:21 -07:00
Derek McGowan
340e56ecd0
Update comments in rootfs and for desciptor
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-15 16:32:21 -07:00
Derek McGowan
5d4577534a
Add init and get mounts to rootfs service
Update rootfs package to add mount initializer function.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-15 16:32:21 -07:00
Derek McGowan
ead425f426
Add rootfs service
Add rootfs service to allow creation of rootfs from layer array

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-03-15 16:32:21 -07:00
Samuel Karp
b471a84885 rootfs: Add context to Prepare
Signed-off-by: Samuel Karp <skarp@amazon.com>
2017-02-26 23:53:29 -08:00
Samuel Karp
4382d553ea snapshot: Add context to Snapshotter interface
Signed-off-by: Samuel Karp <skarp@amazon.com>
2017-02-24 15:23:23 -08:00
Derek McGowan
6443891a7d Update log lines to use containerd log package
Removed unused requires root test function and updated
tar requires function to use lookup method.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-17 11:50:49 -08:00
Derek McGowan
f0a43e72cd Update layer apply to use containerd archive
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-17 11:50:49 -08:00
Derek McGowan
b399634320 Update rootfs to use snapshot interface
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2017-02-16 12:12:41 -08:00
Akihiro Suda
7fed38881d rootfs: fix compilation error
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-01-23 08:54:57 +00:00
Aaron.L.Xu
08bcbddb32 fix typo I found in this repo
Signed-off-by: Aaron.L.Xu <likexu@harmonycloud.cn>
2017-01-20 01:18:26 +08:00
Stephen J Day
460314d667
rootfs: pseudo-implementation of rootfs unpacking
This defines a new package for assembling rootfs with layers and
snapshots. We define some base types and operations that represent the
boiled down process of the unpacking a rootfs.

This code is untested but provides a base to work towards a full
implementation of rootfs unpacking.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-01-17 17:05:28 -08:00