Commit Graph

13 Commits

Author SHA1 Message Date
Alexander Morozov c44ab12c86 Add information Type method for Factory
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-03-11 11:44:56 -07:00
Andrey Vagin 7038ddbc8c libcontainer: move Config in a separate package
We are going to import the namespaces package into libcontainer,
so libcontainer should not be imported into namespaces.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
2014-12-19 12:32:34 +03:00
Andrey Vagin 8e9a6d28d2 linux_container: execute an init process in a new CT
Here is a first step to implement a new API. Currently the init
processes is executed without namespaces and cgroups.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
2014-12-17 07:39:18 +03:00
Andrey Vagin 2441babc48 linux_factory: add StartInitialization()
After forking a new processes in a new container, we need to call exec()
and tune namespaces.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
2014-12-16 09:19:16 +03:00
Michael Crosby d5b8418f75 Remove ContainerInfo interface
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-05 15:24:42 -08:00
Michael Crosby 926ab56ea8 Add testing for linux factory Load
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-05 15:24:42 -08:00
Michael Crosby e28b636b7b Add ContainerInfo instead of using a readonly state
This modifies Load in the factory to return a ContainerInfo interface
that is the read only view of the container when it is loaded.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-05 15:20:16 -08:00
Glyn Normington 582b25986d Add rich errors to the API
Add a rich Error type to the libcontainer package and use it in the API so
that callers can:

  * Check for a specific error without depending on an error string,
  * Obtain the stack trace of the function or method which detected the error.

The Error type provides a typed error code and a stack trace. The error code
identifies the error and enables the caller to test for it without being
sensitive to changes in the error text. The stack trace identifies the point
at which the error was detected. The combination of error code and stack trace
will enable errors to be diagnosed much more easily and with less guesswork
than when raw string-based errors are used.

The Error type conforms to the error interface and its Error method prints a
short error message. The Detail method provides a verbose error message
including the stack trace.

Notes:

1. There is an unfortunate precedent in the Go standard library which uses
variables to define errors. Checking for a specific error involves a string
comparison and assumes the corresponding variable has not been updated. It is
more robust and efficient to identify errors with integer-based types and
associated constants, although errors should still include a string
description for ease of use by humans.

2. It is not feasible to assign distinct types to Factory and Container
error codes because common errors such as SystemError cannot be declared in
two places and the names of the error codes then need to be decorated. This is
less readable.

Signed-off-by: Steve Powell <spowell@pivotal.io>
2014-09-04 15:01:09 -07:00
Steve Powell 24e7b86a87 Remove erroneous reference to `path` in description and error list;
add format description for `id` string;
add "invalid format" error for `id` string;
remove initial capitals on references to parameter names;
remove reference to `initialConfig`;
add description of id checking.

Signed-off-by: Steve Powell <spowell@pivotal.io>
2014-09-03 17:30:13 -07:00
Michael Crosby d6348aec6c Update container to have ID provided by the user
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-29 11:49:01 -07:00
Glyn Normington b42d0cb1da Use conventional factory terminology
The Initialize method is responsible for creating a new Container instance
and calling it Create makes the factory pattern more obvious. Clearly
creating a Container instance involves initialising the instance.

Docker-DCO-1.1-Signed-off-by: Glyn Normington <gnormington@gopivotal.com> (github: glyn)
2014-07-10 11:50:51 +01:00
Michael Crosby 5001b7e841 Add Load method to factory
Also update Initialize to take a path to the container
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
2014-07-09 16:58:59 -07:00
Victor Marmol c90a2c53bc Adding Initialize() to create a new container.
Docker-DCO-1.1-Signed-off-by: Victor Marmol <vmarmol@google.com> (github: vmarmol)
2014-07-08 16:02:12 -07:00