Commit Graph

115 Commits

Author SHA1 Message Date
Maksym Pavlenko
bd22653003 Add devmapper configuration examples
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2020-03-17 18:16:58 -07:00
Maksym Pavlenko
e2e40e19d7
Merge pull request #3924 from renzhengeek/renzhen/snapshot-gc
snapshots/devmapper: do not stop snapshot GC when one snapshot removing fails
2020-03-12 19:28:55 -07:00
Maksym Pavlenko
8cddb5f91d Pass snapshotter opts during Pull
For remote snapshotter cases it's quite often there is need to pass extra info
from client (for instance - registry URL to query remote layer from, credentials, etc).

This commit slightly extends WithPullSnapshotter to pass extra labels to a snapshotter.

Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2020-03-02 13:45:40 -08:00
Eric Ren
a3685262fe snapshots/devmapper: do not stop snapshot GC when one snapshot removing fails
Snapshots GC takes use of pruneBranch() function to remove snapshots,
but GC will stop if snapshotter.Remove() returns error and the error
number is not ErrFailedPrecondition. This results in thousands of
dm snapshots not deleted if one snapshot is not deleted, due to
errors like "contains a filesystem in use".

So return ErrFailedPrecondition error number in Remove() function where
appropriate, and let GC process go on collecting other snapshots.

Fix: #3923
Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
Signed-off-by: Eric Ren <renzhen.rz@linux.alibaba.com>
2020-02-29 13:32:48 +08:00
Eric Ren
b6bf7b97c2 devmapper: async remove device using Cleanup
Fix: #3923
Signed-off-by: Eric Ren <renzhen@linux.alibaba.com>
2020-02-29 13:32:48 +08:00
Sebastiaan van Stijn
f2edc6f164
vendor: update gotest.tools v3.0.2
full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-28 17:47:20 +01:00
Maksym Pavlenko
f5d8ff57c8
Merge pull request #3965 from jterry75/wcow_lcow_scratch_size
Add support for custom wcow and lcow sandbox scratch sizes
2020-01-30 22:34:35 -08:00
Maksym Pavlenko
f0652e1434 Make tests less flaky
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2020-01-30 09:57:34 -08:00
Justin Terry (VM)
bb8af922bb Add support for custom wcow and lcow sandbox scratch sizes
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2020-01-30 07:27:06 -08:00
Shengjing Zhu
1189cc40f2 snapshots: fix flaky TestMetastore
35a8e6e589/check/containerd-build-arm64/de237af/logs/make_test.txt

--- FAIL: TestMetastore (18.27s)
    --- FAIL: TestMetastore/GetInfo (13.91s)
        metastore_test.go:242: assertion failed:
            --- expected
            +++ info
            {snapshots.Info}.Created:
            	-: s"0001-01-01 00:00:00 +0000 UTC"
            	+: s"2020-01-15 14:15:38.71882571 +0000 UTC"
            {snapshots.Info}.Updated:
            	-: s"0001-01-01 00:00:00 +0000 UTC"
            	+: s"2020-01-15 14:15:38.71882571 +0000 UTC"
            : on key committed-1

Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2020-01-15 23:12:05 +08:00
Justin Terry (VM)
cd1cad9d55 Support disk usage in windows-lcow snapshot
Windows snapshot usage was completed in ref: #3785 but lcow didnt get updated.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2020-01-08 13:43:48 -08:00
Phil Estes
80d50a8a63
Merge pull request #3925 from dmcgowan/snapshot-cleanup-api
Add Cleanup to snapshot API
2020-01-08 10:03:18 -05:00
Derek McGowan
123af61c0b
Add Cleanup to snapshot API
Cleanup is an optional method a snapshotter may implement.
Cleanup can be used to cleanup resources after a snapshot
has been removed. This function allows a snapshotter to defer
longer resource cleanup until after snapshot removals are
completed. Adding this to the API allows proxy snapshotters
to leverage this enhancement.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2020-01-07 14:59:20 -08:00
Akihiro Suda
a4b423b19b overlay: test actual Opts
AsynchronousRemove opt was untested while it is specified by default in the plugin init.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-01-07 13:52:13 +09:00
ktock
493a36de95 Move label filter to snapshots package
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2019-12-25 12:13:08 +09:00
Maksym Pavlenko
75efbaf678 Attempt to make device mapper snapshotter tests less flaky
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-12-13 13:20:23 -08:00
Derek McGowan
d1261b5087
Update snapshot parent filter property to always exist
The parent property may be empty but always exists.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-11-25 10:07:25 -08:00
Eric Ernst
731e144a48 devmapper: update example base image size in README
base_image_size effectively is the limit of a layer size that can be
created using the devmapper snapshotter. While this will also depend on
the thinpool size itself, something closer to the total image size
(80%?) is more appropriate.

As is, if you try to run an image like elastic, you'll need a much
larger base_image_size than 128MB.

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
2019-11-20 12:26:16 -08:00
Derek McGowan
a176179a08
Merge pull request #3785 from Random-Liu/support-disk-usage-windows
Support disk usage in windows snapshot.
2019-11-12 14:40:38 -08:00
Wei Fu
843423ec38 snapshots: return error if readSnapshot fails
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2019-11-11 17:53:44 +08:00
Lantao Liu
8f9eff4fec Support disk usage in windows snapshot.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-11-01 00:12:10 -07: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
Akihiro Suda
d52cbc19be snapshots/native: ignore xattr errors during CopyDir
`secuity.*` xattrs cannot be copied in most cases

For moby/buildkit#1189

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2019-10-13 01:53:35 +09: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
renzhen.rz
4d11bb36ad devmapper: activate dm device if snap device marked as activated
- reproducer
 1. stop a container;
 2. reboot, or dmsetup remove its corresponding dm device;
 3. start the container, it will fail like:

 """
 Error: failed to start containers: {"message":"failed to create container(4f33d2760760c41518a84821153ccdf7f80980b797b783cdd75178fc6ca0bf4b) on containerd: failed to create task for container(4f33d2760760c41518a84821153ccdf7f80980b797b783cdd75178fc6ca0bf4b): failed to mount rootfs component &{ext4 /dev/mapper/vg0-mythinpool-snap-2 []}: no such file or directory: unknown"}
 """
- how the fix works
 activate the dm device if necessary, and give a warn msg:

 """
 time="2019-08-21T22:44:08.422695797+08:00" level=warning msg="devmapper device \"vg0-mythinpool-snap-2\" marked as \"Activated\" but not active, activating it"
 """

Signed-off-by: Eric Ren <renzhen@linux.alibaba.com>
2019-08-23 10:19:28 +08: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
Maksym Pavlenko
0a4bf1bd1e Mark faulty devices
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-08-05 12:05:36 -07:00
Maksym Pavlenko
3741fd8591 Remove deferred flag when removing devmapper device
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-07-31 11:28:33 -07:00
Maksym Pavlenko
4d5a0e19eb Mark faulty device in one transaction
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-07-30 16:26:55 -07:00
Maksym Pavlenko
878a3205cd Better error recovery in devmapper
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-07-30 15:17:17 -07:00
Derek McGowan
63ceaf877d
Add testing log context
Enables showing debug logs in testing output.
For integration tests the client log output will show
in addition to daemon output, with timestamps for better
correlation.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-07-16 10:31:43 -07:00
Eric Hotinger
9fda4a5fe6 Bumps the version of go-winio.
This also refactors the lcow and windows
snapshotters to use go-winio's utility functions for checking the
filesystem type.

Signed-off-by: Eric Hotinger <ehotinger@gmail.com>
2019-07-01 14:51:06 -07:00
Eric Hotinger
75f183887a Allow opts to flow to the backend snapshotter during snapshot creation.
Signed-off-by: Eric Hotinger <ehotinger@gmail.com>
2019-06-19 11:00:22 -07:00
Eric Ren
6f463d3505 test/snapshots: umount before committing snapshot
For block device like devicemapper, umount before committing
active snapshot can sync data onto disk. Otherewise:

1. deactivating a block device in use will fail or IO error
when forced;
2. new snapshot on it will not catch the data not laid on disk yet.

Signed-off-by: Eric Ren <renzhen.rz@alibaba-linux.com>
2019-05-09 12:27:05 +08:00
renzhen.rz
3887053177 snapshots/devmapper: deactivate thin device after committed
1. reason to deactivate committed snapshot

The thin device will not be used for IO after committed,
and further thin snapshotting is OK using an inactive thin
device as origin. The benefits to deactivate are:
 - device is not unneccesary visible avoiding any unexpected IO;
 - save useless kernel data structs for maintaining active dm.

 Quote from kernel doc (Documentation/device-mapper/provisioning.txt):

"
  ii) Using an internal snapshot.

  Once created, the user doesn't have to worry about any connection
  between the origin and the snapshot.  Indeed the snapshot is no
  different from any other thinly-provisioned device and can be
  snapshotted itself via the same method.  It's perfectly legal to
  have only one of them active, and there's no ordering requirement on
  activating or removing them both.  (This differs from conventional
  device-mapper snapshots.)
"

2. an thinpool metadata bug is naturally removed

An problem happens when failed to suspend/resume origin thin device
when creating snapshot:

"failed to create snapshot device from parent vg0-mythinpool-snap-3"
error="failed to save initial metadata for snapshot "vg0-mythinpool-snap-19":
object already exists"

This issue occurs because when failed to create snapshot, the
snapshotter.store can be rollbacked, but the thin pool metadata
boltdb failed to rollback in PoolDevice.CreateSnapshotDevice(),
therefore metadata becomes inconsistent: the snapshotID is not
taken in snapshotter.store, but saved in pool metadata boltdb.

The cause is, in PoolDevice.CreateSnapshotDevice(), the defer calls
are invoked on "first-in-last-out" order. When the error happens
on the "resume device" defer call, the metadata is saved and
snapshot is created, which has no chance to be rollbacked.

Signed-off-by: Eric Ren <renzhen@linux.alibaba.com>
2019-05-09 10:58:21 +08:00
Derek McGowan
c10eb8d122
Merge pull request #3256 from dvrkps/redundant
Remove redundant error checks
2019-05-03 16:23:40 -07:00
Davor Kapsa
cfc36388b3 Remove redundant error checks
Signed-off-by: Davor Kapsa <davor.kapsa@gmail.com>
2019-04-30 21:28:51 +02:00
Davor Kapsa
eded188f4f Fix misspells
Signed-off-by: Davor Kapsa <davor.kapsa@gmail.com>
2019-04-30 20:38:24 +02:00
Maksym Pavlenko
90085a7ac5 Add empty file to prevent build from failing
Go build fails on directory with only test files
https://github.com/golang/go/issues/8279

Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-04-02 17:35:19 -07:00
Maksym Pavlenko
8784eb6308 Move snapshotters benchmark to a separate package
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-04-02 14:42:21 -07:00
Maksym Pavlenko
d9526f5c4f Move CloudFormation template to contrib
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-04-01 13:34:48 -07:00
Maksym Pavlenko
515be73c82 Add snapshotters benchmark
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-04-01 11:13:27 -07:00
Michael Crosby
e7b6fea572
Merge pull request #3022 from mxpv/devmapper
Integrate device mapper snapshotter
2019-03-29 00:06:11 -04:00
Maksym Pavlenko
87289a0c62 devmapper: implement Usage
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2019-03-27 14:50:12 -07:00
Maksym Pavlenko
010b4da36f devmapper: implement dmsetup status
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2019-03-27 14:26:07 -07:00
Eric Hotinger
e13a4b67e8 Update the snapshotter docs to refer to the snapshots package for
WithLabels.

Signed-off-by: Eric Hotinger <ehotinger@gmail.com>
2019-02-28 15:03:37 -08:00
Maksym Pavlenko
208957ba3c
devmapper: proper cleanup in pool device test
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-02-22 12:51:27 -08:00
Maksym Pavlenko
734989c2a0
Update README
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-02-22 11:10:51 -08:00