Commit Graph

38 Commits

Author SHA1 Message Date
Maksym Pavlenko
6f34da5f80 Cleanup logrus imports
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-05-05 11:54:14 -07:00
Maksym Pavlenko
06e085c8b5 Add Fields type alias to log package
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-02-20 17:29:08 -08:00
Akihiro Suda
52f82acb7b
btrfs: depend on kernel UAPI instead of libbtrfs
See containerd/btrfs PR 40 and moby/moby PR 44761. (Thanks to [@]neersighted.)

The containerd/btrfs library now requires headers from kernel 4.12 or newer:
- https://github.com/torvalds/linux/blob/master/include/uapi/linux/btrfs.h
- https://github.com/torvalds/linux/blob/master/include/uapi/linux/btrfs_tree.h

These files are licensed under the GPL-2.0 WITH Linux-syscall-note, so it should be compatible with the Apache License 2.0.
https://spdx.org/licenses/Linux-syscall-note.html

The dependency on the kernel headers only affects users building from source.
Users on older kernels may opt to not compile this library (`BUILDTAGS=no_btfs`),
or to provide headers from a newer kernel.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-02-10 10:07:34 +09:00
Wei Fu
6b7e237fc7 chore: use go fix to cleanup old +build buildtag
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-12-29 14:25:14 +08:00
iyear
1d0619bc0c Refactor metastore transaction
Signed-off-by: Junyu Liu <ljyngup@gmail.com>
2022-12-28 18:37:28 +08:00
Eng Zer Jun
52d307ac13
test: remove redundant mountPoint
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-03-16 10:01:47 +08:00
Eng Zer Jun
18ec2761c0
test: use T.TempDir to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-03-15 14:03:50 +08:00
haoyun
bbe46b8c43 feat: replace github.com/pkg/errors to errors
Signed-off-by: haoyun <yun.hao@daocloud.io>
Co-authored-by: zounengren <zouyee1989@gmail.com>
2022-01-07 10:27:03 +08:00
haoyun
ac2df3ba9a test: check file content after mount
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-10-09 18:19:34 +08:00
Derek McGowan
3f00006f72
Merge pull request from GHSA-c2h3-6mxw-7mvq
v1 & v2 runtimes: reduce permissions for bundle dir
2021-10-04 08:24:47 -07:00
Derek McGowan
7c621e1fcc
btrfs: reduce permissions on plugin directories
Disallow traversal into directories that may contain
unpacked or mounted image filesystems.

Signed-off-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Samuel Karp <skarp@amazon.com>
2021-09-24 11:57:58 -07:00
Eng Zer Jun
50da673592
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-09-21 09:50:38 +08:00
Sebastiaan van Stijn
2ac9968401
replace uses of os/exec with golang.org/x/sys/execabs
Go 1.15.7 contained a security fix for CVE-2021-3115, which allowed arbitrary
code to be executed at build time when using cgo on Windows. This issue also
affects Unix users who have “.” listed explicitly in their PATH and are running
“go get” outside of a module or with module mode disabled.

This issue is not limited to the go command itself, and can also affect binaries
that use `os.Command`, `os.LookPath`, etc.

From the related blogpost (ttps://blog.golang.org/path-security):

> Are your own programs affected?
>
> If you use exec.LookPath or exec.Command in your own programs, you only need to
> be concerned if you (or your users) run your program in a directory with untrusted
> contents. If so, then a subprocess could be started using an executable from dot
> instead of from a system directory. (Again, using an executable from dot happens
> always on Windows and only with uncommon PATH settings on Unix.)
>
> If you are concerned, then we’ve published the more restricted variant of os/exec
> as golang.org/x/sys/execabs. You can use it in your program by simply replacing

This patch replaces all uses of `os/exec` with `golang.org/x/sys/execabs`. While
some uses of `os/exec` should not be problematic (e.g. part of tests), it is
probably good to be consistent, in case code gets moved around.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-25 18:11:09 +02:00
Akihiro Suda
d3aa7ee9f0
Run go fmt with Go 1.17
The new `go fmt` adds `//go:build` lines (https://golang.org/doc/go1.17#tools).

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-08-22 09:31:50 +09:00
Alakesh Haloi
b996e49c5c Do not run btrfs tests if btrfs kernel module is not loaded
Signed-off-by: Alakesh Haloi <alakeshh@amazon.com>
2021-05-26 13:45:56 -07:00
Shengjing Zhu
074873c68e Add cgo tag to btrfs plugin
btrfs plugin needs CGO support. However on riscv64, cgo
is only support on go1.16 (not released yet).
Instead of setting no_btrfs manually, adding a cgo tag tells
the compiler to skip it automatically.

Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2021-01-23 02:42:57 +08:00
Jian Zeng
a52daa26ae
refactor(btrfs): separate init from implementation
Part of #4513

Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
2020-09-03 19:54:18 +08:00
Jian Zeng
4154235735
feat: make btrfs root_path configurable
Part of #4514

Signed-off-by: Jian Zeng <anonymousknight96@gmail.com>
2020-09-03 19:52:13 +08:00
Sebastiaan van Stijn
dc92ad6520
Replace errors.Cause() with errors.Is()
Dependencies may be switching to use the new `%w` formatting
option to wrap errors; switching to use `errors.Is()` makes
sure that we are still able to unwrap the error and detect the
underlying cause.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-08 14:36:45 +02:00
Derek McGowan
66aa1d3ef6
Add snapshot walk implementations
Temporarily remove zfs and aufs until interface update

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-10-24 11:11:22 -07:00
bpopovschi
e8c14c07c6
Added filters to snapshots API
Signed-off-by: bpopovschi <zyqsempai@mail.ru>
2019-10-24 11:11:22 -07:00
Derek McGowan
772032598a
Fix flaky btrfs test
Add logging and move the creation of the snapshotter inside
the attempt loop to catch cases where the mountinfo may
not be updated yet. When all attempts are reached there
is no reason to create the snapshotter as the unmount has
already occurred.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-10-04 17:51:45 -07:00
Michael Crosby
c5821baa41 Sync and stat btrfs loopback in tests
Fixes #3676

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-09-25 15:40:16 -04:00
Derek McGowan
5a0ff41c81
Update continuity vendor
Pulls in copy and fstest changes

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-08-16 15:49:47 -07:00
Michael Crosby
16aaf6c065 Change unsupported snapshot warnings to INFO
Since there is no real action the user can do, these can safely be
informative that the underlying filesystem does not support a snapshot
plugin at boot.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-10-26 12:44:14 -04:00
Akihiro Suda
5349fa31df remove pkg/testutil/loopback_linux.go and use continuity/testutil/loopback
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-10-02 13:12:25 +09:00
Michael Wan
92243ff72a bugfix: updatedAt timestamp file may be empty
Signed-off-by: Michael Wan <zirenwan@gmail.com>
2018-08-29 21:49:40 -04:00
Rolf Neugebauer
651920405e test: Increase btrfs loopback device size to 128MB
With btrfs-prog 4.17 as shipped with Alpine 3.8 the btrfs tests
fail with:

  ERROR: '/dev/loop1' is too small to make a usable filesystem
  ERROR: minimum size for each btrfs device is 114294784

btrfs-prog commit 997f9977c243 ("btrfs-progs: mkfs: Prevent
temporary system chunk to use space in reserved 1M range")
changed the code to compute the minimum size for a btrfs size
and is the likely reason for this error.

Increase the size of the loop back device to 128MB for
the btrfs test.

With this fix, the containerd tests pass on Alpine 3.8,
tested in LinuxKit with kernel 4.14.53.

fixes #2447

Signed-off-by: Rolf Neugebauer <rolf.neugebauer@gmail.com>
2018-07-08 10:53:03 +01:00
Michael Crosby
009ba4d797 Move testutils to pkg
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-05-22 17:08:38 -04:00
Kunal Kushwaha
b12c3215a0 Licence header added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-02-19 10:32:26 +09:00
Christopher Jones
6e3701141b
[testing] use smaller filesize on 4KB pagesize systems
Use a smaller filesize on systems that have a default 4KB pagesize.

This is because mkfs.btrfs uses the default system pagesize as blocksize
when creating a device, so if the pagesize is larger, then the file needs
to be larger as well. This larger filesize is needed specifically for
systems where 64KB is default, such as ppc64le.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
2018-02-15 15:33:46 -06:00
Brian Goff
c776b6d8d9 Use continuity fs package
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-02-07 12:40:52 -05:00
Christopher Jones
a8c5ff57e5
Cleanup loop devices after test failure
Cleans up loop devices if part of the test or mount process fails.

Also increases btrfs default file size to 650MB to accommodate
minimum btrfs size on ppc64le and s390x

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
2018-01-30 14:44:36 -05:00
Christopher Jones
051ac5dd63
running tests in a container
This provides a dockerfile for building a container to run the containerd tests

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
2018-01-30 14:44:30 -05:00
Stephen Day
9570174ba9
Merge pull request #1871 from dmcgowan/btrfs-usage
Implement btrfs usage
2017-12-04 17:37:30 -08:00
Derek McGowan
3bc4e69ba1
Implement btrfs usage
Implements btrfs usage using a double walking diff and
counting the result. Walking gives the most accurate
count and includes inode usage.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-12-04 14:42:21 -08:00
Derek McGowan
b28d7cdf1b
Update snapshot and content related log messages
Make the tense and casing consistent.
Add useful log messages in image service.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-12-01 14:57:34 -08:00
Jess Valarezo
9885edfc44 rename snapshot->snapshots pkg
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-29 14:55:02 -08:00