Commit Graph

2903 Commits

Author SHA1 Message Date
Michael Crosby
421c607c54 Add Events client method
Fixes #1381

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-24 11:10:01 -04:00
Michael Crosby
5c7f67186a Add libcontainer/user package for passwd parsing
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-24 10:32:16 -04:00
Michael Crosby
f66f0fb7a0 Update windows SpecOpts in tests
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-24 10:32:16 -04:00
Michael Crosby
f436f4c828 Add WithUsername spec opt
This option will mount and inspect the /etc/passwd file of an image to
get the uid/gid of a user.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-24 10:32:16 -04:00
Michael Crosby
c601606f84 Move spec generation to Container Create
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-24 10:32:16 -04:00
Michael Crosby
fa14f2ef3a Add context and client to SpecOpts
In order to do more advanced spec generation with images, snapshots,
etc, we need to inject the context and client into the spec generation
code.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-24 10:32:16 -04:00
Michael Crosby
ba69f5d488 Add WithUserIDs SpecOpt
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-24 10:32:16 -04:00
Derek McGowan
f05281743e Merge pull request #1420 from dmcgowan/alpha6
release: updated version to alpha6
2017-08-23 15:36:13 -07:00
Derek McGowan
b14c2cce11
release: updated version to alpha6
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-23 15:09:32 -07:00
Michael Crosby
709c37b1d1 Merge pull request #1419 from dmcgowan/walk-skip-not-found
Skip items removed during walk
2017-08-23 17:59:31 -04:00
Kenfe-Mickaël Laventure
0daa593b3a Merge pull request #1393 from dmcgowan/multiple-differs
Add support for multiple differs
2017-08-23 14:45:17 -07:00
Derek McGowan
98960f0493
Skip items removed during walk
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-23 14:43:56 -07:00
Derek McGowan
05cdc4f435 Merge pull request #1417 from mlaventure/delete-exitedat
go-client: Return an ExitStatus struct when calling process.Delete()
2017-08-23 13:27:24 -07:00
Kenfe-Mickael Laventure
7f6c487031
go-client: Return an ExitStatus struct when calling process.Delete()
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-23 10:32:51 -07:00
Phil Estes
12b43a5c8a Merge pull request #1416 from tophj-ibm/fix-race-testflags
Only use race flag on amd64
2017-08-23 12:43:05 -04:00
Christopher Jones
e6ab556f0e
Only use race flag on amd64
Race is only supported on amd64, so only run if GOARCH is amd64

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
2017-08-23 12:30:44 -04:00
Kenfe-Mickaël Laventure
60fea11686 Merge pull request #1400 from dmcgowan/content-local-writer-locks
Ensure content writer only unlocks resource once
2017-08-23 08:07:18 -07:00
Michael Crosby
311ea33608 Merge pull request #1414 from dmcgowan/btrfs-test-fail-2
More snapshot and btrfs test cleanup
2017-08-23 09:44:05 -04:00
Michael Crosby
3bcb6f835b Merge pull request #1415 from kunalkushwaha/minor-fmt-fix
removing unused "fmt" package from import
2017-08-23 09:25:47 -04:00
Kunal Kushwaha
8f7086a8bd unused fmt package
`make integration` reports this error.

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2017-08-23 15:29:30 +09: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
Derek McGowan
4028add553 Merge pull request #1405 from crosbymichael/fifos
Add FifoIO to expose fifos directly to client
2017-08-22 15:52:44 -07:00
Stephen Day
4015f7376f Merge pull request #1410 from mlaventure/errdegs-stack
errdefs: Provide a valid stack in all cases
2017-08-22 15:44:26 -07:00
Kenfe-Mickaël Laventure
0e1f6c5da6 Merge pull request #1394 from crosbymichael/test-io
Remove Stdio usage in tests
2017-08-22 15:22:56 -07:00
Kenfe-Mickael Laventure
fc535efe58 windows: Close IO if process in created state
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-22 17:20:43 -04:00
Michael Crosby
01b217f884 Merge pull request #1411 from estesp/snapshotter-cli-default
Fix snapshot ctr command to use default
2017-08-22 16:30:42 -04:00
Phil Estes
4712ed5390
Fix snapshot ctr command to use default
After the rework of server-side defaults, the `ctr snapshot` command
stopped working due to no default snapshotter.

Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
2017-08-22 11:54:37 -07:00
Michael Crosby
a8b21da538 Add FifoIO to expose fifos directly to client
This allows clients an easier way to interact with the fifos for a
container without having to use the built in copyIO functions when
opening fifos.

It's nothing that clients could not have already coded but since we use
this type of functionality in the tests it makes sense to add an
implementation here.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-22 14:34:14 -04:00
Michael Crosby
1b470c180e Remove Stdio usage in tests
This causes shims and containers to hang when they use the testing
process's IO.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-22 14:02:45 -04:00
Kenfe-Mickael Laventure
4de219903a
errdefs: Provide a valid stack in all cases
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-22 09:40:29 -07:00
Michael Crosby
10460647f2 Merge pull request #1392 from cpuguy83/wait_async
Make Wait() async
2017-08-22 11:33:10 -04:00
Brian Goff
6ab99edb71 Convert ExitStatus to use fn to get details
Instead of requiring callers to read the struct fields to check for an
error, provide the exit results via a function instead which is more
natural.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-08-22 10:48:44 -04:00
Michael Crosby
0648ec3ead Merge pull request #1388 from kunalkushwaha/makefile
Breaking Makefile into platform specific files.
2017-08-22 10:33:50 -04:00
Brian Goff
026896ac4c Make Wait() async
In all of the examples, its recommended to call `Wait()` before starting
a process/task.
Since `Wait()` is a blocking call, this means it must be called from a
goroutine like so:

```go
statusC := make(chan uint32)
go func() {
  status, err := task.Wait(ctx)
  if err != nil {
    // handle async err
  }

  statusC <- status
}()

task.Start(ctx)
<-statusC
```

This means there is a race here where there is no guarentee when the
goroutine is going to be scheduled, and even a bit more since this
requires an RPC call to be made.
In addition, this code is very messy and a common pattern for any caller
using Wait+Start.

Instead, this changes `Wait()` to use an async model having `Wait()`
return a channel instead of the code itself.
This ensures that when `Wait()` returns that the client has a handle on
the event stream (already made the RPC request) before returning and
reduces any sort of race to how the stream is handled by grpc since we
can't guarentee that we have a goroutine running and blocked on
`Recv()`.

Making `Wait()` async also cleans up the code in the caller drastically:

```go
statusC, err := task.Wait(ctx)
if err != nil {
  return err
}

task.Start(ctx)

status := <-statusC
if status.Err != nil {
  return err
}
```

No more spinning up goroutines and more natural error
handling for the caller.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-08-22 09:33:07 -04:00
Kunal Kushwaha
1c989588c0 Breaking Makefile into platform specific files
Fixed #1270

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2017-08-22 13:57:12 +09:00
Kenfe-Mickaël Laventure
89da512692 Merge pull request #1377 from crosbymichael/exec-delete
Allow exec process to be deleted in created state
2017-08-21 15:27:17 -07:00
Derek McGowan
c71066252b
Ensure content writer only unlocks resource once
Make close a no-op after commit and disallow committing after close.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-21 14:54:51 -07:00
Derek McGowan
853fd15115 Merge pull request #1407 from crosbymichael/cgroups-bump
Update cgroups to e6d1aa8c71c6103624b2c6e6f4be0863
2017-08-21 13:47:54 -07:00
Michael Crosby
bf82de3a4e Allow exec process to be deleted in created state
Fixes #1376

This allows an exec process to be deleted in the created state.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-21 16:32:08 -04:00
Michael Crosby
77836a6c27 Update cgroups to e6d1aa8c71c6103624b2c6e6f4be0863
This bumps the cgroups package with various fixes to logging and net_cls
changes.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-21 16:17:18 -04:00
Michael Crosby
873a34649a Merge pull request #1366 from stevvooe/containers-metadata-tests
metadata: ensure correct updates on Container
2017-08-21 16:08:06 -04:00
Phil Estes
3e81b092de Merge pull request #1406 from mlaventure/add-exitedat-to-process
Add ExitedAt to process proto definition
2017-08-21 13:36:30 -04:00
Kenfe-Mickael Laventure
8a1b03e525
Add ExitedAt to process proto definition
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-21 08:18:02 -07:00
Michael Crosby
4c5f824167 Merge pull request #1404 from WeiZhang555/add-newline
Add newline char to avoid mix of logs
2017-08-21 11:12:42 -04:00
Zhang Wei
14fe2d5f20 Add newline char to avoid mix of logs
Add a '\n' after "unpacking xxx..." to avoid mix of logs such as:

```
unpacking sha256:a7776895af32e34b1fef997e26c79fa988b40c5cf2a3fb48dc22e0584b648d82...DEBU[0005]
Extraction not needed, layer snapshot exists
DEBU[0005] Extraction not needed, layer snapshot exists
DEBU[0005] Extraction not needed, layer snapshot exists
DEBU[0005] Extraction not needed, layer snapshot exists
DEBU[0005] Extraction not needed, layer snapshot exists
DEBU[0005] Extraction not needed, layer snapshot exists
done
```

After this commit:

```
unpacking sha256:a7776895af32e34b1fef997e26c79fa988b40c5cf2a3fb48dc22e0584b648d82...
DEBU[0008] Extraction not needed, layer snapshot exists
DEBU[0008] Extraction not needed, layer snapshot exists
DEBU[0008] Extraction not needed, layer snapshot exists
DEBU[0008] Extraction not needed, layer snapshot exists
DEBU[0008] Extraction not needed, layer snapshot exists
DEBU[0008] Extraction not needed, layer snapshot exists
done
```

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2017-08-20 21:03:18 +08:00
Stephen J Day
677257f032
service/snapshotter: move default to client
In order to enforce strict handling of snapshotter values on the
container object, the defaults have been moved to the client side. This
ensures that we correctly qualify the snapshotter under use when from
the container at the time it was created, rather than possibly losing
the metadata on a change of default.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-08-18 14:43:12 -07:00
Stephen J Day
783ed05057
metadata: ensure correct updates on Container
This fixes a few bugs in the container store related to reading and
writing fields. Specifically, on update, the full field set wasn't being
returned to the caller, making it appear that the store was corrupted.
We now return the correctly updated field and store the missing field
that was omitted in the original implementation. In course, we also have
defined the update semantics of each field, as well as whether or not
they are required.

The big addition here is really the container metadata testsuite. It
covers listing, filtering, creates, updates and deletes in a vareity of
scenarios.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-08-18 14:43:00 -07:00