Commit graph

397 commits

Author SHA1 Message Date
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
umohnani8 3d395767d8 Implement --image-volumes for create and run
--image-volumes tells podman what to do with the image volumes in the image config
There are 3 options: bind, tmpfs, and ignore
bind puts the volume contents in /var/lib/containers/storage/container-id/volumes/vol-dir
and bind mounts it into the container at /vol-dir
tmpfs mounts /vol-dir as a tmps into the container
ignore doesn't mount the image volumes onto the container

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #377
Approved by: rhatdan
2018-02-22 15:14:00 +00:00
Matthew Heon 7a7a6c2d79 Remove unnecessary booleans
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #361
Approved by: rhatdan
2018-02-22 14:49:36 +00:00
Matthew Heon cef3979203 Fix gofmt
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #361
Approved by: rhatdan
2018-02-22 14:49:36 +00:00
Matthew Heon 8ce7c5bdd1 Make operations on pod containers as a group independent
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #361
Approved by: rhatdan
2018-02-22 14:49:36 +00:00
Matthew Heon 7c51fa05a2 Fix gofmt
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #361
Approved by: rhatdan
2018-02-22 14:49:36 +00:00
Matthew Heon 0838c2b984 Add ability to start containers in a pod
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #361
Approved by: rhatdan
2018-02-22 14:49:36 +00:00
Matthew Heon 86930c829e Add kill and stop for pods
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #361
Approved by: rhatdan
2018-02-22 14:49:36 +00:00
Matthew Heon 0b4c8fc2bb Add pod status command
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #361
Approved by: rhatdan
2018-02-22 14:49:36 +00:00
Jhon Honce a58e9f7cee Push up createConfig.CgroupParent processing to parent
Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #370
Approved by: rhatdan
2018-02-22 12:39:08 +00:00
Jhon Honce 8a97671145 Corrected comment
Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #370
Approved by: rhatdan
2018-02-22 12:39:08 +00:00
Jhon Honce 3f004df384 Implement podman run option --cgroup-parent
Example:

sudo /usr/local/bin/podman run --cgroup-parent=/zzz fedora cat /proc/self/cgroup

Signed-off-by: Jhon Honce <jhonce@redhat.com>

Closes: #370
Approved by: rhatdan
2018-02-22 12:39:08 +00:00
baude 4929e37507 Performance enhancement for podman images
Previous code was using slow routines to collect some of the information
needed to output images.  Specifically size was being calculated instead
of using the cached, already known size already available.  Also, straight-
lined several of the code paths.  Overall assessment is that these
improvements cut the time for images in half.

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

Closes: #365
Approved by: mheon
2018-02-20 21:54:32 +00:00
Matthew Heon 8eb5cf7489 Ensure we don't repeatedly poll disk for exit codes
Change logic for refreshing our state using runc to only poll
for conmon exit files when we first transition to the Stopped
state. After that, we should already have the exit code stored in
the database, so we don't need to look it up again.

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

Closes: #363
Approved by: TomSweeneyRedHat
2018-02-20 14:54:13 +00:00
Matthew Heon 635deb6358 Change uptime format in podman info to human-readable
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #355
Approved by: rhatdan
2018-02-19 19:19:07 +00:00
Matthew Heon 07f15c2694 Remove unused registry related options from libpod
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #349
Approved by: rhatdan
2018-02-19 14:17:18 +00:00
Matthew Heon f2041b51f3 Add FFJSON encoding/decoding for our container structs
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #323
Approved by: mheon
2018-02-16 16:46:09 +00:00
Matthew Heon ce7a0171d1 Squash logged errors from failed SQL rollbacks
Currently we unconditionally roll back transactions after error,
even if a commit has already been attempted. Commit is guaranteed
to end a transaction, though, whether by successfully committing
or by rolling back if that fails. As such, we attempt a double
rollback if a transaction fails at commit (for example, for a
constraint violation), which doesn't error but does log angry
warning messages. Ensure we don't try rolling back after commit
runs to prevent this.

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

Closes: #327
Approved by: rhatdan
2018-02-15 15:47:59 +00:00
Matthew Heon 35e1ad78fb Make libpod build on 32-bit systems
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #324
Approved by: rhatdan
2018-02-13 15:39:07 +00:00
Matthew Heon 3d0100bb44 Address review comment
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #184
Approved by: baude
2018-02-12 14:28:07 +00:00
Matthew Heon de737c150a Add buckets for all containers and all pods
Now, we don't need to use the global ID registry to iterate - we
can iterate only through containers or only through pods, without
having to iterate through both.

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

Closes: #184
Approved by: baude
2018-02-12 14:28:07 +00:00
Matthew Heon dc6a99df4c Containers in a pod can only join namespaces in that pod
This solves some dependency problems in the state, and makes
sense from a design standpoint.

Containers not in a pod can still depend on the namespaces of
containers joined to a pod, which we might also want to change in
the future.

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

Closes: #184
Approved by: baude
2018-02-12 14:28:07 +00:00
Matthew Heon 3962d10bd4 Fix gofmt and lint
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #184
Approved by: baude
2018-02-12 14:28:07 +00:00
Matthew Heon a7889f8d6a Check error when checking ctr dependencies
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #184
Approved by: baude
2018-02-12 14:28:07 +00:00
Matthew Heon 4f225b47c9 Refactor Pod to use a Config struct
This allows us to JSON it and stuff it in the DB - previously,
all pod fields were private, so JSON couldn't encode them. This
allows us to keep all pod fields private by having a substruct
with public fields.

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

Closes: #184
Approved by: baude
2018-02-12 14:28:07 +00:00
Matthew Heon aa85ae212e Add pod functions to BoltDB state
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #184
Approved by: baude
2018-02-12 14:28:07 +00:00
Matthew Heon 363a82e668 Add pod buckets
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #184
Approved by: baude
2018-02-12 14:28:07 +00:00
Matthew Heon b4cdc27b31 Add implementation for BoltDB-backed state
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #184
Approved by: baude
2018-02-12 14:28:07 +00:00
Daniel J Walsh 2e96acf300 Change json to match docker inspect
Changing these fields caused the output of podman inspect to more
closely match docker inspect.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #306
Approved by: mheon
2018-02-11 11:50:34 +00:00
Matthew Heon b07c8d6a73 Fix libpod to use given CGroup parent instead of a hardcoded one
Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #319
Approved by: TomSweeneyRedHat
2018-02-09 20:11:07 +00:00
baude 4ea26aace4 libpod/finished_amd64.go -> libpod/finished64.go
Rename finished_amd64 to finished64.go to more accurately reflect
that it covers all 64bit arches.

Also, bumped the EPOCH for gitvalidation to speed up validations.

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

Closes: #318
Approved by: mheon
2018-02-09 17:00:04 +00:00
Matthew Heon 75914199f3 Fix further style issues
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Matthew Heon c8e296c83e Allow removing pods with running containers if --force is given
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Matthew Heon 9e6855f348 Address style issues in in_memory_state
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Matthew Heon 86d549f2cd Fix gofmt and lint
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Matthew Heon 19840e0b3d Finish unit tests for pods
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Matthew Heon cb28a1d284 Fix bugs identified by unit tests
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Matthew Heon 4ecebf20b4 Rework state tests to avoid boilerplate. Begin adding pod tests.
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Matthew Heon 0920e8de5a Unify Pod and Container ID and Name registries for in-memory state
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Matthew Heon 044139dca9 Remove read-only from DB, it's in the spec
Don't need to store it separately

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

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Matthew Heon 6b7b4b03a8 Add pod removal code
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Matthew Heon cfd6da22df Implement pod operations in SQL state
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Matthew Heon 6214be07c2 Tear out pod containers map. Instead rely on state
This ensures that there is only one canonical place where
containers in a pod are stored, in the state itself.

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

Closes: #268
Approved by: rhatdan
2018-02-09 15:01:34 +00:00
Daniel J Walsh 3921f10a72 cleanup network stack as well as storage when container shuts down.
This patch will cleanup the network stack when the container exits

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-02-08 06:42:21 -05:00
Matthew Heon e47c2e390a
Merge pull request #293 from rhatdan/sd_notify
Need to add LISTEN_PID environment variable to conmon command
2018-02-07 18:59:50 -05:00
Daniel J Walsh 11eb18cec6
Merge pull request #309 from mheon/pause_state_error
Change pause so only running containers are valid
2018-02-07 16:07:46 -05:00
Daniel J Walsh 588c9bb5de
Merge pull request #289 from TomSweeneyRedHat/dev/tsweeney/username
Change un/pwd handling to match Buildah's
2018-02-07 14:07:54 -05:00
Matthew Heon ca7ebcac64 Change pause so only running containers are valid
Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-02-07 10:47:43 -05:00
Matthew Heon 8fbfb93947 Error on attempting to restart container
Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #304
Approved by: baude
2018-02-07 01:56:11 +00:00
Matthew Heon d20c1a9911 Change stop signal default to SIGTERM
Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #299
Approved by: rhatdan
2018-02-06 19:03:57 +00:00
TomSweeneyRedHat bb37c11651 Change un/pwd handling to match Buildah's
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
2018-02-06 09:29:23 -05:00
Daniel J Walsh d1c0c42a08 Need to add LISTEN_PID environment variable to conmon command
Without this field then conmon will not pass the proper data down to
the OCI Runtime.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-02-05 16:35:43 -05:00
Daniel J Walsh 989f5e3062 Pass NOTIFY_SOCKET and LISTEN_FDS env to OCI RUntime if set
In order to have sd_notify from systemd to work in containers
we need to pass down the NOTIFY_SOCKET environment variable to
the container.

LISTEN_FDS, tells the application inside of the container to use
socket activation and grab the FDS that are leaked into the container.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #271
Approved by: umohnani8
2018-02-05 15:39:40 +00:00
Daniel J Walsh 095aaaa639 Allow users to specify logpath
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #135
Approved by: mheon
2018-02-03 19:49:14 +00:00
baude 6ba6ecf59b Migrate Create|Commit to ginkgo
Migrate create and commit bats tests to the ginkgo
test suite.  In doing so, some structures had to be
moved to pkg/podmanstructs/podmanstructs.go so we
could do better verification of test results.

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

Closes: #286
Approved by: rhatdan
2018-02-02 22:44:40 +00:00
Matthew Heon a417e6e0cc Update stats code to reflect changes to containerd stats API
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-02-01 13:30:55 -05:00
baude 7f6a141839 libpod/runtime.go: Stick paths in arrays
To account for more path possibilities, we now iterate
a string array of possible paths to try and find paths
to runc and conmon.

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

Closes: #278
Approved by: baude
2018-01-31 20:23:36 +00:00
baude 3c044f9267 Ginkgo Tests: ps, pull, push and rm
Migrate ps, pull, push, and rm from bats to ginkgo.

Also, fixed a conditional issue with adding ports
when an image defines the port and the user wants
to override it.

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

Closes: #277
Approved by: baude
2018-01-31 20:23:31 +00:00
baude ecb74aa406 libpod/runtime.go: runtime path
Ubuntu installs runc to /usr/sbin/runc so we now account
for that.  Also, added  small check when creating a new
runtime that if we cannot find the runc binary, we bail
out.

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

Closes: #276
Approved by: baude
2018-01-31 15:27:14 +00:00
baude f02d72fb76 libpod/container_api: Set hostname in ENV
The container's hostname should be set as an environment
variable for the container.

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

Closes: #273
Approved by: baude
2018-01-30 15:21:10 +00:00
Matthew Heon c60d8a0671 Add StopWithTimeout API function for containers
Normal Stop should not need a timeout, and should use the default
Add a function that does accept a timeout aside it

Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #272
Approved by: rhatdan
2018-01-30 05:02:12 +00:00
Matthew Heon fb58b87398 Strip unused format specifier
Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #263
Approved by: umohnani8
2018-01-27 06:26:20 +00:00
Matthew Heon 36e6009f00 Close attach control file
From CRI-O #1288

Signed-off-by: Matthew Heon <mheon@redhat.com>

Closes: #263
Approved by: umohnani8
2018-01-27 06:26:20 +00:00
Daniel J Walsh 50d4cd2868 Save --privileged state
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #255
Approved by: mheon
2018-01-25 04:30:15 +00:00
umohnani8 12e3d9d8a2 Fix podman stats based on QE feedback
QE found issues with formatting the go template and
the man page was lacking information.
Changed the format of the output to match latest docker.
Add shortID function that returns the truncated ID

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #258
Approved by: rhatdan
2018-01-25 03:23:10 +00:00
baude 49ec9b2e3e Streamline image resolution
When trying to determine if a user-provided string that describes
an image (ID, fq name, shortname, tagged), there were some
inefficiencies where we looked up images multiple times to derive
information about local images.

Signed-off-by: baude <bbaude@redhat.com>
2018-01-23 11:49:21 -06:00
baude a03e040f0b libpod/oci.go: Perf issue
Matt Heon and I found that a defer statement was costing podman
run dearly.  We dont think the defer function was working (nor
needed) and was timing out as well.  Removing this defer statement
decreased podman runtime by 1.5s or more.

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

Closes: #253
Approved by: baude
2018-01-23 14:20:41 +00:00
umohnani8 93765a9964 Fix issues with podman ps from QE
QE pointed out a few things missing/wrong with ps
This PR addresses those issues.
Added functionality for getting mounts and size also
Fixed a few issues with the --filter params, for
example filter with partial information.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #250
Approved by: rhatdan
2018-01-22 20:11:38 +00:00
baude e1c67e6c85 Expose ports from image
When an image has a port to expose, we need to expose it.  User's input overrides the
image's port information.

Also, enable port information in ps so we can see which random port is assigned.

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

Closes: #249
Approved by: rhatdan
2018-01-22 17:09:11 +00:00
baude 5c3e4cfa62 Override hostname for container
Adds the ability to override the container's hostname.  Also, uses
the first twelve characters of the container ID as the default hostname
if none is provided.

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

Closes: #248
Approved by: baude
2018-01-21 17:24:49 +00:00
baude 946b4ced54 Enable port bindings
Set up nbetworking ports for the following use cases:

* bind the same port between host and container
* bind a specific host port to a different container port
* bind a random host port to a specific container port

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

Closes: #214
Approved by: baude
2018-01-20 18:51:21 +00:00
Daniel J Walsh 70306466d0 Cleanup of podman stats
Fix errors when containers are not running.
--all, --latest, containers can not be used at same time.
Should match the output of docker stats, 0 values replaced by "--"
Should return stats right away if container is not running.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #244
Approved by: TomSweeneyRedHat
2018-01-19 17:00:15 +00:00
baude a4701b5631 Add --dns-search, --dns-opt, --dns-server and --add-host.
Each of these options are destructive in nature, meaning if the user
adds one of them, all current ones are removed from the produced
resolv.conf.

* dns-server allows the user to specify dns servers.
* dns-opt allows the user to specify special resolv.conf options
* dns-search allows the user to specify search domains

The add-host option is not destructive and truly just adds the host
to /etc/hosts.

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

Closes: #231
Approved by: mheon
2018-01-19 15:42:25 +00:00
Matthew Heon ae2ffc31d3 Fix gofmt
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-01-18 11:59:38 -05:00
Matthew Heon 49378c055a Rename containerRuntimeInfo to containerState for clarity
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-01-18 11:49:14 -05:00
Matthew Heon 4f2bf5ba1c Rename ContainerState to ContainerStatus
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-01-18 11:48:20 -05:00
Matthew Heon 64d2190ec1 Split container.go into three files
Weighing in at ~1700 lines, container.go is just too big. Split
it into three files: core structs and accessors (container.go),
public API (container_api.go), and internal functions
(container_internal.go).

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-01-18 11:48:20 -05:00
Daniel J Walsh 0d69ca6637 Fix seccomp support
If user does not specify seccomp file or seccomp file does not exist,
then use the default seccomp settings.

Still need to not hard code /etc/crio/seccomp.json, should move this to
/usr/share/seccomp/seccomp.json

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #233
Approved by: baude
2018-01-18 12:26:43 +00:00
Matthew Heon 8745eaaf30 Fix gofmt
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Matthew Heon ff77941a31 Fix in-memory state tests
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Matthew Heon 54e258bfde Convert remaining state tests to new style
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Matthew Heon aa34b86ae6 Add ability to get dependencies of a container
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Matthew Heon daba9836c8 Fix comment typo
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Matthew Heon 0ae9097b32 Fix gofmt
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Matthew Heon aa20a25ca0 Address review comments
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Matthew Heon b814a94c34 Wire in logic for selecting backing state impl
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Matthew Heon 5696dfef6e Do no lint test helpers
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Matthew Heon 67b6c132d8 Modify unit tests for state to run on all state implementations
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Matthew Heon 65d643caeb Change handling for pods in libpod state
Add new functions to update pods and add/remove containers from them
Use these new functions in place of manually modifying pods

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

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Matthew Heon 13f004aec5 Add ability to retrieve a pod's container from the state
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #229
Approved by: rhatdan
2018-01-17 15:26:43 +00:00
Matthew Heon 0bc31724dc Ensure batched containers have locks
This won't matter during batched operatins, but if the container
leaks outside of the Batch() function it will segfault if asked
to do any operation that locks unless this is applied

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

Closes: #226
Approved by: rhatdan
2018-01-16 15:43:08 +00:00
Matthew Heon a23dd7a789 Fix lint issues
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #220
Approved by: rhatdan
2018-01-16 14:58:06 +00:00
Matthew Heon d90355ebe8 Prevent containers with dependencies from being removed
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #220
Approved by: rhatdan
2018-01-16 14:58:06 +00:00
Matthew Heon 20df2196f2 Add ability for states to track container dependencies
Also prevent containers with dependencies from being removed from
in memory states. SQLite already enforced this via FOREIGN KEY
constraints.

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

Closes: #220
Approved by: rhatdan
2018-01-16 14:58:06 +00:00
Matthew Heon d2ec1f7628 Add API for sharing namespaces
Remove existing code for sharing namespaces and replace with use
of this API

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

Closes: #220
Approved by: rhatdan
2018-01-16 14:58:06 +00:00
Matthew Heon 2ac4192bd3 Add support for shared CGroup namespaces
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #220
Approved by: rhatdan
2018-01-16 14:58:06 +00:00
Matthew Heon fe0e1cd11b Add support for joining shared namespaces in libpod
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #220
Approved by: rhatdan
2018-01-16 14:58:06 +00:00
Matthew Heon 333f664da7 When performing state-changing operations, don't exec runtime
If we start a container and it does not error, we can assume the
container is now running. Subsequent API calls will sync for us
to see if it died, so we can just set ContainerStateRunning
instead of launching the runtime to explicitly get state.

The same logic applies to pause and unpause.

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

Closes: #223
Approved by: rhatdan
2018-01-16 14:32:38 +00:00
Matthew Heon 2e48c60bc5 Add DNS and security fields to DB
Also moves port mappings out of the SQL DB and into a file on
disk. These could get very sizable (hundred to thousands of
ports) so moving them out to a file will keep the DB small and
fast.

Finally, add a foreign key reference from container ID to
container state ID. This ensures we never get into an
inconsistent state where we have data in one table but not the
other.

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

Closes: #225
Approved by: baude
2018-01-15 19:50:59 +00:00
Matthew Heon 7853262a84 Fix gofmt
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #222
Approved by: rhatdan
2018-01-14 12:27:33 +00:00
Matthew Heon 3ab8eb2e9b Add Sync() function to updating ctr state in Batch()
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #222
Approved by: rhatdan
2018-01-14 12:27:33 +00:00
Matthew Heon 149640a4c8 Disable locking on functions in batch operations
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #222
Approved by: rhatdan
2018-01-14 12:27:33 +00:00
Matthew Heon 5599b64e72 Add initial function batching API
Disabling locking/syncing in a batched operation not yet implemented

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

Closes: #222
Approved by: rhatdan
2018-01-14 12:27:33 +00:00
Matthew Heon 9c5a42eb1f Remove unused fields from runtime config
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #212
Approved by: rhatdan
2018-01-12 17:01:36 +00:00
Daniel J Walsh 6e8100cf2e
Merge pull request #211 from mheon/wireup_backends
Wire up API for CGroup Parent
2018-01-12 12:01:34 -05:00
Daniel J Walsh 3783c3fe21
Merge pull request #215 from mheon/update_cni
Update OCICNI vendor and plugin directories
2018-01-12 10:14:44 -05:00
baude 9adcb85929 podman run container id to file
podman run --cidfile /tmp/foo writes the container's id
to a file.

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

Closes: #205
Approved by: rhatdan
2018-01-11 21:27:26 +00:00
Matthew Heon 240e5789d4 Update CNI plugin directories to search default location as well
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-01-11 10:10:46 -05:00
Matthew Heon 5bc4d1d315 Fix build error after updating CNI vendor
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-01-11 10:03:16 -05:00
Daniel J Walsh dd0d35deb0 Add support for shm-size.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #206
Approved by: TomSweeneyRedHat
2018-01-11 12:39:06 +00:00
Matthew Heon 04e0687da1 Add ability to set CGroup Parent via API
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2018-01-10 16:21:54 -05:00
Matthew Heon e6be800ec6 Update DB to add new fields required for planned features
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #209
Approved by: rhatdan
2018-01-10 20:16:21 +00:00
baude 245a338f5a Add latest to wait
It is desirable to have a --latest switch on the podman wait
command so we can wait on the latest container created to end.

Also, fixes a panic with latest where no containers are available.

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

Closes: #201
Approved by: baude
2018-01-08 22:44:38 +00:00
Matthew Heon da7556de4a Fix merge issues
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #189
Approved by: mheon
2018-01-08 20:48:31 +00:00
Matthew Heon 2188167909 Remove vendored files unnecessary after Kube hostport removal
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #189
Approved by: mheon
2018-01-08 20:48:31 +00:00
Matthew Heon 5c5c024e80 Remove Kubernetes hostport support
This can now be handled by CNI plugins, so let them manage ports
instead.

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

Closes: #189
Approved by: mheon
2018-01-08 20:48:31 +00:00
baude c246b9d24f Shortname deletion continued
With certain short name usages, rmi still was unable to delete
certain images. This was also reflected in several commit tests
that were temporarily disabled.

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

Closes: #200
Approved by: rhatdan
2018-01-08 20:12:20 +00:00
Matthew Heon 3d05f100f7 Save ContainerConfig.User to database
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #194
Approved by: rhatdan
2018-01-08 19:34:21 +00:00
baude 7b08aa78e4 Shortcut for most recent container
It is desirable to have a shortcut for the most
recently created container.  We can now use "**latest"
to represent the most recent container instead of its
container ID or name.  For example:

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

Closes: #179
Approved by: baude
2018-01-08 19:12:17 +00:00
Matthew Heon 6baf6e461d Clean up network namespaces on container removal
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #197
Approved by: rhatdan
2018-01-08 18:45:17 +00:00
baude 6847636c30 Remove by shortname
Removing by shortname was not working.  Also pruned
container storage's remove func from rmi and moved it into
an image.Remove func, which consolidates our usage of cs.

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

Closes: #188
Approved by: baude
2018-01-08 18:15:55 +00:00
Matthew Heon f881a8d17c Add basic network inspection info
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #196
Approved by: rhatdan
2018-01-08 16:12:50 +00:00
Matthew Heon e2675ef921 Add function to get IP address of a running container
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #192
Approved by: rhatdan
2018-01-08 13:54:32 +00:00
Daniel J Walsh b231e3412e Fix handling of exit codes
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #183
Approved by: TomSweeneyRedHat
2018-01-04 21:05:10 +00:00
baude 04593b1591 Run by shortname
While pulling by shortname (fedora-minimal) worked, running a container
by the short name did not due to a logic error.

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

Closes: #182
Approved by: rhatdan
2018-01-04 17:39:42 +00:00
Matthew Heon 9ab256f72a Make database write in syncContainer conditional
This should help with performance when executing many operations
on a single container

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

Closes: #185
Approved by: rhatdan
2018-01-04 14:33:47 +00:00
baude c78d3769f1 Remove kpod handling of conmon
We don't want libkpod overrides for conmon's path to misdirect
the already set path for conmon from libpod.

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

Closes: #181
Approved by: baude
2018-01-03 20:10:15 +00:00
Daniel J Walsh 00d38cb379 podman create/run need to load information from the image
We should be pulling information out of the image to set the
defaults to use when setting up the container.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #110
Approved by: mheon
2018-01-03 12:38:18 +00:00
baude 8aeb38e4a7 libpod/container.go Handle systemd resolve
In cases, like Ubuntu, where it uses systemd resolve
for DNS then do not copy /etc/resolv.conf but instead
the resolv.conf in the systemd resolve /run dir.

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

Closes: #177
Approved by: rhatdan
2018-01-02 21:22:07 +00:00
Matthew Heon de6d5b75ac Ensure that names are reasonable via regex
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #175
Approved by: rhatdan
2018-01-02 19:54:45 +00:00
baude 1a48c426c9 Extend search path for conmon
Adding /usr/libexec/crio/conmon to the list of places to
look for conmon.

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

Closes: #172
Approved by: rhatdan
2018-01-02 16:03:02 +00:00
Daniel J Walsh 1f49f555af Plumb through the --stop-timeout signal handling
podman run/create have the ability to set the stop timeout flag.
We need to stop it in the database.

Also Allowing negative time for stop timeout makes no sense, so switching
to timeout of uint, allows user to specify huge timeout values.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #158
Approved by: TomSweeneyRedHat
2017-12-20 18:10:43 +00:00
umohnani8 26a6e0de46 Add podman commit command
podman commit allows the user to commit containers
as images with options of tagging th image, setting
a commit message, setting the auther, and making
changes to the instructions.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #143
Approved by: rhatdan
2017-12-20 10:08:17 +00:00
Daniel J Walsh 44a3187830 Finish implementing stop signal parsing
Stop Signal from kpod create/run was not fully plumbed in,
This will pass the stopsignal into the container database on
create and run of containers.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #156
Approved by: mheon
2017-12-19 20:18:14 +00:00
Daniel J Walsh 94a8107515 Add support for adding devices to container
Also add --quiet option to kpod create/run since
this will help with writing tests.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #140
Approved by: TomSweeneyRedHat
2017-12-19 18:51:52 +00:00
Matthew Heon 1f0f7f3e7d Ensure libkpod.Config defaults don't override libpod defaults
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #109
Approved by: mheon
2017-12-14 23:59:22 +00:00
Matthew Heon 7981b7636b Change default directory for CNI plugins
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #109
Approved by: mheon
2017-12-14 23:59:22 +00:00
Matthew Heon 08762dcd61 Add debugging statements
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #109
Approved by: mheon
2017-12-14 23:59:21 +00:00
Matthew Heon 840eb04e03 Add iptables integration to network code
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #109
Approved by: mheon
2017-12-14 23:59:21 +00:00
Matthew Heon 22287fef01 Remove network namespaces from DB on refresh
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #109
Approved by: mheon
2017-12-14 23:59:21 +00:00
Matthew Heon e871075895 Fix unit tests
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #109
Approved by: mheon
2017-12-14 23:59:21 +00:00
Matthew Heon ff9c965335 Create new network namespaces when initializing containers
Also fix a few lingering lint issues

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

Closes: #109
Approved by: mheon
2017-12-14 23:59:21 +00:00
Matthew Heon 0ff92f8e20 Add network namespaces to SQL state
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #109
Approved by: mheon
2017-12-14 23:59:21 +00:00
Matthew Heon 824a648fcb Add basic functions for dealing with network namespaces
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #109
Approved by: mheon
2017-12-14 23:59:21 +00:00
Matthew Heon 16237fe067 Add networking configuration to the libpod DB
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #109
Approved by: mheon
2017-12-14 23:59:21 +00:00
Matthew Heon 2bc20dd4d2 Wire in net plugin into libpod
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #109
Approved by: mheon
2017-12-14 23:59:21 +00:00
baude 3ba2c3e117 kpod top
Display information about processes in a running container.

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

Closes: #121
Approved by: rhatdan
2017-12-14 22:22:56 +00:00
umohnani8 1e7d880b56 Add manifest type conversion to kpod push
User can select from 3 manifest types: oci, v2s1, or v2s2
e.g kpod push --format v2s2 alpine dir:my-directory
Added "compress" flag to enable compression when true

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #126
Approved by: rhatdan
2017-12-14 18:37:17 +00:00
Matthew Heon bf0d359047 Remove lock existence checks when creating pods/containers
Given that we don't have a good way of cleaning up locks, these
could potential cause issues if we ever reuse a container or pod
ID

Also changes locks dir to use tmpfs, as we can't directly clean
up locks

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

Closes: #138
Approved by: rhatdan
2017-12-14 18:18:16 +00:00
Matthew Heon 6d29768864 Update pods to use file locks
Also includes misc other fixes - adding labels, fixing pod names

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

Closes: #138
Approved by: rhatdan
2017-12-14 18:18:16 +00:00
baude f820309413 Copy resolv.conf into container
For DNS to work properly, we need to copy the host's /etc/resolv.conf
into the container during Init().  We do this by copying it into the
containers rundir and then bind mounting it into the container.

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

Closes: #130
Approved by: baude
2017-12-14 01:12:10 +00:00
umohnani8 5330d3da7c Update kpod info to use new libpod api
Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #124
Approved by: mheon
2017-12-14 00:54:21 +00:00
baude 9cc0c8ae14 kpod stats
Move kpod stats to the libpod backend.

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

Closes: #113
Approved by: baude
2017-12-13 21:15:09 +00:00
umohnani8 74ee579375 Update kpod inspect to use the new container state
kpod inspect now uses the new libpod container state
and closely matches the output of docker inspect
some aspects of it are still WIP as the libpod container state
is still being worked on

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-12-12 09:46:23 -05:00
Suraj Deshmukh e64da85ccb Use debugf to allow parsing of format specifier
Signed-off-by: Suraj Deshmukh <surajd.service@gmail.com>
2017-12-12 00:13:44 +05:30
umohnani8 622d5e3b9a Fix misleading print statement in kpod load
When loading an image, kpod load would print something like
"Trying to pull docker.io/library/alpine...", which is misleading
and makes it sound like its pulling it form the registry.
Fixed this by removing these print statements for kpod load

Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-12-11 12:07:54 -05:00
Daniel J Walsh 12682aa475
Merge pull request #72 from mheon/file_locking
Move containers to file locks from c/storage
2017-12-11 10:48:29 -06:00
Daniel J Walsh 62e19beeec
Merge pull request #94 from mheon/restart
Add handling for system restart in libpod
2017-12-11 10:47:50 -06:00
Daniel J Walsh 915410aaff
Merge pull request #111 from mheon/crio_1206
Carry CRI-O #1206 to fix a potential runtime issue
2017-12-11 10:44:57 -06:00
Daniel J Walsh 7e179b6ddb
Merge pull request #115 from umohnani8/containers
Vendor in latest upstream containers/image
2017-12-11 10:42:36 -06:00
umohnani8 eaf4d6c8c2 Vendor in latest upstream containers/image
Signed-off-by: umohnani8 <umohnani@redhat.com>
2017-12-11 09:51:34 -05:00
baude e8a32e3722 kpod exec
Initial wiring of kpod exec. We wont support the following options
for exec:

* detach -- unsure of use case
* detach-keys -- not supported by runc
* interactive -- all terminals will be interactive

Not adding exec tests as we need to think about how to support a
test that requires console access but our CI tests have no console.

Signed-off-by: baude <bbaude@redhat.com>
2017-12-11 08:24:30 -06:00
Matthew Heon 00df767a99 Carry CRI-O #1206 to fix a potential runtime issue
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-12-07 14:44:21 -05:00
umohnani8 8d31ec2ad7 Add Artifacts directory to containers
Create an artifacts directory in the container's
static directory so store container information
coming from outside of libpod to specified files
An example is to hold data from user specified flags
in kpod run/create such as --cap-add, --ipcMode, etc...

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #108
Approved by: mheon
2017-12-07 18:45:54 +00:00
Matthew Heon b71cde19c8 Add ability to refresh state in DB
Also, ensure we always recreate runtime spec so our net namespace
paths will be correct

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-12-07 13:15:34 -05:00
Matthew Heon b66287689a Do not recreate containers in runc after restart
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-12-06 11:15:17 -05:00
Matthew Heon 190b05209f Small comment update to make use of syncContainer more obvious
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-12-05 19:02:32 -05:00
Matthew Heon 70da705c36 Remove check for existance of lockfile when retrieving containers
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-12-05 10:04:59 -05:00
Matthew Heon ceb7fb1c60 Do not recreate OCI spec in init() if it exists
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-12-05 09:30:51 -05:00
Matthew Heon 92bc448624 Fix potential race condition in initializing libpod
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-12-04 14:45:49 -05:00
Matthew Heon ae5aac50aa Add handling for system restart in libpod
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-12-04 14:29:59 -05:00
Matthew Heon eb942b1b47 Fix lint
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-12-04 14:18:48 -05:00
Matthew Heon 43c51c58ad Fix unit tests and provide more realistic test environment
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-12-04 13:40:27 -05:00
Matthew Heon e9298a533a Remove SQL state locking and rely on sqlite locking
Also renames some parameters from locksDir -> lockDir for
consistency.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-12-04 13:40:27 -05:00
Matthew Heon abfd18b0db Move containers to file locks from c/storage
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-12-04 13:39:44 -05:00
Matthew Heon 750fc239b5 Consolidate mount logic
There are still two places that don't use the new function,
export and mount, but both can probably be converted to it
in the future.

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

Closes: #99
Approved by: rhatdan
2017-12-04 18:10:52 +00:00
Daniel J Walsh 1f482c9f1f You can only attach to running containers
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #98
Approved by: mheon
2017-12-04 17:53:23 +00:00
Daniel J Walsh 55c8b69d8f When shutting down the runtime we should always close the database
Even if the storage fails to shutdown. This patch fixes on TODO.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #97
Approved by: mheon
2017-12-04 17:17:06 +00:00
Daniel J Walsh adf8809521 Add NetMode, UTSMode and IPCMode
Allow kpod create/run to create contianers in different network namespaces, uts namespaces and
IPC Namespaces.

This patch just handles the simple join the host, or another containers namespaces.

Lots more work needed to full integrate  --net

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #64
Approved by: mheon
2017-12-02 15:32:56 +00:00
Matthew Heon 7eb5ce940c Add schema validation to DB
This ensures we don't open a DB with an earlier schema or a
config that differs from ours

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

Closes: #86
Approved by: rhatdan
2017-11-30 18:05:56 +00:00
Matthew Heon 1f9c8942f1 Add randomly generates container names
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #88
Approved by: baude
2017-11-30 02:03:23 +00:00