Commit graph

277 commits

Author SHA1 Message Date
Matthew Heon 54f32f2cc0 Convert bind mounts to use DB field
Refactors creation of bind mounts into a separate function that
can be called from elsewhere (e.g. pod start or container
restart). This function stores the mounts in the DB using the
field established last commit.

Spec generation now relies upon this field in the DB instead of
manually enumerating files to be bind mounted in.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #462
Approved by: baude
2018-03-08 16:40:21 +00:00
Matthew Heon c657511bce Add location in DB for saving files to bind mount in
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #462
Approved by: baude
2018-03-08 16:40:21 +00:00
Matthew Heon fcc3663355 Move internal function resizeTty to container_internal
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #462
Approved by: baude
2018-03-08 16:40:21 +00:00
Matthew Heon 221a3ab2b5 Make WriteStringToRundir internal
We don't want this in our public API - better to let us control
what gets put in container storage and where.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #462
Approved by: baude
2018-03-08 16:40:21 +00:00
Matthew Heon d23b9fd4ed Refactor saving OCI spec to disk into separate function
It will be needed for restarting containers

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #462
Approved by: baude
2018-03-08 16:40:21 +00:00
baude 4344639508 podman import, load, and commit are too verbose
The progress should not be show for import, load, and commit.  It makes machine
parsing of the output much more difficult.  Also, each command should output an
image ID or name for the user.

Added a --verbose flag for users that still want to see progress.

Resolves issue #450

Signed-off-by: baude <bbaude@redhat.com>

Closes: #456
Approved by: rhatdan
2018-03-07 20:59:11 +00:00
Giuseppe Scrivano bbf9a313c3 attach: set the terminal size and handle SIGWINCH
Notify conmon when the terminal size changes.  Use the same notification
to set the correct initial size.

Closes: https://github.com/projectatomic/libpod/issues/351

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #448
Approved by: baude
2018-03-06 20:47:46 +00:00
Matthew Heon cf0e5c6774 Fix review comments
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #430
Approved by: rhatdan
2018-03-06 01:21:09 +00:00
Matthew Heon 32be712cd3 Change standard config path and add override config
The standard config has moved to /usr/share/containers/ per
discussion. An override configuration file is allowed at the
previous /etc/containers/ location. This override will be used in
place of the normal config if both are present, and exists to
override distro packaged configs without modifying the standard
config.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #430
Approved by: rhatdan
2018-03-06 01:21:09 +00:00
Matthew Heon bd8557da85 Fix Conmon error to display Conmon paths
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #430
Approved by: rhatdan
2018-03-06 01:21:09 +00:00
Matthew Heon d589c9fc38 Add support to load runtime configuration from config file
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #430
Approved by: rhatdan
2018-03-06 01:21:09 +00:00
Matthew Heon e7296152f8 Add ability to dump config to file as TOML
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #430
Approved by: rhatdan
2018-03-06 01:21:09 +00:00
Matthew Heon abd2ae7a0c Change conmon and runtime paths to arrays
This allows more graceful handling of multiple paths in a config
file.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #430
Approved by: rhatdan
2018-03-06 01:21:09 +00:00
baude 4f4a78abb4 networking.go tweak iptables functions
Took duplicated code and merged it into the helper function so only a single
exec was executed.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #446
Approved by: mheon
2018-03-03 19:45:24 +00:00
baude e4dca05a31 allow DNS resolution in containers
Until https://github.com/containernetworking/plugins/pull/75 is merged
upstream, we are using iptables to manually allow DNS resolution in
containers that run bridged mode networking.  We also remove the rule
in the networkwork tear down.

Resolves issue: #390

Signed-off-by: baude <bbaude@redhat.com>
2018-03-02 14:24:54 -06:00
Matthew Heon 11143676fa Disable FFJSON for container structs
We were seeing unmarshal segfaults with it on

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #440
Approved by: baude
2018-03-02 19:20:26 +00:00
Matthew Heon 5518cd2194 Fix SQL syntax error
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #440
Approved by: baude
2018-03-02 19:20:26 +00:00
Matthew Heon d1abdebdcd Remove unused existing IP addresses function
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #440
Approved by: baude
2018-03-02 19:20:26 +00:00
Matthew Heon cd670ff839 Fix gofmt & golint
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #440
Approved by: baude
2018-03-02 19:20:26 +00:00
Matthew Heon 02c6ba9949 Use more reliable function for parsing CNI result
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #440
Approved by: baude
2018-03-02 19:20:26 +00:00
Matthew Heon edb1609c61 Update DB to hold CNI network information
Replace our old IP and Subnet fields in state with CNI types that
contain a lot more information. Retrieve these structs from the
CNI plugins themselves.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #440
Approved by: baude
2018-03-02 19:20:26 +00:00
Matthew Heon 29d650a379 Include error in error message
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #438
Approved by: rhatdan
2018-03-02 16:34:20 +00:00
Matthew Heon 3639859622 Instead of erroring on exit file not being found, warn
Erroring can cause us to get into an state where a container
which has no exit file cannot be shown in PS, cannot be removed,
etc.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #438
Approved by: rhatdan
2018-03-02 16:34:20 +00:00
Matthew Heon c5dc7f81fc Replace usage of runc with runtime
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #412
Approved by: baude
2018-03-01 21:17:51 +00:00
Matthew Heon fa5f99effa Convert exec session tracking to use a dedicated struct
This will behave better if we need to add anything to it at a
later date - we can add fields to the struct without breaking
existing BoltDB databases.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #412
Approved by: baude
2018-03-01 21:17:51 +00:00
Matthew Heon 83d7ae6506 Fix gofmt & golint
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #412
Approved by: baude
2018-03-01 21:17:51 +00:00
Matthew Heon 780baec1d9 Relax locking in Exec()
This allows containers to be used by `ps` and other commands
while they have ongoing exec sessions. Concurrent exec should
also work but is not tested.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #412
Approved by: baude
2018-03-01 21:17:51 +00:00
Matthew Heon f02a9cd975 Handle removing containers with active exec sessions
For containers without --force set, an error will be returned

For containers with --force, all pids in the container will be
stopped, first with SIGTERM and then with SIGKILL after a timeout
(this mimics the behavior of stopping a container).

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #412
Approved by: baude
2018-03-01 21:17:51 +00:00
Matthew Heon 70baafc1c7 Ensure that Cleanup() will not run on active containers
This ensures that containers with active exec sessions will not
have storage unmounted under them or network namespaces destroyed

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #412
Approved by: baude
2018-03-01 21:17:51 +00:00
Matthew Heon 8b87a17f56 Add tracking for exec session IDs
Exec sessions now have an ID generated and assigned to their PID
and stored in the database state. This allows us to track what
exec sessions are currently active.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #412
Approved by: baude
2018-03-01 21:17:51 +00:00
Matthew Heon aea4f24919 Remove now-unused runc launch code
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #412
Approved by: baude
2018-03-01 21:17:50 +00:00
Matthew Heon 345bfafee2 Rework exec to enable splitting to retrieve exec PID
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #412
Approved by: baude
2018-03-01 21:17:50 +00:00
Matthew Heon 2a0c949b9b Add tracking for container exec sessions to DB
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #412
Approved by: baude
2018-03-01 21:17:50 +00:00
Matthew Heon 920b66707e Small fixes to container Exec
Fix an error message, and always set Privileged if the container
is also privileged.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #412
Approved by: baude
2018-03-01 21:17:50 +00:00
Matthew Heon cb7b0edc5b Fix checks for configuration keys in the DB
Currently, we will error if the DB is configured with the default
containers/storage config, and then opened by a libpod which has
explicitly set the defaults. This is due to us using an empty
config by default (to tell c/storage to use its defaults).

This patch changes our handling so that unset storage config
(using the default) and explicitly setting the defaults are both
compatible.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #423
Approved by: baude
2018-03-01 14:16:55 +00:00
baude fd388a7da9 podman info add registries
add registries and insecure registries to the podman info output.  this gives us
some capatibility with other container runtimes.

Resolves issue #420

Signed-off-by: baude <bbaude@redhat.com>

Closes: #422
Approved by: mheon
2018-02-28 21:26:46 +00:00
TomSweeneyRedHat 85ece8a01f Tweak info time format
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #397
Approved by: rhatdan
2018-02-28 18:06:50 +00:00
baude 7ffc89d71a podman stats add networking
Add networking information to podman stats output.  Also correct an issue filed
where memory constraints of the cgroup were not reflected in the stats output. And
finally, fix issue with PID count.

Resolves issue #364

Signed-off-by: baude <bbaude@redhat.com>

Closes: #417
Approved by: mheon
2018-02-28 16:46:29 +00:00
Valentin Rothberg 2a59653bf3 CNIPluginDir: check "/usr/lib/cni"
Also consider "/usr/lib/cni" as a potential directory for CNI plugins.
On some distributions, e.g., on openSUSE, %{_libexecdir} evaluates to
"/usr/lib".

Signed-off-by: Valentin Rothberg <vrothberg@suse.com>

Closes: #416
Approved by: mheon
2018-02-28 14:48:26 +00:00
baude 6cb1c31d3f Restrict top output to container's pids only
Due to the way ps arguments work, it was possible to display pids
that dont below to the container in top output. We now filter pids
that dont belong to the container out of the output.  This also means
the pid column must be present in the output or we throw an error.

This resolves issue #391
Signed-off-by: baude <bbaude@redhat.com>

Closes: #400
Approved by: rhatdan
2018-02-26 23:41:47 +00:00
baude e5ddf34e64 podman load dont panic when no repotags
When performing a podman load, if there were no repotags in the image, podman would panic. In
the case that the incoming image does have repotags, it should be imported as a none:none image
so it can still be used by the user.

Resolves issue #403

Signed-off-by: baude <bbaude@redhat.com>

Closes: #405
Approved by: baude
2018-02-26 22:30:44 +00:00
baude 9f7643c364 Add ubuntu paths
The packages in Lokesh's ppa that is currently used for podman puts the
conmon and runc binaries in /usr/lib/crio/bin/conmon and /usr/lib/cri-o-runc/sbin/runc
respectively.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #406
Approved by: baude
2018-02-26 20:37:30 +00:00
baude 6831db7f10 Do not override user mounts
Podman should not override users mounts with default mounts
for /etc/hostname, /etc/resolv.conf, and /etc/hosts.

Resolves issue #388

Signed-off-by: baude <bbaude@redhat.com>

Closes: #401
Approved by: mheon
2018-02-26 18:46:44 +00:00
baude 5e7979f016 Address review comments
Review comments to delete WithNoNew function and its append.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #369
Approved by: rhatdan
2018-02-24 09:15:47 +00:00
Daniel J Walsh 831dc48883 Add support for --no-new-privs
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #369
Approved by: rhatdan
2018-02-24 09:15:47 +00:00
baude fd79671d05 CreateContainerStorage by image id
When creating container storage by name, if that name is a tagged image then the storage
could not be found.  We now use the image id which seems more reliable. Also added an
integration test to protect against regression.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #393
Approved by: mheon
2018-02-23 17:44:28 +00:00
Matthew Heon 16ed0baf65 Move Hostname accessor to more logical place
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #386
Approved by: baude
2018-02-23 04:25:47 +00:00
Matthew Heon eafbe76ebe Refactor spec generation in libpod into a function
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #386
Approved by: baude
2018-02-23 04:25:47 +00:00
Matthew Heon 8eadc208e1 Remove No New Privs from DB as it's already in the spec
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #383
Approved by: rhatdan
2018-02-22 21:22:39 +00:00
Matthew Heon 89110f682d Add accessors to all container config and state fields
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #381
Approved by: rhatdan
2018-02-22 19:59:54 +00:00