15905 Commits

Author SHA1 Message Date
891dfd3a8f specgen: fix parsing of cgroup devices rule
Fix the parse for the cgroup devices rule to correctly handle the
wildcard syntax for the device major.

Also make sure the device major and minor are not negative numbers.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-07-01 09:28:18 +02:00
5262f7e01d Fix podman machine on Windows
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2022-06-30 16:21:59 -05:00
01beba3667 Merge pull request #14704 from baude/machinestopped
reveal machine error, ignore false state
2022-06-30 17:58:28 +00:00
5a222a8e60 Merge pull request #14787 from giuseppe/move-systemd-service-to-subcgroup
service: do not run under the root cgroup
2022-06-30 16:09:07 +00:00
9c658f4907 docs: mention the podman-kube template
Mention the template in the docs for play-kube and generate-systemd.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-06-30 17:09:53 +02:00
c6fb533ca6 podman-play-kube template: rename to podman-kube
With the upcoming plans of introducing a podman-kube command with
various subcommands, rename the podman-play-kube systemd template
to podman-kube before releasing it.

Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-06-30 17:09:51 +02:00
3e8ab31239 Merge pull request #14785 from saschagrunert/cmd-podman-errors
cmd/podman: switch to golang native error wrapping
2022-06-30 09:58:52 -04:00
aa109ae0f0 Merge pull request #14783 from flouthoc/api-image-lookup-manifest
api,images: add support for `LookupManifest` to `Image removal` REST API
2022-06-30 13:54:02 +00:00
bd51410b8d service: do not run under the root cgroup
at startup, when running on a cgroup v2 system, check if the current
process is running in the root cgroup and move it to a sub-cgroup,
otherwise Podman is not able to create cgroups and move processes
there.

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

[NO NEW TESTS NEEDED] it needs nested podman

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-06-30 14:51:18 +02:00
5c39797624 utils: move the cgroup if root on cgroupv2
if we are running on cgroupv2, force the creation of a sub-cgroup even
when we are at the root for the cgroup v2 unified mount.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-06-30 14:34:18 +02:00
e8adec5f41 cmd/podman: switch to golang native error wrapping
We now use the golang error wrapping format specifier `%w` instead of
the deprecated github.com/pkg/errors package.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-06-30 12:58:57 +02:00
7bbfb3eb0d api,images: add support for LookupManifest to Image remove API
ImagesBatchRemoval and ImageRemoval now honors and accepts
`LookupManifest` parameter which further tells libimage to resolve to
manifest list if it exists instead of actual image.

Following PR also makes `podman-remote manifest rm` functional which was
broken till now.

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

Signed-off-by: Aditya R <arajan@redhat.com>
2022-06-30 14:56:42 +05:30
3426d56b92 Merge pull request #14770 from containers/dependabot/go_modules/github.com/stretchr/testify-1.8.0
build(deps): bump github.com/stretchr/testify from 1.7.5 to 1.8.0
2022-06-29 19:54:32 +00:00
2cc3f127f4 Merge pull request #14720 from sstosh/rm-option
Fix: Prevent OCI runtime directory remain
2022-06-29 19:51:53 +00:00
d6cdb996bc Merge pull request #14706 from ashley-cui/rootmach
Only allow Rootless runs of Podman Machine
2022-06-29 19:32:26 +00:00
35aa994d12 Merge pull request #14775 from cevich/podman_image_comment
[CI:DOCS] Update podmanimage comment.
2022-06-29 18:31:16 +00:00
64ec894c51 [CI:DOCS] Update podmanimage comment.
Drop a reference as to why the `rpm --setcaps...` line is needed, along
with a `TODO` reminder to check if it's still needed.

Signed-off-by: Chris Evich <cevich@redhat.com>
2022-06-29 11:35:56 -04:00
d9ff0fd15d Only allow Rootless runs of Podman Machine
Podman Machine crashes if run as root. When creating the machine, we write the ignition so that the UID of the core user matches the UID of the user on the host. We by default, create the root user on the machine with UID 0. If the user on the host is root, the core UID and the Root UID collide, causing a the VM not to boot.

[NO NEW TESTS NEEDED]

Signed-off-by: Ashley Cui <acui@redhat.com>
2022-06-29 09:19:09 -04:00
dd924c4078 Merge pull request #14764 from cdoern/cgroup
limit cgroupfs when rootless
2022-06-29 13:00:03 +00:00
6904b1a610 build(deps): bump github.com/stretchr/testify from 1.7.5 to 1.8.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.7.5 to 1.8.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.7.5...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-29 12:09:48 +00:00
6e910a08db Merge pull request #14740 from flouthoc/bindings-remove-manifest
bindings: Add support for `Delete` for deleting manifest list from local storage.
2022-06-29 10:44:56 +00:00
d7121b000f Merge pull request #14666 from shanesmith/machine-pidfile
Make `podman machine stop` wait for qemu to exit
2022-06-29 08:51:26 +00:00
5790caaef7 bindings: Add support for Delete in pkg/bingings/manifest
Bindings already support `Remove` which removes a manifest from the list
following function adds support for removing entire manifest for local
storage.

Similar functionality can be also used indirectly by using `Remove` defined in
image bindings

Signed-off-by: Aditya R <arajan@redhat.com>
2022-06-29 12:41:57 +05:30
4608b8b98f Merge pull request #14765 from giuseppe/unpause-before-kill
runtime: unpause the container before killing it
2022-06-29 06:44:21 +00:00
1affceb29f runtime: unpause the container before killing it
the new version of runc has the same check in place and it
automatically resume the container if it is paused.  So when Podman
tries to resume it again, it fails since the container is not in the
paused state.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=2100740

[NO NEW TESTS NEEDED] the CI doesn't use a new runc on cgroup v1 systems.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-06-28 22:42:53 +02:00
7f994a80de only create crgoup when not rootless if using cgroupfs
[NO NEW TESTS NEEDED] now that podman's cgroup config tries to initialize controllers, cgroupfs errors out on pod creation
we need to mimic the behavior that used to exist and only create the cgroup when running as rootful

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-06-28 16:35:09 -04:00
653e87dd4c Merge pull request #14754 from vrothberg/fix-14669
vendor containers/common
2022-06-28 20:09:21 +00:00
f0e8904e0d Merge pull request #14755 from cdoern/system
fix volume reporting in system df
2022-06-28 19:14:00 +00:00
60c9aeabab Merge pull request #14717 from ZeyadYasser/fix-restore-runtime-check
Fix runtime check during restore
2022-06-28 19:07:52 +00:00
d8f197cc14 Merge pull request #14400 from cdoern/scp
podman image scp remote support & podman image scp tagging
2022-06-28 17:46:12 +00:00
59a7ac210b Make podman machine stop wait for qemu to exit
- New `VMPidFilePath` field in MachineVM config holds the path for the
  qemu PID file

- qemu is now started with the `-pidfile` argument set to `VMPidFilePath`

- Machines created before this won't have the VM PID file configured,
  stopping these VMs will revert back to waiting on the state to change
  away from `Running`, plus an added 2s sleep to give time for the VM to
  exit and to avoid potential issues

- Machines created after this will have a VM PID file configured and
  stopping the machine will wait indefinitely for the VM to exit

[NO NEW TESTS NEEDED]

Signed-off-by: Shane Smith <shane.smith@shopify.com>
2022-06-28 13:28:38 -04:00
2ee9fe4cbd vendor containers/common
Pull in fixes for platform checks to silence annoying warnings when
pulling images by platforms using uname values.

Fixes: #14669
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
2022-06-28 17:12:56 +02:00
79a38a2c6a Add test for restore runtime verification using non-default runtime
Runtime verification test for container checkpoint with export
used the default runtime for test which causes test to always
pass. Problem rises when using non-default runtime, then doing
a restore. This test forcse using a non-default runtime during
container creation.

Edge case:
	1. Default runtime is crun
	2. Container is created with runc
	3. Checkpoint without setting --runtime into archive
	4. Restore without setting --runtime from archive

It should be expected that podman identifies runtime from the
checkpoint archive.

Signed-off-by: Zeyad Yasser <zeyady98@gmail.com>
2022-06-28 16:14:47 +02:00
8e3a46a87b Fix runtime check during restore
cfg.RuntimePath was set to default runtime, so the empty string
check fails. Instead we could check if the flag was changed.

Signed-off-by: Zeyad Yasser <zeyady98@gmail.com>
2022-06-28 16:14:38 +02:00
6c4c050d3d fix volume reporting in system df
currently, podman system df incorrectly calculates the reclaimable storage for
volumes, using a cumulative reclaimable variable that is incremented and placed into each
report entry causing values to rise above 100%.

Switch this variables to be in the context of the loop, so it resets per volume just like the size variable does.

resolves #13516

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-06-28 10:09:38 -04:00
50fa651a4e Merge pull request #14700 from shuttle-hq/bug/docker-compat-initialized
Docker compat returning unknown "initialized" for `status.status`
2022-06-28 14:07:04 +00:00
8267cd3c51 Merge pull request #14734 from giuseppe/copyup-switch-order
volume: add two new options copy and nocopy
2022-06-28 13:57:16 +00:00
cc49146332 Docker compat returning unknown "initialized" for status.status
Some background for this PR is in discussion #14641. In short, ever so often a container inspect will return a `status.status` of `initialized` from the Docker compat socket.

From the discussion I found these lines which tries to fix a "configured" status to "created".
c936d1e611/pkg/api/handlers/compat/containers.go (L291-L294)

However, commit 141de8686289 (Revamp Libpod state strings for Docker compat) removed the "configured" return value from the `String()` method called on line 291 above. Thus, making the `if` check redundant as it will never hit. But the same commit also introduces a return for "initialized" which this `if` should probably have been adapted for.

Signed-off-by: Pieter Engelbrecht <pieter@shuttle.rs>
2022-06-28 15:50:45 +02:00
9c5d97b5c5 Merge pull request #14751 from dfr/freebsd-make
FreeBSD build support
2022-06-28 13:15:12 +00:00
6d3520e8b7 podman image scp remote support & podman image scp tagging
add support for podman-remote image scp as well as direct access via the API. This entailed
a full rework of the layering of image scp functions as well as the usual API plugging and type creation

also, implemented podman image scp tagging. which makes the syntax much more readable and allows users t tag the new image
they are loading to the local/remote machine:

allow users to pass a "new name" for the image they are transferring
`podman tag` as implemented creates a new image im `image list` when tagging, so this does the same
meaning that when transferring images with tags, podman on the remote machine/user will load two images
ex: `podman image scp computer1::alpine computer2::foobar` creates alpine:latest and localhost/foobar on the remote host

implementing tags means removal of the flexible syntax. In the currently released podman image scp, the user can either specify
`podman image scp source::img dest::` or `podman image scp dest:: source::img`. However, with tags this task becomes really hard to check
which is the image (src) and which is the new tag (dst). Removal of that streamlines the arg parsing process

Signed-off-by: Charlie Doern <cdoern@redhat.com>
2022-06-28 08:54:19 -04:00
c66a489b75 Merge pull request #14741 from giuseppe/pod-ps-no-race
pod: ps does not race with rm
2022-06-28 11:41:47 +00:00
dc58a73064 Makefile: don't try to build rootlessport on FreeBSD
Rootless containers are not possible on FreeBSD. While I would like to
close that gap, getting the necessary changes into the FreeBSD kernel
is a long term project so until then, this removes the rootlessport
helper from the build on FreeBSD.

[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-06-28 10:29:50 +01:00
c55feb7bfb Makefile: don't use '-t' to specify the directory to install manpages
This option doesn't exist on freebsd or macos' install utility. In this
case, we can use the 'install file1 file2 ... dir' pattern which is
supported by all implementations of install that I'm aware of. The
makefile rule already creates the target directory so there is no
ambiguity.

No new tests are needed here since the same files are being installed
in the same places.

[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-06-28 10:29:50 +01:00
af16edf499 Makefile: use GNU sed to convert manpages on FreeBSD
The sed implementation on FreeBSD has a strict interpretation of posix
'basic' regular expressions. It would be better to re-implement this
using 'extended' regular expressions but for now, just use GNU sed.

This should have no functional difference on currently supported
platforms.

[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-06-28 10:29:50 +01:00
94a634fcfe Makefile: use bash to evaluate tool paths
The makefile uses the pattern $(shell command -v path1 path2 ...) to
deduce pathnames for various executables. On FreeBSD, the default shell
does have a 'command' builtin which supports the '-v' option but only
allows a single path as argument. Rather than work around this limitation
with alternatives like for, just set bash as the default shell. We
already require bash to be installed for various helper scripts.

This change only affects FreeBSD so no new tests are needed.

[NO NEW TESTS NEEDED]

Signed-off-by: Doug Rabson <dfr@rabson.org>
2022-06-28 10:29:50 +01:00
0e03a64f99 pod: ps does not race with rm
the "pod ps" command first retrieves the list of all pods, then
iterates over the list to inspect each pod.  This introduce a race
since a pod could be deleted in the meanwhile by another process.

Solve it by ignoring the define.ErrNoSuchPod error.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-06-28 10:38:12 +02:00
0cabd8006b pods: move code to a new function
it is a preparatory change for the next commit.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-06-28 10:38:12 +02:00
a575098975 Merge pull request #14742 from rhatdan/machine
Show starting state when machine is starting
2022-06-28 06:57:57 +00:00
d095053b9c Merge pull request #14597 from containers/closes_14583
Use Regexp in volume ls --filter name
2022-06-28 00:32:58 +00:00
3b10c1b78a Use Regexp in volume ls --filter name
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
2022-06-27 21:34:39 +03:00