Commit Graph

208 Commits

Author SHA1 Message Date
Andrey Vagin 46e62c9204 nsinit: return console
Signed-off-by: Andrey Vagin <avagin@openvz.org>
2015-01-15 18:22:47 +03:00
Andrey Vagin ba4257a146 new-api: add the Freezer method to cgroup.Manager
Signed-off-by: Andrey Vagin <avagin@openvz.org>
2015-01-15 00:43:14 +03:00
Andrey Vagin 59e66b818d nsinit: add getContainer()
Signed-off-by: Andrey Vagin <avagin@openvz.org>
2015-01-15 00:43:13 +03:00
Andrey Vagin d572094b75 new-api: execute a process inside an existing container
A new constructor function (like nsenter) is added in this patch.  This
function gets arguments from environment variables and its behaviour doesn't
depend on a command line arguments.

A program which calls factory.StartInitialization() must import the nsenter
package. It looks ugly, but I don't know another way how to enter into CT from
a go code.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
2014-12-25 18:44:10 +03:00
Andrey Vagin 1a380ac436 nsinit: remove ticks around nsenter
If we really need these command, we need to expand API.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
2014-12-23 16:30:37 +03:00
Andrey Vagin 5ecd29c1f2 linux_container: fork an init process in a new set of namespaces
Use namespace.Exec() and namespace.Init() to execute processes in CT.

Now an init process is actually executed in a new container. This series
doesn't change code about creating containers, it only reworks code according
with new API.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
2014-12-19 14:47:04 +03:00
Andrey Vagin c406a6b6e0 nsinit: clean up
Signed-off-by: Andrey Vagin <avagin@openvz.org>
2014-12-19 12:32:34 +03:00
Andrey Vagin ce9d63376f libcontainer: move State in the configs 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 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 159db89c1f nsinit: use the new API for executing processes
Signed-off-by: Andrew Vagin <avagin@openvz.org>
2014-12-16 09:19:02 +03:00
Andrey Vagin b608f5df10 nsinit: Add Makefile
Signed-off-by: Andrew Vagin <avagin@openvz.org>
2014-12-16 09:18:48 +03:00
Victor Marmol e5636543cc Switch from logrus to glog.
Signed-off-by: Victor Marmol <vmarmol@google.com>
2014-12-05 17:06:58 -08:00
Michael Crosby 47b41a6f5d Add logger to container and factory
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-05 15:24:42 -08:00
Michael Crosby 6310a958e6 Implement linux factory and container with readonly interface
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-05 15:24:42 -08:00
Michael Crosby 2be676643e Remove syncpipe pkg
This removes the entire syncpipe package and replaces it with standard
operations on the pipes.  The syncpipe type just never felt right and
probably should not have been there.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-11-06 00:08:10 +00:00
Saied Kazemi ae81ea069f Add RootFs field to configuration options in libcontainer's Config
Since currently the container.json file does not include the pathname
to a container's root filesystem, we need to parse /proc/mounts which
is slow and error-prone.  This patch addresses this issue by adding a
new RootFs field.

Signed-off-by: Saied Kazemi <saied@google.com>
2014-09-23 16:16:13 -07:00
Michael Crosby bdafa085ae Reuse exec cli function and strip nsenter- from funcs
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-12 17:33:20 -07:00
Michael Crosby 7d1ba0698f Cleanup and rename loadContainer to loadConfig
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-12 12:03:53 -07:00
Michael Crosby 52ba97e3b1 Add ip func example for listing namespace interfaces
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-12 11:52:33 -07:00
Michael Crosby 70367b2cf3 Improve execin to support registering funcs
This also changes the functionality of the default exec in to just be an
existing func that is called than handles the implementation to exec a
user user's process inside the container.  This implements this
functionallity in nsinit but is a base for how we will be handling these
types of features inside docker.

Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-12 11:43:12 -07:00
Michael Crosby 51e6049226 Make nsinit package main only
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-12 10:48:12 -07:00
Michael Crosby 9378c05c37 Remove nsinit main calling pkg
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-12 10:45:41 -07:00
Michael Crosby 3abf1dd99e Modify nsinit to register actions for argv 0
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-08 11:16:56 -07:00
Michael Crosby c8aa9323f1 Import nsenter code so that it is compiled into nsinit
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-08 10:43:18 -07:00
Michael Crosby ae9af437f0 After parsing flags check that the command is nsenter
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-07 10:48:29 -07:00
Michael Crosby a48b001013 Refactor execin code to be simpler
Signed-off-by: Michael Crosby <michael@docker.com>
2014-08-06 18:44:41 -07:00
Vishnu Kannan 74b99b8dd6 Check for "nsenter" in args before parsing flags. Addressed comments.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-08-05 22:13:23 +00:00
Vishnu Kannan e5e40b6ef0 Docker 'runin' demands passing flags before 'nsenter' cli option.
Docker does not require RunIn API. Hence that API has been removed.
nsinit CLI has been modified to work around the nsenter changes.

Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-08-05 22:13:23 +00:00
Mrunal Patel 7f3bbbb47b Move locking to caller.
Docker-DCO-1.1-Signed-off-by: Mrunal Patel <mrunalp@gmail.com> (github: mrunalp)
2014-08-01 19:06:56 -04:00
Michael Crosby 4568ca76c8 Update imports for new docker location
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
2014-07-24 14:28:49 -07:00
Michael Crosby b2337e4860 Fix runin code for nsinit
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
2014-07-22 19:50:00 +00:00
Vishnu Kannan bb85e2b07a 'nsinit exec' now uses namespaces.RunIn instead of namespaces.ExecIn.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-07-22 19:50:00 +00:00
Vishnu Kannan 1f2828770d Updated RunIn API to match the new console handling behavior in HEAD.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-07-22 19:49:59 +00:00
Michael Crosby b56aa0658a Don't open slave in parent
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
2014-07-15 18:24:15 -07:00
Michael Crosby 18e12838d6 Add resize of term in tty mode
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
2014-07-15 17:44:18 -07:00
Michael Crosby 43b4258c46 Open with NOCTTY and set raw term
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
2014-07-15 17:29:09 -07:00
Michael Crosby d661720fd7 Remove terminal handling in libcontainer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
2014-07-15 16:55:11 -07:00
Paul Morie ea6e255f45 Remove unused arg from namespaces.NsEnter
Docker-DCO-1.1-Signed-off-by: Paul Morie <pmorie@gmail.com> (github: pmorie)
2014-07-13 17:48:27 -04:00
Michael Crosby 422824c9d8 Move syncpipe into separate package
This moves the sync pipe into a separate package to help the changes
when moving the API around.

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
2014-07-11 11:06:00 -07:00
Michael Crosby 704a90bec4 Rename package correctly so the binary is nsinit
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
2014-07-08 16:36:59 -07:00
Vishnu Kannan 28dadc538c Separate nsinit main from implementation. This is done inorder to package nsinit as part of docker binary.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-07-01 22:00:15 +00:00
Michael Crosby 3f0764fa51 Add pause and unpause commands to nsinit
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
2014-06-26 16:45:18 -07:00
Michael Crosby 361ac10612 Just output raw stats json
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
2014-06-26 16:25:55 -07:00
Michael Crosby 21b71ef33d Rename spec to config
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
2014-06-26 16:24:16 -07:00
Vishnu Kannan 813d247bc7 Fixing some nits.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-06-26 20:49:02 +00:00
Vishnu Kannan edf1e856a0 RuntimeCkpt is now State and the checkpoint file is called state.json.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-06-25 21:29:04 +00:00
Vishnu Kannan 481552c02b Created a global runtime checkpoint for libcontainer. Got rid of the network specific runtime checkpoint.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-06-25 19:20:07 +00:00
Vishnu Kannan 9253412ee1 1. Added a basic version of network stats inside network package.
2. Introducing a new checkpoint file 'network.stats' which will contain the network runtime information (veth interface names for now).
3. Adding network stats to 'nsinit stats'.
4. Added a libcontainer Stats API to get both network and cgroup stats

Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
2014-06-25 19:19:10 +00:00
Michael Crosby 77dcaac129 Update code based on review comments
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
2014-06-25 11:36:54 -07:00
Michael Crosby 81e5a3f7a7 Replace pid and started file with State type
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
2014-06-25 11:36:54 -07:00