Commit Graph

92 Commits

Author SHA1 Message Date
Daniel J Walsh dc025819f4 Fix nameing of Namespaces to be more consistent
Figuring out the difference between a User and a USERNS
as well as Cgroup and CGROUPNS

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

Closes: #1417
Approved by: TomSweeneyRedHat
2018-09-06 17:54:52 +00:00
Valentin Rothberg 3839c00ae2 don't print help message for usage errors
Don't print potentially verbose help messages in case of usage errors,
but print only the usage error followed by a pointer to the command's
help.  This aligns with Docker.

```
$ podman run -h
flag needs an argument: -h
See 'podman run --help'.
```

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

Closes: #1379
Approved by: rhatdan
2018-08-31 10:19:11 +00:00
Matthew Heon 2bc6427302 Fix handling of multiple filters in podman ps
Docker expects multiple filters to be passed with multiple uses
of the --filter flag (e.g. --filter=label=a=b --filter=label=c=d)
and not a single comma-separated list of filters as we expected.
Convert to the Docker format, and make some small cleanups to our
handling of filters along the way.

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

Closes: #1345
Approved by: umohnani8
2018-08-27 14:47:41 +00:00
haircommander 2a7449362f Change pause container to infra container
Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1187
Approved by: mheon
2018-08-23 18:16:28 +00:00
haircommander d5e690914d Added option to share kernel namespaces in libpod and podman
A pause container is added to the pod if the user opts in. The default pause image and command can be overridden. Pause containers are ignored in ps unless the -a option is present. Pod inspect and pod ps show shared namespaces and pause container. A pause container can't be removed with podman rm, and a pod can be removed if it only has a pause container.

Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1187
Approved by: mheon
2018-08-23 18:16:28 +00:00
Daniel J Walsh 89a9750b6d Don't fail on size.
I think a created container which was never run will have no size struct
we should just return 0

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

Closes: #1288
Approved by: TomSweeneyRedHat
2018-08-17 09:02:10 +00:00
haircommander 8d5e0108d7 Change batchcontainer to shared
To better reflect it's usage: to share functions between podman and varlink.

Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1275
Approved by: mheon
2018-08-16 20:31:50 +00:00
Daniel J Walsh d20f3a5146 switch projectatomic to containers
Need to get some small changes into libpod to pull back into buildah
to complete buildah transition.

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

Closes: #1270
Approved by: mheon
2018-08-16 17:12:36 +00:00
Matthew Heon 71793f9f8a Improve ps handling of container start/stop time
Previously all calculations were done based off the container's
start time. Retrieve end time and use it to calculate time
stopped for containers.

Also, convert ps JSON output to report timestamps for create,
start, and stop times.

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

Closes: #1228
Approved by: rhatdan
2018-08-08 12:37:51 +00:00
haircommander 26b9b17d27 Added ps --pod option
Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1205
Approved by: rhatdan
2018-08-02 20:39:06 +00:00
Joshua Roys ea5fad6c8b Fix ps filter with key=value labels
Closes: #1101
Approved by: rhatdan
2018-07-16 18:27:02 +00:00
Matthew Heon 259136c36c Change logic for detecting conflicting flags in ps
There's no reason --size cannot be used together with a Go
template - in fact, using a Go template for {{.Size}} without
--size being passed will not work.

Allow use of --namespace and --size with Go templates, but not
with --quiet. Do not allow --namespace and --size at the same
time.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-07-13 16:00:23 -04:00
Matthew Heon 5b43a6a7ee Only print container size JSON if --size was requested
To do this, move it into a separate struct, and embed that in
the JSON we return.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-07-13 14:28:41 -04:00
Matthew Heon f08fffa306 Don't print rootfs and rw sizes if they're empty
We're printing them unconditionally now, even if --size is not
passed, which is confusing (you see a pair of 0s for container
size, when it is clearly not 0).

This may introduce bugs related to containers with an rwsize of 0
(freshly created from an image) and --size specified, but is
definitely better than what we have now.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-07-13 14:28:41 -04:00
Matthew Heon 4c44185199 Major fixes to podman ps --format=json output
A number of fields were never being populated. Populate them as
best we can.

Add a new field, exited, to indicate whether the exit code has
meaning (IE, the container has exited).

Fix handling of running time - it stops ticking when the
container stops. There is further work needed here, I suspect.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-07-13 14:28:41 -04:00
Matthew Heon d25ebcc35b Ignore running containers in ps exit-code filters
Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-07-13 14:28:41 -04:00
Matthew Heon 028374b99e Record whether the container has exited
Use this to supplement exit codes returned from containers, to
make sure we know when exit codes are invalid (as the container
has not yet exited)

Signed-off-by: Matthew Heon <mheon@redhat.com>
2018-07-13 14:28:41 -04:00
haircommander a1f3d44497 Changed container status of Unknown from being printed as Dead to Error in Ps
Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #1083
Approved by: rhatdan
2018-07-12 17:21:06 +00:00
Daniel J Walsh b23371cb1d Containers can dissappear
Between the time that ps command gets the list of containers
and is able to ask for more data, the container could have
exited.  This patch logs Clibpod.ErrNoSuchCtr errors and just continues
processing.

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

Closes: #996
Approved by: mheon
2018-06-26 09:46:29 +00:00
haircommander 4ab054073d Added --sort to ps
Also podman ps now allows user to only output size of root FS, changed language of images and ps --sort to be by "created" as opposed to "time", and refactored the way templates are created (converted from psJSONParams type).

Signed-off-by: haircommander <pehunt@redhat.com>

Closes: #948
Approved by: rhatdan
2018-06-19 14:45:29 +00:00
Matthew Heon 452cb26d0d Implement --latest for ps
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #944
Approved by: rhatdan
2018-06-14 19:03:52 +00:00
Matthew Heon cdb447bba2 Correctly report errors retrieving containers in ps
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #944
Approved by: rhatdan
2018-06-14 19:03:51 +00:00
Daniel J Walsh 65033b586f add podman container and image command
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #941
Approved by: TomSweeneyRedHat
2018-06-13 14:30:45 +00:00
baude 9ace06e0c2 sort containers and images by create time
When running podman ps or podman images, the containers and images should
be sorted by newest to oldest.

Resolves: #830

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

Closes: #848
Approved by: mheon
2018-05-30 16:30:20 +00:00
baude 82feafecdd podman create, start, getattachsocket
First pass at implement API endpoints for create and start.

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

Closes: #805
Approved by: baude
2018-05-21 19:26:56 +00:00
Matthew Heon 0906b3094d Fix calculation of RunningFor in ps json output
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #727
Approved by: rhatdan
2018-05-05 11:48:06 +00:00
baude 8dfebd4607 varlink containers
first pass at adding in the container related endpoints/methods for the libpod
backend. Couple of important notes:

* endpoints that can use a console are not going to be done until we have "remote" console
* several of the container methods should probably be able to stream as opposed to a one-off return

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

Closes: #708
Approved by: baude
2018-05-03 17:31:33 +00:00
baude 39a7a773a6 varlink images
implement varlink image functions for working with libpod with the exception of a
couple due to incompletions on the libpod side of things (build).

also, created a first pass at a libpodpy package which will stand as a client to
working with libpod's varlink methods using python.

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

Closes: #669
Approved by: baude
2018-04-26 19:14:44 +00:00
baude b85b217f55 Stage3 Image Library
This represents the stage3 implementation for the image library.  At this point, we
are moving the image-centric functions to pkg/image including migration of args and
object-oriented references.  This is a not a one-for-one migration of funcs and some
funcs will need to continue to reside in runtime_img as they are overly specific to
libpod and probably not useful to others.

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

Closes: #484
Approved by: baude
2018-03-14 20:21:31 +00:00
Matthew Heon 7516dfd8c5 Fix a potential race around container removal in ps
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #467
Approved by: baude
2018-03-09 02:14:12 +00:00
baude 984dfecb2c podman ps command string too long
The default outout for podman ps should limit itself if the command is long. If the command
is more than 20 characters, we truncate the command and add an elipses to it.

Resolves: #464

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

Closes: #466
Approved by: rhatdan
2018-03-09 01:45:51 +00:00
baude f47a5be60d ps displays incorrect exit code
The exit code should be derived in the batch operation and pulled
from the batchinfo struct.

Resolves issue #407

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

Closes: #408
Approved by: rhatdan
2018-02-26 23:18:36 +00:00
baude e97ca5bd38 podman ps json output use batched ops
The podman ps command for non-json targets has the ability to use a "batched" function
which limits the use of locks needed.  The collection of output for JSON should use
this too.

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

Closes: #380
Approved by: rhatdan
2018-02-23 17:56:51 +00:00
baude 4fa341e56a PS performance cleanups
By not getting data that we don't need and adding more locking
functions under the batch, we are able to cut the time for listing
50 containers in half.  More to come.

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

Closes: #325
Approved by: mheon
2018-02-14 15:18:43 +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
umohnani8 4c7bab9812 Fixed Created At and Running For value
Changed the Created At value to match the format of docker ps
and fixed the value for Running For to reflect the time elapsed
since the container has been started. Initially it was showing
the time elapsed since the container was created.

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

Closes: #257
Approved by: rhatdan
2018-01-25 02:57:40 +00:00
Daniel J Walsh 274908fd13
Merge pull request #251 from baude/psbatch
Use batched operations in ps
2018-01-23 21:15:02 -05:00
baude c04fb6c564 Use batched operations in ps
Because the podman ps command has to collection a lot of information
from various places, many of which are controlled by locks, it is a
good candidate for doing batch operations under a single lock.

Signed-off-by: baude <bbaude@redhat.com>
2018-01-22 14:31:50 -06: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 05317d8f91 Fix output for created containers
Created containers that haven't hit runc yet should still
be considered created (not dead).

Also, fixed loop for deleting containers as leftover code
still exited there that prevented proper deletion of containers
that could be deleted.

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

Closes: #238
Approved by: rhatdan
2018-01-18 18:32:10 +00:00
Daniel J Walsh 5770dc2640 Rename all references to kpod to podman
The decision is in, kpod is going to be named podman.

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

Closes: #145
Approved by: umohnani8
2017-12-18 16:46:05 +00:00