Commit Graph

85 Commits

Author SHA1 Message Date
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
Darren Stahl
e6280a7c82 Enable integration tests on Windows using snapshotter and differ
Signed-off-by: Darren Stahl <darst@microsoft.com>
2018-01-23 15:25:17 -08:00
Daniel Nephin
1cd32fa68d Cleanup extra returns in tests
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2018-01-23 14:09:22 -05:00
Daniel Nephin
7d4337e738 Reduce the number of IO constructors
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-12-11 15:07:09 -05:00
Daniel Nephin
a901091f7c Rename cio.Creation to cio.Creator
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-12-08 14:26:10 -05:00
Michael Crosby
68bec1e9ce Add test for large exec payload
Test for #1826

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-30 11:03:18 -05:00
Daniel Nephin
cdf62f69a1 Fix usage of oci in other packages.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-27 16:16:17 -05:00
Daniel Nephin
f74862a0dd Add structcheck, unused, and varcheck linters.
Warn on unused and dead code

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-21 11:14:37 -05:00
Daniel Nephin
298dabc6c2 Move io.go into cio package
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-17 17:04:45 -05:00
Michael Crosby
b937d230ba Add additional container test for missing methods
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-20 16:25:11 -04:00
Jess Valarezo
830e0ea339 Change hcsshimopts to hcsshimtypes package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-10-11 11:42:07 -07:00
Michael Crosby
12c79cc0d9 Merge pull request #1604 from jessvalarezo/windows-listpids
ListPids returns process details in addition to process IDs.
2017-10-10 19:26:47 -04:00
Jess
061c719209 ListPids returns process ID and other info
Signed-off-by: Jess <jessica.valarezo@docker.com>
2017-10-10 22:57:15 +00:00
Kenfe-Mickael Laventure
c807ba8379
Allow setting the uid & gid of the io pipes
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-10-10 13:24:12 -07:00
Kenfe-Mickael Laventure
cfa87567a0
windows: Create init process with task
This prevents `task.Wait()` to return an error if it is called before the task
is started.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-10-09 08:40:12 -07:00
Phil Estes
72a3a019ae Merge pull request #1595 from crosbymichael/container-lock
sync container metadata before operations
2017-10-04 21:48:30 -04:00
Stephen Day
28882fddae Merge pull request #1589 from mlaventure/shim-no-newns
Add an option to prevent putting the shim in a new mount namespace
2017-10-04 17:24:26 -07:00
Michael Crosby
fa9e9bdf46 Fetch current container info before operations
This makes sure the client is always in sync with the server before
performing any type of operations on the container metadata.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-04 15:29:57 -04:00
Kenfe-Mickael Laventure
26d4c2c217
Add an option to prevent putting the shim in a new mount namespace
This is needed for users on kernel older than 3.18 so they can avoid EBUSY
errors when trying to unlink, rename or remove a mountpoint that is present in
a shim namespace.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-10-04 09:16:02 -07:00
Michael Crosby
9e85035f15 Add container update method
This adds an update method to the container interface for the client
package.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-03 16:59:52 -04:00
Kenfe-Mickael Laventure
af2226c938
client: Prevent Out-Of-Range panic in task.Metrics()
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-09-25 15:46:01 -07:00
Stephen J Day
f7d31e2be4
api, metadata: use map type for Container.Extensions
To allow for updating extensions without collisions, we have moved to
using a map type that can be explicitly selected via the field path for
updates. This ensures that multiple parties can operate on their
extensions without stepping on each other's toes or incurring an
inordinate number of round trips.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-09-08 19:34:26 -07:00
Brian Goff
3552ce5688 Add field to Container for client-defined data
This field allows a client to store specialized information in the
container metadata rather than having to store this itself and keep
the data in sync with containerd.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2017-09-07 16:54:47 -04:00
Michael Crosby
c07f7cab37 Add task.Metrics to windows
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-09-05 17:26:26 -04:00
Michael Crosby
8510512e7e Add test for client metrics
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-09-05 17:26:26 -04:00
Akihiro Suda
a560e5e0ef mount: fix read-only bind (#1368)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-09-04 04:44:56 +00: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
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
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
4028add553 Merge pull request #1405 from crosbymichael/fifos
Add FifoIO to expose fifos directly to client
2017-08-22 15:52:44 -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
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
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
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
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
Stephen Day
a64399acc2 Merge pull request #1341 from mlaventure/enable-test-parallelism
Enable test parallelism
2017-08-14 15:18:37 -07:00
Kenfe-Mickael Laventure
2abaf6e964
Fix possible deadlock in WithProcessKill
We were not checking the error value of `Kill` leading to deadlock if the
process didn't exist.

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-14 14:43:43 -07:00
Kenfe-Mickael Laventure
b02e9a844e
Fix TestContainerNoBinaryExists on windows
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-14 14:43:43 -07:00
Kenfe-Mickael Laventure
eb0970bbd1
Mark relevant tests as elligible for parallelism
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-14 14:43:43 -07:00
Michael Crosby
eb58ecab7c Add null io option
This adds null IO option for efficient handling of IO.
It provides a container directly with `/dev/null` and does not require
any io.Copy within the shim whenever a user does not want the IO of the
container.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-14 13:09:16 -04:00
Michael Crosby
bed8df119e Add cgroup paths and hostname spec opts
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-08 15:52:56 -04:00
Michael Crosby
d8c075aadc Add WithProcessKill DeleteOpt
Add an option that allows users for force kill and delete a process/task
when calling `Delete`

Fixes #1274

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-08 10:37:17 -04:00
Michael Crosby
60f7eee27b Merge pull request #1275 from mlaventure/travis-ineffassign
Enable ineffassign in CI
2017-08-07 09:21:53 -04:00
Michael Crosby
9f13b414b9 Return exit status from Wait of stopped process
This changes Wait() from returning an error whenever you call wait on a
stopped process/task to returning the exit status from the process.

This also adds the exit status to the Status() call on a process/task so
that a user can Wait(), check status, then cancel the wait to avoid
races in event handling.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-03 17:22:33 -04:00
Kenfe-Mickael Laventure
829845d268
Fix ineffassign warnings
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2017-08-03 08:27:15 -07:00
Michael Crosby
83b27db923 Check status for stopped processes before wait
Fixes #1054

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-02 13:50:08 -04:00
Michael Crosby
a2a3451925 Implement Exec + Start for tasks service
This splits up the exec creation and start in the tasks service

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-08-02 13:50:08 -04:00
Michael Crosby
a0a5cc7787 Add user namespace support to client
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-07-27 11:06:20 -04:00