Commit Graph

17 Commits

Author SHA1 Message Date
Giuseppe Scrivano ffb4f1504b
overlay: scope ID map contiguity check to mountProgram
The contiguity of ID mappings is a requirement for fuse-overlayfs, do
not impose it for the native kernel driver.

Closes: https://github.com/containers/storage/issues/2345
Closes: https://issues.redhat.com/browse/RHEL-94967

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2025-06-09 09:01:51 +02:00
Han-Wen Nienhuys b1e7c67ba6 drivers/graphtest: make cleanup automatic
Introduce GetDriverNoCleanup to obtain an instance that should survive
individual test cases.

Signed-off-by: Han-Wen Nienhuys <hanwen@engflow.com>
2025-01-28 18:29:43 +01:00
Kir Kolyshkin 83c0c077c5 all: remove old-style +build tags
Brought to you by

	go fix ./...

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-09-19 17:00:48 -07:00
Giuseppe Scrivano e6e9715d73
overlay: simplify test
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-06-18 09:27:50 +02:00
Akihiko Odaki 18136c586b overlay: Test user.fuseoverlayfs.override_stat handling
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
2024-06-11 15:36:10 +09:00
Nalin Dahyabhai d10c03bc3d Extend driver.ListLayers()
Implement ListLayers() for the aufs, btrfs, and devicemapper drivers,
along with a unit test for them.
Stop filtering out directories with names that aren't 64-hex chars in
vfs and overlay ListLayers() implementations, which is more a convention
than a hard rule.
Have layerStore.Wipe() try to remove remaining listed layers after it
removes the layers that the layerStore knew of.
Close() a dangling ReadCloser in NaiveCreateFromTemplate.
Switch from using plain defer to using t.Cleanup() to handle deleting
layers that tests create, have the addManyLayers() test function do so
as well.
Remove vfs.CopyDir, which near as I can tell isn't referenced anywhere.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2023-04-12 16:05:09 -04:00
Eng Zer Jun 6ea3603b6b
test: use `T.TempDir` to create temporary test directory
This commit replaces `ioutil.TempDir` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using `ioutil.TempDir`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}
is also tedious, but `t.TempDir` handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-08-30 01:21:37 +08:00
Sascha Grunert d88ef6dc08
Enable goimports linter and fix lints
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-01-28 15:59:15 +01:00
Sascha Grunert ba51455527
Enable deadcode linter and fix lints
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2020-01-28 15:59:15 +01:00
Nalin Dahyabhai c073b43547 Add a CreateFromTemplate() method to drivers, and use it for mapped layers
Add a CreateFromTemplate() method to graph drivers, and use it instead
of a driver-oblivious diff/put method when we want to create a copy of
an image's top layer that has the same parent and which differs from the
original only in its ID maps.

This lets drivers that can quickly make an independent layer based on
another layer do something smarter than we were doing with the
driver-oblivious method.  For some drivers, a native method is
dramatically faster.

Note that the driver needs to be able to do this while still exposing
just one notional layer (i.e., one link in the chain of layers for a
given container) to the higher levels of the APIs, so if the new layer
is actually a child of the template layer, that needs to remain a detail
that's private to the driver.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-01-17 14:28:40 -05:00
Daniel J Walsh ab4364860e
Pass mount options to useNaiveDiff
If in storage.conf I set the mount options to:
mountopt = "nodev,metacopy=on,redirect_dir=on"
This will turn on redirect_dir but the useNaiveDiff does not currently check
this option.  This will cause container images on commit to not be saved
correctly.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-10-25 15:33:00 -04:00
Daniel J Walsh 59f4aa4674
Change useNaiveDiff into driver function
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-10-25 15:23:11 -04:00
Nalin Dahyabhai 3da7589326 Add more tests, using vfs as a baseline
Add an "echo" driver test, for making sure that we generate diffs
correctly when particular paths are removed in one layer and restored in
a subsequent one.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-02-23 16:00:48 -05:00
Daniel J Walsh e5f58bf9c2 Backport moby overlay driver changes to containers/storage
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-26 20:45:15 +00:00
Nalin Dahyabhai dc61d44eb5 Rename 'overlay2' to 'overlay'
Finish the overlay->overlay2 changeover by:
* renaming overlay2 to overlay
  * teaching the driver to accept the overlay.override_kernel_check and
    overlay2.override_kernel_check options as having the same meaning
* registering the driver init function using both names, returning as
  the driver's name

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-04-24 16:02:38 -04:00
Daniel J Walsh 09d2882036 We need to remove overlay as an option in containers/storage
Since we prefer our users to use overlay2, there is not reason to
support and provide overlay as an option, and potentially use a worse
driver by accident.

We also need to make overlay2 the prefered driver in containers/storage.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-03-27 11:38:02 -04:00
Nalin Dahyabhai 60ff079996 Rename: cow/cowman -> storage/oci-storage
Rename the library module and CLI wrapper.
Rename daemon/graphdriver to drivers.
Catch up vendoring to match modules we've pruned.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2016-07-18 17:35:50 -04:00