Commit graph

28 commits

Author SHA1 Message Date
Giuseppe Scrivano 969cc3237b
utils: move message from warning to debug
if a pid could not be moved to a new cgroup, print a debug message
instead of a warning.

Closes: https://github.com/containers/podman/issues/10674

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-06-16 08:49:57 +02:00
Giuseppe Scrivano 5174797316
utils: improve error message
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-06-16 08:49:56 +02:00
baude 4ab8a6f67e Improvements for machine
clean up ci failures and add appropriate arch,os exclusion tags

Signed-off-by: baude <bbaude@redhat.com>
2021-03-25 11:02:33 -05:00
Valentin Rothberg 5dded6fae7 bump go module to v3
We missed bumping the go module, so let's do it now :)

* Automated go code with github.com/sirkon/go-imports-rename
* Manually via `vgrep podman/v2` the rest

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-02-22 09:03:51 +01:00
Giuseppe Scrivano 660a06f2f7
utils: takes the longest path on cgroup v1
now getCgroupProcess takes the longest path on cgroup v1, instead of
complaining if the paths are different.

This should help when --cgroups=split is used on cgroup v1 and the
process cgroups look like:

$ cat /proc/self/cgroup
11:pids:/user.slice/user-0.slice/session-4.scope
10:blkio:/
9:cpuset:/
8:devices:/user.slice
7:freezer:/
6:memory:/user.slice/user-0.slice/session-4.scope
5:net_cls,net_prio:/
4:hugetlb:/
3:cpu,cpuacct:/
2:perf_event:/

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-02-11 16:46:42 +01:00
Giuseppe Scrivano 1b5f3ed24d
utils: create parent cgroups
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-02-11 09:38:36 +01:00
Giuseppe Scrivano 9196a5ce36
utils: ignore unified on cgroupv1 if not present
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-02-11 09:38:35 +01:00
Giuseppe Scrivano f4fd25a005
utils: skip empty lines
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-02-11 09:38:34 +01:00
zhangguanzhang 95b4478fb4 Fix some nit
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-12-04 09:20:42 +08:00
Giuseppe Scrivano 9a33e064a1
podman, exec: move conmon to the correct cgroup
move the conmon process to the conmon cgroup also on exec.

The previous implementation would fail to move the conmon process as
the systemd unit already exists so its creation would fail.

When the unit cannot be created, attempt to directly join the cgroup
instead.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-12-03 10:03:39 +01:00
Kir Kolyshkin 4878dff3e2 Remove excessive error wrapping
In case os.Open[File], os.Mkdir[All], ioutil.ReadFile and the like
fails, the error message already contains the file name and the
operation that fails, so there is no need to wrap the error with
something like "open %s failed".

While at it

 - replace a few places with os.Open, ioutil.ReadAll with
   ioutil.ReadFile.

 - replace errors.Wrapf with errors.Wrap for cases where there
   are no %-style arguments.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-10-05 15:30:37 -07:00
Matthew Heon e3ced7217f Ensure libpod/define does not include libpod/image
The define package under Libpod is intended to be an extremely
minimal package, including constants and very little else.
However, as a result of some legacy code, it was dragging in all
of libpod/image (and, less significantly, the util package).
Fortunately, this was just to ensure that error constants were
not duplicating, and there's nothing preventing us from
importing in the other direction and keeping libpod/define free
of dependencies.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-07-31 17:17:56 -04:00
Daniel J Walsh a5e37ad280
Switch all references to github.com/containers/libpod -> podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-28 08:23:45 -04:00
Valentin Rothberg 8489dc4345 move go module to v2
With the advent of Podman 2.0.0 we crossed the magical barrier of go
modules.  While we were able to continue importing all packages inside
of the project, the project could not be vendored anymore from the
outside.

Move the go module to new major version and change all imports to
`github.com/containers/libpod/v2`.  The renaming of the imports
was done via `gomove` [1].

[1] https://github.com/KSubedi/gomove

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-06 15:50:12 +02:00
Giuseppe Scrivano f54408bf06
utils: fix parsing of cgroup with : in the name
a cgroup can have ':' in its name.  Make sure the parser doesn't split
more than 3 fields and leave untouched the ':' in the cgroup name.

commit 6ee5f740a4 introduced the issue.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-06-30 15:49:33 +02:00
Giuseppe Scrivano 6ee5f740a4
podman: add new cgroup mode split
When running under systemd there is no need to create yet another
cgroup for the container.

With conmon-delegated the current cgroup will be split in two sub
cgroups:

- supervisor
- container

The supervisor cgroup will hold conmon and the podman process, while
the container cgroup is used by the OCI runtime (using the cgroupfs
backend).

Closes: https://github.com/containers/libpod/issues/6400

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-06-25 17:16:12 +02:00
baude b5a235df90 v2 podman stats
Signed-off-by: baude <bbaude@redhat.com>
2020-05-05 08:46:51 -05:00
Giuseppe Scrivano d172c98714
utils: delete dead code
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-04-02 09:15:58 +02:00
Valentin Rothberg 450361fc64 update systemd & dbus dependencies
Update the outdated systemd and dbus dependencies which are now provided
as go modules.  This will further tighten our dependencies and releases
and pave the way for the upcoming auto-update feature.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-03-10 18:34:55 +01:00
Giuseppe Scrivano b94a5e2410
utils: use the user session for systemd
when running as rootless, use the user session bus.  It is already
implemented in the pkg/cgroups so just re-use it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-09-12 08:35:26 +02:00
baude 1d36501f96 code cleanup
clean up code identified as problematic by golands inspection

Signed-off-by: baude <bbaude@redhat.com>
2019-07-08 09:18:11 -05:00
Marco Vedovati 7e3f1c21b0 libpod: specify a detach keys sequence in libpod.conf
Add the ability of specifying a detach keys sequence in libpod.conf

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
2019-06-26 10:12:34 +02:00
baude 0b6bb6a3d3 enable podman-remote on windows
build a podman-remote binary for windows that allows users to use the
remote client on windows and interact with podman on linux system.

Signed-off-by: baude <bbaude@redhat.com>
2019-04-30 15:28:39 -05:00
Jhon Honce f29a765573 Corrected detach man pages and code comments
* Updated documentation to match code

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2019-03-13 14:16:37 -07:00
baude 711ac93051 podman-remote save [image]
Add the ability to save an image from the remote-host to the
remote-client.

Signed-off-by: baude <bbaude@redhat.com>
2019-02-20 12:58:05 -06:00
Matthew Heon b6775d5d22 Fix manual detach from containers to not wait for exit
At present, when manually detaching from an attached container
(using the detach hotkeys, default C-p C-q), Podman will still
wait for the container to exit to obtain its exit code (so we can
set Podman's exit code to match). This is correct in the case
where attach finished because the container exited, but very
wrong for the manual detach case.

As a result of this, we can no longer guarantee that the cleanup
and --rm functions will fire at the end of 'podman run' - we may
be exiting before we get that far. Cleanup is easy enough - we
swap to unconditionally using the cleanup processes we've used
for detached and rootless containers all along. To duplicate --rm
we need to also teach 'podman cleanup' to optionally remove
containers instead of cleaning them up.

(There is an argument for just using 'podman rm' instead of
'podman cleanup --rm', but cleanup does have different semantics
given that we only ever expect it to run when the container has
just exited. I think it might be useful to keep the two separate
for things like 'podman events'...)

Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-02-12 10:14:57 -05:00
baude 4f825f2e07 Add container runlabel command
Execute the command as described by a container image.  The value of the label is processed
into a command by:

1. Ensuring the first argument of the command is podman.
2. Substituting any variables with those defined by the environment or otherwise.

If no label exists in the container image, nothing is done.

podman container runlabel LABEL IMAGE extra_args
Signed-off-by: baude <bbaude@redhat.com>
2018-09-28 14:14:13 -05: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