Commit graph

2513 commits

Author SHA1 Message Date
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
baude 742475885e kpod_start
Starts one or more containers.

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

Closes: #83
Approved by: rhatdan
2017-11-29 22:01:47 +00:00
Daniel J Walsh cefa782e50 Move libpod under containers/storage
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #65
Approved by: mheon
2017-11-29 20:40:50 +00:00
Matthew Heon 13e833a388 Change location of created runc specs to make them survive reboot
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #78
Approved by: rhatdan
2017-11-29 18:43:56 +00:00
Matthew Heon d55cb0f589 Fix error in runtime_ctr
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #85
Approved by: rhatdan
2017-11-29 17:57:32 +00:00
Matthew Heon 681a8c85ed Ensure that we can't remove paused containers
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #85
Approved by: rhatdan
2017-11-29 17:57:32 +00:00
Matthew Heon ce3081786b Fix rmi -f removing containers from storage without telling libpod
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #68
Approved by: rhatdan
2017-11-29 12:15:16 +00:00
Matthew Heon ed41a290a2 Fix removing running containers
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #68
Approved by: rhatdan
2017-11-29 12:15:16 +00:00
Matthew Heon 66ed73f89f First pass at fixing test errors
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #68
Approved by: rhatdan
2017-11-29 12:15:16 +00:00
Matthew Heon bbef986214 Fix comment on container.Stop()
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #68
Approved by: rhatdan
2017-11-29 12:15:15 +00:00
Matthew Heon 4f8fe2b810 Shut down containers when force stopping the runtime
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #68
Approved by: rhatdan
2017-11-29 12:15:15 +00:00
Matthew Heon 831e2c30d4 Add ability to kill and stop containers
Also migrates kpod kill and kpod stop to libpod to use the new code

Fixes force removing containers, and actually deletes containers in runc when
removing them

Start is now capable of starting even when the container is unmounted

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

Closes: #68
Approved by: rhatdan
2017-11-29 12:15:15 +00:00
baude 342ce4db50 kpod ps
Wire up kpod ps with the new libpod container backend.

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

Closes: #67
Approved by: rhatdan
2017-11-28 14:47:35 +00:00
Suraj Deshmukh 7eb4772694 remove unused functions and variables
Signed-off-by: Suraj Deshmukh <surajd.service@gmail.com>

Closes: #71
Approved by: rhatdan
2017-11-28 14:30:12 +00:00
TomSweeneyRedHat d43f786728 Add docker transport to push image before final failure
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>

Closes: #42
Approved by: rhatdan
2017-11-28 12:53:25 +00:00
baude 52ea0deee6 kpod_wait
Convert to libpod container backend

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

Closes: #70
Approved by: rhatdan
2017-11-27 19:05:59 +00:00
baude 61e0ab4f47 Create|Run container from Image ID
As reported in Issue #50, we need to be able to run
or create a container based on an image ID (as well
as name).

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

Closes: #76
Approved by: rhatdan
2017-11-27 16:41:08 +00:00
umohnani8 b1a3b03068 Update kpod pause and unpause to use new container state
Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #66
Approved by: mheon
2017-11-24 15:53:17 +00:00
umohnani8 40dce698d3 Update kpod mount and umount to use the new state
The new state for containers has been added
moved kpod mount and umount over to use it

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

Closes: #57
Approved by: rhatdan
2017-11-22 18:23:19 +00:00
Matthew Heon 34ba0cb8a9 Order containers returned from state and make container config public
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #63
Approved by: baude
2017-11-22 18:12:57 +00:00
Urvashi Mohnani 2a3934f1da Update kpod export to use the new container state and runtime
Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>

Closes: #59
Approved by: rhatdan
2017-11-22 16:17:06 +00:00
Matthew Heon 4ff251d911 Add PID to the containers used to test SQLite state
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #56
Approved by: rhatdan
2017-11-21 20:09:09 +00:00
Matthew Heon 152882bf19 Add ability to retrieve container's log path to API
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #56
Approved by: rhatdan
2017-11-21 20:09:09 +00:00
Matthew Heon 8e76ebcf6e Add ability to update container status from runc
Wire this in to all state-bound container operations to ensure
syncronization of container state.

Also exposes PID of running containers via API.

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

Closes: #56
Approved by: rhatdan
2017-11-21 20:09:09 +00:00
Matthew Heon 51fc8827f5 Add tests for SQL-backed state impl
Minor changes to container.go and sql_state.go to fix issues
identified by the tests

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-20 16:24:28 -05:00
Matthew Heon f2894eda68 Fix lint errors
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-18 13:17:03 -05:00
Matthew Heon 898138441d Need to provide ID of container being updated
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-18 12:58:48 -05:00
Matthew Heon b10fb66c28 StopSignal is allowed to be 0
If StopSignal is 0, it is assumed that the default signal will be used.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-18 12:58:48 -05:00
Matthew Heon 12f19ca013 Resolve another segfault
This one cleans up after container creation fails

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-18 12:58:48 -05:00
Matthew Heon 657cb1b7f6 Fix lingering SQL error
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-18 12:58:48 -05:00
Matthew Heon 57300be94d Fix segfault cleaning up in after failing to create a Runtime
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-18 12:58:48 -05:00
Matthew Heon 4bc3acc7aa Rename Create to Init for containers to be less confusing
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-18 12:58:48 -05:00
Matthew Heon 763e372649 Wire SQL backed state into rest of libpod
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-18 12:58:48 -05:00
Matthew Heon cb56716fc4 Address review comments, fix gofmt and lint
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-18 12:54:05 -05:00
Matthew Heon c6fe4430b7 Compile-tested implementation of SQL-backed state
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-18 12:54:05 -05:00
baude d2eda1a864 Enhancements to papr tests
The PR contains several enhancements to our CI testing.

- enable lint testing on Fedora
- add Centos Atomic as test platform
- integration tests on run on the OS natively (uncontainerized)
- builds are done in containers
- inclusion of Vagrant file for local testing

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

Closes: #18
Approved by: mheon
2017-11-17 02:07:18 +00:00
baude acd9c66864 Fix terminal attach
Re-order the startup of a new container via run from
initialize > start > attach to initialize > attach > start.

This fixes output when running:

kpod run -i -t IMAGE command

and

kpod run IMAGE command

Signed-off-by: baude <bbaude@redhat.com>
2017-11-15 16:27:57 -06:00
baude 5cfd7a313f Address run/create performance issues
Fixed the logic where we observed different performance
results when running an image by its fqname vs a shortname. In
the case of the latter, we resolve the name without using the
network.

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

Closes: #37
Approved by: rhatdan
2017-11-14 21:14:13 +00:00
Urvashi Mohnani 23979f8e06 Add 'kpod import' command
Imports a tarball and saves it as a filesystem image

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

Closes: #12
Approved by: rhatdan
2017-11-07 19:16:31 +00:00
Daniel J Walsh df54adeaae Respect the quiet flag.
When setting the `kpod load -q` flag, output was still going to the
screen.  This patch adds a check to not output to the terminal unless
there is an io.Writer specified, and then to write to the io.Writer.

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

Closes: #23
Approved by: rhatdan
2017-11-07 15:37:50 +00:00
baude 0026075d59 libpod/runtime_img_test.go Unit Tests
Unit tests for getRegistry related functions.

Signed-off-by: baude <bbaude@redhat.com>
2017-11-04 11:12:14 -05:00
baude 99ca35f185 util_test.go: Unittests for util.go
Add unit tests for func StringInSlice.

Signed-off-by: baude <bbaude@redhat.com>
2017-11-03 20:37:27 -05:00
Daniel J Walsh 098389dc3e Parse SecurityOpts
This should turn on handling of SELinux, NoNewPrivs, seccomp and Apparmor

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

Closes: #15
Approved by: rhatdan
2017-11-03 20:55:10 +00:00
Daniel J Walsh 92818fdfb7 Fix gofmt errors
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-11-02 15:30:39 -04:00
Matthew Heon 32f352d846 Fix trivial import issue
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-01 15:39:04 -04:00
baude 8cf07b2ad1 libpod create and run
patched version of the same code that went into crio

Signed-off-by: baude <bbaude@redhat.com>
2017-11-01 14:19:19 -05:00
Matthew Heon c13f61798a Prune Server package. Convert to new github location.
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-01 13:22:04 -04:00
Matthew Heon a031b83a09 Initial checkin from CRI-O repo
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
2017-11-01 11:24:59 -04:00