Commit Graph

9 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 52c1a2fae8
gofmt GoDoc comments with go1.19
Older versions of Go don't format comments, so committing this as
a separate commit, so that we can already make these changes before
we upgrade to Go 1.19.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-07-08 19:56:23 +02:00
Sebastiaan van Stijn c2e32c144c
volumes/service: NewStore: add more context to error
Adding some more context to errors to debug a failure in TestDaemonEvents

    === RUN   TestDockerDaemonSuite/TestDaemonEvents
    docker_cli_events_unix_test.go:399: [dd34383dd9b63] failed to start daemon with arguments [--data-root /go/src/github.com/docker/docker/bundles/test-integration/TestDockerDaemonSuite/TestDaemonEvents/dd34383dd9b63/root --exec-root /tmp/dxr/dd34383dd9b63 --pidfile /go/src/github.com/docker/docker/bundles/test-integration/TestDockerDaemonSuite/TestDaemonEvents/dd34383dd9b63/docker.pid --userland-proxy=true --containerd-namespace dd34383dd9b63 --containerd-plugins-namespace dd34383dd9b63p --containerd /var/run/docker/containerd/containerd.sock --host unix:///tmp/docker-integration/dd34383dd9b63.sock --debug --storage-driver overlay2 --config-file=test.json] : [dd34383dd9b63] daemon exited during startup: exit status 1
    check_test.go:307: [dd34383dd9b63] daemon is not started
    --- FAIL: TestDockerDaemonSuite/TestDaemonEvents (1.59s)

daemon logs:

    level=info  msg="Starting up"
    level=debug msg="Listener created for HTTP on unix (/tmp/docker-integration/dd34383dd9b63.sock)"
    level=debug msg="Golang's threads limit set to 55530"
    level=info  msg="[core] original dial target is: \"unix:///var/run/docker/containerd/containerd.sock\"" module=grpc
    level=info  msg="[core] parsed dial target is: {Scheme:unix Authority: Endpoint:var/run/docker/containerd/containerd.sock URL:{Scheme:unix Opaque: User: Host: Path:/var/run/docker/containerd/containerd.sock RawPath: ForceQuery:false RawQuery: Fragment: RawFragment:}}" module=grpc
    level=info  msg="[core] Channel authority set to \"localhost\"" module=grpc
    level=info  msg="[core] ccResolverWrapper: sending update to cc: {[{/var/run/docker/containerd/containerd.sock  0xc000010898 <nil> 0 <nil>}] <nil> <nil>}" module=grpc
    level=info  msg="[core] ClientConn switching balancer to \"pick_first\"" module=grpc
    level=info  msg="[core] Channel switches to new LB policy \"pick_first\"" module=grpc
    level=info  msg="[core] Subchannel Connectivity change to CONNECTING" module=grpc
    level=info  msg="[core] Subchannel picks a new address \"/var/run/docker/containerd/containerd.sock\" to connect" module=grpc
    level=debug msg="metrics API listening on /var/run/docker/metrics.sock"
    level=info  msg="[core] Channel Connectivity change to CONNECTING" module=grpc
    level=info  msg="[core] Subchannel Connectivity change to READY" module=grpc
    level=info  msg="[core] Channel Connectivity change to READY" module=grpc
    level=info  msg="[core] original dial target is: \"unix:///var/run/docker/containerd/containerd.sock\"" module=grpc
    level=info  msg="[core] parsed dial target is: {Scheme:unix Authority: Endpoint:var/run/docker/containerd/containerd.sock URL:{Scheme:unix Opaque: User: Host: Path:/var/run/docker/containerd/containerd.sock RawPath: ForceQuery:false RawQuery: Fragment: RawFragment:}}" module=grpc
    level=info  msg="[core] Channel authority set to \"localhost\"" module=grpc
    level=info  msg="[core] ccResolverWrapper: sending update to cc: {[{/var/run/docker/containerd/containerd.sock  0xc00045ece8 <nil> 0 <nil>}] <nil> <nil>}" module=grpc
    level=info  msg="[core] ClientConn switching balancer to \"pick_first\"" module=grpc
    level=info  msg="[core] Channel switches to new LB policy \"pick_first\"" module=grpc
    level=info  msg="[core] Subchannel Connectivity change to CONNECTING" module=grpc
    level=info  msg="[core] Subchannel picks a new address \"/var/run/docker/containerd/containerd.sock\" to connect" module=grpc
    level=info  msg="[core] Channel Connectivity change to CONNECTING" module=grpc
    level=info  msg="[core] Subchannel Connectivity change to READY" module=grpc
    level=info  msg="[core] Channel Connectivity change to READY" module=grpc
    level=debug msg="Using default logging driver json-file"
    level=info  msg="[graphdriver] trying configured driver: overlay2"
    level=debug msg="processing event stream" module=libcontainerd namespace=plugins.moby
    level=debug msg="successfully detected metacopy status" storage-driver=overlay2 usingMetacopy=false
    level=debug msg="backingFs=extfs, projectQuotaSupported=false, usingMetacopy=false, indexOff=\"index=off,\", userxattr=\"\"" storage-driver=overlay2
    level=debug msg="Initialized graph driver overlay2"
    level=debug msg="No quota support for local volumes in /var/lib/docker/volumes: Filesystem does not support, or has not enabled quotas"
    level=info  msg="[core] Channel Connectivity change to SHUTDOWN" module=grpc
    level=info  msg="[core] Subchannel Connectivity change to SHUTDOWN" module=grpc
    level=debug msg="Cleaning up old mountid : start."
    failed to start daemon: error while opening volume store metadata database: timeout

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-06-21 13:34:00 +02:00
Sebastiaan van Stijn 300c11c7c9
volume/mounts: remove "containerOS" argument from NewParser (LCOW code)
This changes mounts.NewParser() to create a parser for the current operatingsystem,
instead of one specific to a (possibly non-matching, in case of LCOW) OS.

With the OS-specific handling being removed, the "OS" parameter is also removed
from `daemon.verifyContainerSettings()`, and various other container-related
functions.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-07-02 13:51:55 +02:00
Sebastiaan van Stijn e5ae83e503
volumes: only send "create" event when actually creating volume
The VolumesService did not have information wether or not a volume
was _created_ or if a volume already existed in the driver, and
the existing volume was used.

As a result, multiple "create" events could be generated for the
same volume. For example:

1. Run `docker events` in a shell to start listening for events
2. Create a volume:

    docker volume create myvolume

3. Start a container that uses that volume:

    docker run -dit -v myvolume:/foo busybox

4. Check the events that were generated:

    2021-02-15T18:49:55.874621004+01:00 volume create myvolume (driver=local)
    2021-02-15T18:50:11.442759052+01:00 volume create myvolume (driver=local)
    2021-02-15T18:50:11.487104176+01:00 container create 45112157c8b1382626bf5e01ef18445a4c680f3846c5e32d01775dddee8ca6d1 (image=busybox, name=gracious_hypatia)
    2021-02-15T18:50:11.519288102+01:00 network connect a19f6bb8d44ff84d478670fa4e34c5bf5305f42786294d3d90e790ac74b6d3e0 (container=45112157c8b1382626bf5e01ef18445a4c680f3846c5e32d01775dddee8ca6d1, name=bridge, type=bridge)
    2021-02-15T18:50:11.526407799+01:00 volume mount myvolume (container=45112157c8b1382626bf5e01ef18445a4c680f3846c5e32d01775dddee8ca6d1, destination=/foo, driver=local, propagation=, read/write=true)
    2021-02-15T18:50:11.864134043+01:00 container start 45112157c8b1382626bf5e01ef18445a4c680f3846c5e32d01775dddee8ca6d1 (image=busybox, name=gracious_hypatia)

5. Notice that a "volume create" event is created twice;

    - once when `docker volume create` was ran
    - once when `docker run ...` was ran

This patch moves the generation of (most) events to the volume _store_, and only
generates an event if the volume did not yet exist.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-05-05 16:02:22 +02:00
Sebastiaan van Stijn 5ca758199d
replace pkg/locker with github.com/moby/locker
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-09-10 22:15:40 +02:00
Sebastiaan van Stijn 07d60bc257
Replace errors.Cause() with errors.Is() / errors.As()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-04-29 00:28:41 +02:00
Brian Goff e81d84971f Fix some doc strings in the volume package
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-11-02 12:27:32 -07:00
John Howard 5c20890b9b boltdb/bolt --> go.etcd.io/bbolt
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-09-13 12:38:39 -07:00
Brian Goff e4b6adc88e Extract volume interaction to a volumes service
This cleans up some of the package API's used for interacting with
volumes, and simplifies management.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-05-25 14:21:07 -04:00
Renamed from volume/store/store.go (Browse further)