Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.

cli: implement ps command#444

Merged
jodh-intel merged 1 commit intoclearcontainers:masterfrom
devimc:topic/psCommand
Dec 7, 2017
Merged

cli: implement ps command#444
jodh-intel merged 1 commit intoclearcontainers:masterfrom
devimc:topic/psCommand

Conversation

@devimc
Copy link
Copy Markdown

@devimc devimc commented Aug 22, 2017

ps command is used by docker top to show
the processes running inside the container

partially fixes #95

Signed-off-by: Julio Montes julio.montes@intel.com

@devimc
Copy link
Copy Markdown
Author

devimc commented Aug 22, 2017

depends on containers/virtcontainers#269

@clearcontainersbot
Copy link
Copy Markdown

metrics-failed

4 similar comments
@clearcontainersbot
Copy link
Copy Markdown

metrics-failed

@clearcontainersbot
Copy link
Copy Markdown

metrics-failed

@clearcontainersbot
Copy link
Copy Markdown

metrics-failed

@clearcontainersbot
Copy link
Copy Markdown

metrics-failed

@clearcontainersbot
Copy link
Copy Markdown

Popular Images qa-failed 👎

1 similar comment
@clearcontainersbot
Copy link
Copy Markdown

Popular Images qa-failed 👎

@clearcontainersbot
Copy link
Copy Markdown

Popular Images qa-failed 👎

@clearcontainersbot
Copy link
Copy Markdown

kubernetes qa-failed 👎

2 similar comments
@clearcontainersbot
Copy link
Copy Markdown

kubernetes qa-failed 👎

@clearcontainersbot
Copy link
Copy Markdown

kubernetes qa-failed 👎

@jodh-intel
Copy link
Copy Markdown

Still blocked on containers/virtcontainers#269.

@clearcontainersbot
Copy link
Copy Markdown

kubernetes qa-failed 👎

@clearcontainersbot
Copy link
Copy Markdown

kubernetes qa-failed 👎

2 similar comments
@clearcontainersbot
Copy link
Copy Markdown

kubernetes qa-failed 👎

@clearcontainersbot
Copy link
Copy Markdown

kubernetes qa-failed 👎

@sboeuf
Copy link
Copy Markdown

sboeuf commented Oct 30, 2017

@devimc please rebase this PR in order to get the CI properly running.

@devimc devimc force-pushed the topic/psCommand branch 2 times, most recently from 960371d to f1d3620 Compare October 30, 2017 15:47
Copy link
Copy Markdown

@sboeuf sboeuf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but I would prefer the CLI params to be parsed before to call into ps()

ps.go Outdated
SkipArgReorder: true,
}

func ps(context *cli.Context) error {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer a function prototype like this:

func ps(containerID, format string) error {

since we could reuse this function. Also it is clearer to parse the arguments into the Action callback.

@clearcontainersbot
Copy link
Copy Markdown

kubernetes qa-passed 👍

@devimc
Copy link
Copy Markdown
Author

devimc commented Oct 30, 2017

@sboeuf changes applied

@devimc
Copy link
Copy Markdown
Author

devimc commented Nov 13, 2017

@jodh-intel cc-proxy was updated, can you please try again?

@clearcontainersbot
Copy link
Copy Markdown

kubernetes qa-passed 👍

@jodh-intel
Copy link
Copy Markdown

jodh-intel commented Nov 14, 2017

Still no joy I'm afraid:

$ sudo docker ps                                     
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
f91b2811adfc        busybox             "sh"                6 seconds ago       Up 3 seconds                            laughing_knuth
$ sudo cc-runtime list      
ID                                                                 PID         STATUS      BUNDLE                                                                                       CREATED                          OWNER
f91b2811adfc8d1ce315c26bfbcf930795c06a77a82a5a04cd05c082b1fa1b26   10685       running     /run/docker/libcontainerd/f91b2811adfc8d1ce315c26bfbcf930795c06a77a82a5a04cd05c082b1fa1b26   2017-11-14T08:47:09.121827607Z   #0
$ sudo cc-runtime ps f91b2811adfc8d1ce315c26bfbcf930795c06a77a82a5a04cd05c082b1fa1b26
ERROR received from VM agent

That (not terribly helpful) error seems to be coming from:

There isn't anything else useful in journald fwics.

@clearcontainersbot
Copy link
Copy Markdown

kubernetes qa-passed 👍

@jodh-intel
Copy link
Copy Markdown

I've just re-tested with latest runtime + latest agent but same problem :(

(It would be great to get this landed soon as I know how tricky it's been to add the required functionality to various parts of the system).

@devimc
Copy link
Copy Markdown
Author

devimc commented Nov 27, 2017

Hi @jodh-intel , still waiting for clearcontainers/agent#90

@devimc
Copy link
Copy Markdown
Author

devimc commented Nov 27, 2017

@jodh-intel it works for me

$ docker run -dti debian bash
264d40dd43f376b37dbd1af3783d9e6b2e2d0c0ec4d66111a6f6777c140e1ff0
$ sudo cc-runtime list
ID                                                                 PID         STATUS      BUNDLE                                                                                       CREATED                          OWNER
264d40dd43f376b37dbd1af3783d9e6b2e2d0c0ec4d66111a6f6777c140e1ff0   6166        running     /run/docker/libcontainerd/264d40dd43f376b37dbd1af3783d9e6b2e2d0c0ec4d66111a6f6777c140e1ff0   2017-11-27T14:12:53.493966351Z   #0
$ sudo cc-runtime ps 264d40dd43f376b37dbd1af3783d9e6b2e2d0c0ec4d66111a6f6777c140e1ff0
UID        PID  PPID  C STIME TTY          TIME CMD
root       163   146  0 14:12 ?        00:00:00 bash

probably we are doing something different

@jodh-intel
Copy link
Copy Markdown

I'm still seeing the problem with image 18860 and also using osbuilder + latest agent. I've tested with busybox and debian docker images. Could you try on another system, or else maybe someone else can try testing this?

@devimc
Copy link
Copy Markdown
Author

devimc commented Nov 28, 2017

Hi @jodh-intel

I'm using fedora + CL container image [1] + latest agent [2]

$ /usr/libexec/clear-containers/cc-proxy --version
Version: 3.0.8-2-g8bae402
$ /mnt/usr/bin/cc-agent --version
{"level":"info","msg":"","name":"cc-agent","pid":28094,"time":"2017-11-28T09:56:11.265027193-06:00","version":"0.1.1+-b1d92e2aa14d915680e8fe770745a511857ac7ff"}
{"level":"info","msg":"agent_started 329416.550221383","name":"cc-agent","pid":28094,"time":"2017-11-28T09:56:11.265258871-06:00"}
{"error":"open /sys/class/virtio-ports: no such file or directory","level":"error","msg":"Could not open channels","name":"cc-agent","pid":28094,"time":"2017-11-28T09:56:11.265343982-06:00"}
$ cc-runtime --version
cc-runtime  : 3.0.8
   commit   : b9c924320b05a6edeaefd8717aefee97df6aece3
   OCI specs: 1.0.0-dev
$ docker run -dti busybox sh
6f4155a11426e1daa6afb70f7c5ee367f235cf73ce666fc8d8eab19a19cc7497
$ sudo cc-runtime ps 6f4155a11426e1daa6afb70f7c5ee367f235cf73ce666fc8d8eab19a19cc7497
UID        PID  PPID  C STIME TTY          TIME CMD
root       164   148  0 15:56 ?        00:00:00 sh

btw osbuilder does not include ps (procps-ng-bin)

[1] - https://download.clearlinux.org/releases/18860/clear/clear-18860-containers.img.xz
[2] - https://github.com/clearcontainers/agent

@clearcontainersbot
Copy link
Copy Markdown

kubernetes qa-passed 👍

@jodh-intel
Copy link
Copy Markdown

I added the procps package (like clearcontainers/osbuilder#41), but I'm still seeing ERROR received from VM agent.

@jodh-intel
Copy link
Copy Markdown

After a rebase (required due to proxy changes), I am now getting the correct ps output! ;)

Could you rebase and we can get this merged?

@devimc
Copy link
Copy Markdown
Author

devimc commented Dec 5, 2017

@jodh-intel great! thanks

@clearcontainersbot
Copy link
Copy Markdown

kubernetes qa-passed 👍

ps.go Outdated

var options vc.ProcessListOptions

// [1:] is to remove command name, ex:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this comment become detached from the code (line 43?)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, :)

ps.go Outdated
var options vc.ProcessListOptions

// [1:] is to remove command name, ex:
// context.Args(): [containet_id ps_arg1 ps_arg2 ...]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: container_id.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks

@jodh-intel
Copy link
Copy Markdown

Hi @devimc - could you re-push? The CI seems to have got confused.

@jodh-intel
Copy link
Copy Markdown

err - it just updated as I was typing! ;)

ps command is used by ```docker top``` to show
the processes running inside the container

partially fixes clearcontainers#95

Signed-off-by: Julio Montes <julio.montes@intel.com>
@devimc
Copy link
Copy Markdown
Author

devimc commented Dec 6, 2017

@jodh-intel changes applied, thanks

@clearcontainersbot
Copy link
Copy Markdown

kubernetes qa-passed 👍

@jodh-intel
Copy link
Copy Markdown

jodh-intel commented Dec 7, 2017

lgtm

Approved with PullApprove Approved with PullApprove

@jodh-intel
Copy link
Copy Markdown

Coveralls is stuck (surprise!) - https://coveralls.io/jobs/31802016.

Merging...

@jodh-intel jodh-intel merged commit 95937d6 into clearcontainers:master Dec 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the runtime ps command

4 participants