Commit graph

22 commits

Author SHA1 Message Date
Mrunal Patel
1dc4c87c93
conmon: add timestamps to logs
CRI requires us to timestamp our logs line-by-line by specifying whether
the line came from std{out,err} and the time at which the log was
recieved. This is a preliminary implementation of said behaviour
(without explicit newline handling at the moment).

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-04-05 02:45:57 +10:00
Aleksa Sarai
14a37fb407
conmon: use pipes rather than socketpairs for !terminal
While pipes have their downsides, it turns out that socketpair(2) will
break any program that tries to open /dev/std{out,err} for writing
(because they're symlinked to /proc/1/fd/{1,2} which will cause lots of
fun issues with sockets).

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-04-05 02:45:57 +10:00
Aleksa Sarai
c290c0d9c3
conmon: implement logging to logPath
This adds a very simple implementation of logging within conmon, where
every buffer read from the masterfd of the container is also written to
the log file (with errors during writing to the log file ignored).

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2017-04-05 02:45:57 +10:00
Samuel Ortiz
d60d0ac0c3
conmon: Use conmon for exec'ing a command
Some OCI container runtimes (in particular the hypervisor
based ones) will typically create a shim process between
the hypervisor and the runtime caller, in order to not
rely on the hypervisor process for e.g. forwarding the
output streams or getting a command exit code.

With these runtimes we need to monitor a different process
than the runtime one when executing a command inside a
running container. The natural place to do so is conmon
and thus we add a new option to conmon for calling the
runtime exec command, monitor the PID and then return the
running command exit code through the sync pipe to the
parent.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-01-14 02:02:40 +01:00
Samuel Ortiz
468746aa28
conmon: Use the full PID file path
And not a hardcoded "pidfile".

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-01-14 02:02:37 +01:00
Samuel Ortiz
9a4a1092fe
conmon: Return the exit status code
waitpid fills its second argument with a value that
contains the process exit code in the 8 least significant
bits. Instead of returning the complete value and then
convert it from ocid, return the exit status directly
by using WEXITSTATUS from conmon.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2017-01-14 02:00:45 +01:00
Mrunal Patel
6df58df215 Add support for systemd cgroups
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2016-12-19 16:31:29 -08:00
Mrunal Patel
e790094f23 Merge pull request #194 from sameo/master
Conmon fixes
2016-11-15 09:47:13 -08:00
Samuel Ortiz
b14bae4869 conmon: Add --bundle and --pidfile command line options
We need to be able pass both the bundle path and the pid file
paths to conmon from ocid.
The former is mandatory when creating an OCI container:

https://github.com/opencontainers/runtime-spec/blob/master/runtime.md#create

And it makes sense to provide a full path for the latter as the
current hardcoded relative path may lead to errors if e.g. the
runtime chdir() before creating the PID file.

In both cases we try to create default reasonable values when
they are left empty by the caller.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2016-11-15 14:11:42 +01:00
Mrunal Patel
562f8ca684 Add syslog support
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2016-11-14 16:02:03 -08:00
Antonio Murdaca
8601a70a39 Merge pull request #90 from alobbs/fix-89
Ports conmon from getopt() to glib's parsing mechanism
2016-10-07 13:42:51 +02:00
Aleksa Sarai
bd9acaf584
conmon: minor fixes
This fixes a bug where --conmon wouldn't actually set the conmon binary
path, and also where we weren't setting CFLAGS while compiling conmon.

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2016-10-02 20:11:16 +11:00
Alvaro Lopez Ortega
fe086ff7e0 Ports conmon from getopt() to glib's parsing mechanism
conmon uses getopt() even if it's a glib based application,
and therefore could use the much more modern and flexible
GOptionContext mechanism. Fixes #89

Signed-off-by: Alvaro Lopez Ortega <alvaro@gnu.org>
2016-09-30 23:26:29 -04:00
Alvaro Lopez Ortega
54b862f86f Fixes Makefile so CFLAGS/LIBS are accepted as a make parameter
It should be possible to run make with compilation CFLAGS / LIBS
paramaters. For instance, 'make CFLAGS="-g3 -O0"'. Fixes #87

Signed-off-by: Alvaro Lopez Ortega <alvaro@gnu.org>
2016-09-30 22:15:30 -04:00
Antonio Murdaca
430e1d298b
conmon: booleans already from stdbool.h
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-09-24 00:38:07 +02:00
Antonio Murdaca
0ebf110b95
conmon: fix c11 for declaration
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-09-24 00:38:07 +02:00
Antonio Murdaca
4a4897bbfe
conmon: use runtime path from ocid
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-09-17 11:37:45 +02:00
Mrunal Patel
02236bbda0 Integrate conmon into ocid
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-09-15 16:40:44 -07:00
Mrunal Patel
a7ca60ae30 Separate tty/non-tty and add opt parsing
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-09-12 16:38:30 -07:00
Mrunal Patel
bce17e63f6 Add support for console handling
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-09-09 14:41:03 -07:00
Mrunal Patel
7124d42257 Add a Makefile for conmon
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-09-09 14:41:03 -07:00
Mrunal Patel
530a258376 Add a container monitor process
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-09-09 14:41:03 -07:00