Commit Graph

138 Commits

Author SHA1 Message Date
Derek McGowan
68d3c77eae
Open snapshot database only once
Prevents having multiple database connections open to a connection,
preventing bugs with locking by relying on the boltdb database
object to handle synchronization rather than file locking.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-02 10:32:13 -07:00
Michael Crosby
1d298c89a4 Fix windows lint issues and enable ci
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-25 16:15:45 -04:00
Michael Crosby
b6e0c4f321 Fix go lint errors
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-25 15:26:44 -04:00
Michael Crosby
5fd0415985 Add comments and fix common lint issues
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-20 13:19:14 -04:00
yanxuean
d8d1209e50 a typo in comment of Snapshotter.Update
containerd/snapshot/snapshotter.go

Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
2017-10-16 19:36:27 +08:00
Stephen J Day
8508e8252b
plugin: refactor plugin system to support initialization reporting
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-10-10 16:40:47 -07:00
Derek McGowan
447a0a9452
Add children bucket to back reference snapshots
Adds back links from parent to children in order to prevent
deletion of a referenced snapshot in a namespace.
Avoid removing snapshot during metadata delete to
prevent shared namespaces from being mistakenly deleted.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-10-04 11:16:22 -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
Kunal Kushwaha
8442e4bbe3 Testcase added for Moving files in snapshot layers
Movement of files/folder from base layer to folder in
new layer should be allowed

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2017-09-12 10:05:32 +09:00
Kunal Kushwaha
b6fb234142 Testcase added for deletion of files in lower layer
Files/folders deleted in lower layer and commited,
 it should not reflect on upper layer

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2017-09-07 13:34:33 +09:00
Kunal Kushwaha
121d337713 Added testcase Removal of intermediate snapshot
Removal of intermediate snapshot layer must fail.

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2017-09-07 13:31:04 +09:00
Derek McGowan
887f97f2ff Merge pull request #1463 from stevvooe/switch-snapshot-kind
snapshot: use switch to parse snapshot.Kind
2017-09-05 12:44:57 -07:00
Stephen J Day
1c31199797
snapshot: use switch to parse snapshot.Kind
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-09-05 11:04:15 -07:00
Akihiro Suda
a560e5e0ef mount: fix read-only bind (#1368)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-09-04 04:44:56 +00:00
Akihiro Suda
525bffd194 snapshot: support JSON marshalling for Info
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-09-01 04:47:35 +00:00
Derek McGowan
96a75ab1ab
Move detach flags to platform specific
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-22 17:20:25 -07:00
Derek McGowan
f74cea71dd
Update basic test to allow being run in parallel on client
The basic test does an assert on the existing snapshots.
Update the check just to assert the expected snapshots were
found during the walk.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-22 17:14:06 -07:00
Derek McGowan
750771f6d0
Remove snapshot test suite as a parallel test runner
The testsuite alters global state by setting the umask, avoid
running the testsuite in parallel and move umask manipulation
to the test suite level to individual tests may run in parallel.

Added better error messaging and handling.

Removed reliance on testing object for handling cleanup failure.
When a cleanup error occurred, it would fail the test but the log
would get skipped. With this change the failure will show up for
the running test.

Update test unmounting to set the detach flag, avoiding races with
btrfs which may see the device as busy when attempting to unmount.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-22 16:29:17 -07:00
Derek McGowan
502734116d
Update loopback to return error
Avoid calling testing function in creation closure since the
context may no longer be valid.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-22 16:09:38 -07:00
Phil Estes
240a7be607 Merge pull request #1371 from dmcgowan/btrfs-test-errors
Update mount creation to only use btrfs subvolume id
2017-08-17 11:36:25 -04:00
Michael Crosby
73ac66eecf Merge pull request #1352 from ijc/userns
correct container "/" ownership with userns
2017-08-16 16:09:44 -04:00
Derek McGowan
0e28f2c76e
Update mount creation to only use btrfs subvolume id
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-16 13:00:54 -07:00
Ian Campbell
ebafab47ca correct container "/" ownership with userns
Previously "`/`" in a container was always owned by `root:root` (0/0), even if
`withRemappedSnapshot` had been used. Meaning that if `withUserNamespace` is
used then `/` can be remapped to `nobody:nogroup` (65534/65534).

The fix is is twofold:

- incrementFS should operate on the root of the tree.
- when creating a new snapshot we must propagate the ownership of the topmost
  "lower" directory into the new "upper".

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-08-16 19:55:55 +01:00
Kenfe-Mickael Laventure
eb0970bbd1
Mark relevant tests as elligible for parallelism
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-14 14:43:43 -07:00
Michael Crosby
29a4dd7f46 Merge pull request #1276 from dmcgowan/snapshot-labels
Snapshot labels
2017-08-08 21:59:28 -04:00
Michael Crosby
2fb2168bae Merge pull request #1224 from epilatow/solaris.cc.20170719.0
Add solaris build support
2017-08-07 16:15:07 -04:00
Edward Pilatowicz
56c1f5c184 Add solaris build support
Signed-off-by: Edward Pilatowicz <edward.pilatowicz@oracle.com>
2017-08-07 12:40:21 -07:00
Kenfe-Mickael Laventure
829845d268
Fix ineffassign warnings
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-03 08:27:15 -07:00
Derek McGowan
be36d26eb1
Update windows snapshotter
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-02 16:32:52 -07:00
Derek McGowan
24783b9e11
Add snapshot test suite for update
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-02 16:28:42 -07:00
Derek McGowan
7d3a1e7737
Add snapshot labels
Update snapshot storage to use boltdb keys instead of protobuf.
Add update function to snapshotter to allow updating labels.
Add option type for creating snapshots to allow setting labels.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-02 15:57:31 -07:00
Derek McGowan
d28126f05d
Handle kernel related ci failure
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-28 13:45:51 -07:00
Derek McGowan
a7c44f0038
Add snapshot test cases for former issues
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-28 13:37:38 -07:00
Stephen Day
1679727648 Merge pull request #1230 from dmcgowan/snapshot-client-testsuite
snapshot: run test suite for metadata and client implementations
2017-07-27 15:49:17 -07:00
Michael Crosby
a0a5cc7787 Add user namespace support to client
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-27 11:06:20 -04:00
Derek McGowan
6012f5047d Update storage kind test
Testing proto and snapshot kinds are equivalent when cast to each other.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-25 13:59:16 -07:00
Derek McGowan
da5c72c335 Run snapshot test suite for metadata and client
The snapshot test suite is designed to run against the snapshotter
interface, run the test suite for metadata and client implementations
of the snapshotter interface.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-25 10:47:45 -07:00
Stephen J Day
863784f991
snapshot: replace "readonly" with View snapshot type
What started out as a simple PR to remove the "Readonly" column became an
adventure to add a proper type for a "View" snapshot. The short story here is
that we now get the following output:

```
$ sudo ctr snapshot ls
ID 									 PARENT 								 KIND
sha256:08c2295a7fa5c220b0f60c994362d290429ad92f6e0235509db91582809442f3 								  	 Committed
testing4								 sha256:08c2295a7fa5c220b0f60c994362d290429ad92f6e0235509db91582809442f3 Active
```

In pursuing this output, it was found that the idea of having "readonly" as an
attribute on all snapshots was redundant. For committed, they are always
readonly, as they are not accessible without an active snapshot. For active
snapshots that were views, we'd have to check the type before interpreting
"readonly". With this PR, this is baked fully into the kind of snapshot. When
`Snapshotter.View` is  called, the kind of snapshot is `KindView`, and the
storage system reflects this end to end.

Unfortunately, this will break existing users. There is no migration, so they
will have to wipe `/var/lib/containerd` and recreate everything. However, this
is deemed worthwhile at this point, as we won't have to judge validity of the
"Readonly" field when new snapshot types are added.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-07-24 16:58:01 -07:00
Andrew Pennebaker
1d2a079f08
update to github.com/sirupsen/logrus v1.0.0
Signed-off-by: Andrew Pennebaker <apennebaker@datapipe.com>
2017-07-21 15:39:14 -07:00
Phil Estes
834cafc2d6 Merge pull request #1206 from AkihiroSuda/improve-btrfs-error
btrfs: improve an error string
2017-07-19 09:56:58 -04:00
fate-grand-order
d3d1987fe0 correct some misspellings to make Go Report more happy
Signed-off-by: Helen <chenjg@harmonycloud.cn>
2017-07-19 17:31:14 +08:00
Akihiro Suda
e76357cb57 btrfs: improve an error string
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-07-19 04:09:42 +00:00
Derek McGowan
97bb760c2a
Create btrfs directory if it does not exist
We may want to create this as a subvolume if the parent is btrfs
or support mounting on load in the future.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-07-12 11:30:39 -07:00
Akihiro Suda
60e1557b21 checkSnapshotterBasic: fix umount
The "nextnext" snapshot is being removed at the end of the function.
So umount is needed before removing the snapshot.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-07-11 08:05:21 +00:00
Derek McGowan
4ba4f3a1d5
Add namespaced snapshotter implementation
The namespaced snapshotter wraps an existing snapshotter and
enforces namespace.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-06-29 16:16:26 -07:00
Derek McGowan
7ddf411ea8
Revert "snapshot/storage: namespace snapshot drivers"
This reverts commit b1a70aa335.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-06-29 15:32:07 -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
Michael Crosby
99160a7ac0 Merge pull request #854 from AkihiroSuda/lookup-mountinfo
mountinfo: add Lookup for ease of implementing snapshotters
2017-06-22 20:14:39 -07:00
Michael Crosby
94e7f8e943 Setup plugin ids and dependencies
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-06-14 16:17:20 -07:00
Stephen J Day
b1a70aa335
snapshot/storage: namespace snapshot drivers
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-06-08 12:29:26 -07:00