3995 Commits

Author SHA1 Message Date
2e52b4fa78 Merge pull request #21982 from Luap99/machine-compose
podman compose: enable machine socket connection
2024-03-07 18:42:24 +00:00
5d3a19f8d0 podman compose: enable machine socket connection
This can be enabled now.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-03-07 17:34:05 +01:00
25f3a8ce77 podman machine start/stop do not write config unlocked
Move the writes into the shim level to make sure they happen while we
hold the machine lock to prevent any race conditions reading/writing the
file.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-03-07 15:11:41 +01:00
7a75914921 podman machine init: do not write config unlocked
First make sure we check that a given VM exist when holding the VM lock
for it. The check in cmd/podman/machine/init.go is a nice quick out but
not enough to ensure that 2 processes to not create the same VM at the
same time. The only way to ensure this is by holding the lock and
checking if the VM config file exists.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-03-07 14:58:25 +01:00
3c9c5be7da podman machine set: change options only locked
Make sure we only update the machine config when we are locked.
While it doesn't make a functional differnce for cpu and memory it was a
problem for disk size. The disk size must be larger than the previous
one so we must have accurate data on the previous value.

Thus change the settings only while locked and refresh the config so we
have the current up to date values.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-03-07 14:19:06 +01:00
4d2fc293c0 machine: make more use of strongunits
To make it very clear in the code what unit the uint represents.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-03-06 16:14:30 +01:00
5ad1f2e43b Merge pull request #21918 from tnk4on/fix-wrong-units-size-return
Fix problem with `podman machine list` returning wrong units for Memory and Disk size
2024-03-06 13:55:56 +00:00
92b67a69ae Fix wrong units size return
Signed-off-by: Shion Tanaka <shtanaka@redhat.com>
2024-03-06 19:41:11 +09:00
1956a81d30 Merge pull request #21938 from Luap99/pull-error
properly implement pull-error event status
2024-03-05 21:05:28 +00:00
9ee96a9569 properly implement pull-error event status
Commit 03f6589f3 added basic support for pull-error event from libimage
but it contains several problems:
1. storing the error as error type prevents it from being unmarshalled,
   thus change it to a string
2. the error was never propagated from the libimage event to the podman
   event struct
3. the error message was not wired into the cli and API

This commit fixes these problems.

Fixes #21458

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-03-05 10:50:42 +01:00
ef7727238a Refactor env dir and port functions into new leaf pkgs
[NO NEW TESTS NEEDED]

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2024-03-04 23:54:31 -06:00
3abc488c84 Vendor in containers/(buildah, common)
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-02-29 20:06:28 -05:00
87729cc666 Merge pull request #21862 from ashley-cui/ocidisk
Use machine image as specified in containers.conf
2024-02-29 20:51:23 +00:00
527b3793b8 Use machine image as specified in containers.conf
For podman machine init, deprecate the --image-path option for --image.
--image now accepts the correct image from containers.conf

Also, add the ability to specify an OCI image from the --image flag using the docker:// transport.

Signed-off-by: Ashley Cui <acui@redhat.com>
2024-02-29 13:38:43 -05:00
f168b3c115 podman manifest add: support creating artifact manifest on the fly
Add a --artifact flag to `podman manifest add` which can be used to
create an artifact manifest for one or more files and attach it to a
manifest list.  Corresponding --artifact-type, --artifact-config-type,
--artifact-config, --artifact-layer-type, --artifact-subject, and
--artifact-exclude-titles options can be used to fine-tune the fields in
the artifact manifest that don't refer to the files themselves.

Add a --index option to `podman manifest annotate` that will cause
values passed to the --annotation flag to be applied to the manifest
list as a whole instead of to an entry in the list.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2024-02-29 11:47:44 -05:00
66d60384f4 add --retry --retry-delay to podman run/create
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-02-29 10:20:21 -05:00
c3c0c4ab96 Add support for podman push --retry --retry-delay
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-02-29 10:20:21 -05:00
e5ee0bb5f3 pullImage does not need to be exported
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-02-29 10:20:21 -05:00
96f9d0867a Merge pull request #21854 from ashley-cui/locks
Move locks to shim layer
2024-02-29 14:34:03 +00:00
690b671ecd Merge pull request #20774 from giuseppe/passthrough-tty
logging: new mode -l passthrough-tty
2024-02-29 12:43:36 +00:00
35133c8424 Move locks to shim layer
Previously, the locks were on the provider layer, which doesn't make a vm operation with a config file update atomic. Move them up a layer, so the entire function locks while doing provider and config operations.

This adds a Remove and a Set function to the shim layer.

[NO NEW TESTS NEEDED] Unsure how to test this

Signed-off-by: Ashley Cui <acui@redhat.com>
2024-02-29 00:12:04 -05:00
950f612b56 logging: new mode -l passthrough-tty
it works in a similar way to passthrough but it allows to be used also
on a TTY.

conmon support: https://github.com/containers/conmon/pull/465

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-02-28 17:23:59 +01:00
5952486df8 podman network inspect: include running containers
Like docker podman network inspect should output the information of
running container with their ip/mac address on this network.
However the output format is not docker compatible as this cannot
include all the info we have and the previous output was already not
compatible so this is not new.

New example output:
```
[
     {
          ...
          "containers": {
               "7c0d295779cee4a6db7adc07a99e635909413a390eeab9f951edbc4aac406bf1": {
                    "name": "c2",
                    "interfaces": {
                         "eth0": {
                              "subnets": [
                                   {
                                        "ipnet": "10.89.0.4/24",
                                        "gateway": "10.89.0.1"
                                   },
                                   {
                                        "ipnet": "fda3:b4da:da1e:7e9d::4/64",
                                        "gateway": "fda3:b4da:da1e:7e9d::1"
                                   }
                              ],
                              "mac_address": "1a:bd:ca:ea:4b:3a"
                         }
                    }
               },
               "b17c6651ae6d9cc7d5825968e01d6b1e67f44460bb0c140bcc32bd9d436ac11d": {
                    "name": "c1",
                    "interfaces": {
                         "eth0": {
                              "subnets": [
                                   {
                                        "ipnet": "10.89.0.3/24",
                                        "gateway": "10.89.0.1"
                                   },
                                   {
                                        "ipnet": "fda3:b4da:da1e:7e9d::3/64",
                                        "gateway": "fda3:b4da:da1e:7e9d::1"
                                   }
                              ],
                              "mac_address": "f6:50:e6:22:d9:55"
                         }
                    }
               }
          }
     }
]
```

Fixes #14126
Fixes https://issues.redhat.com/browse/RHEL-3153

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-02-28 16:33:26 +01:00
9d1704396a Merge pull request #21572 from mheon/hyperv_9p_mkdir
Ensure HyperV 9p mounts work when a dir doesn't exist
2024-02-27 22:34:07 +00:00
26ec570c65 Ensure HyperV 9p mounts work when a dir doesn't exist
Before, we required that the mount target exist and be a
directory for the 9p mount to successfully complete, which is not
how things are supposed to work - the user should be able to
mount anywhere. This should just be a simple mkdir, but with FCOS
the root directory is immutable so we need to undo that before we
can mkdir, and unfortunately we don't have a library that can do
chattr (and I didn't want to drag in a new dependency just for
that), so let's be gross and add it to the SSH command. I
aggressively dislike this but it does work.

[NO NEW TESTS NEEDED] Can worry about getting a more generic
mount test together for Machine later.

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-02-27 14:33:53 -05:00
3352111dd6 Merge pull request #21825 from Luap99/compose
some podman compose fixes
2024-02-27 15:11:30 +00:00
d9aff9b41e podman compose: only trim path suffix when ssh protocol
For a unix socket we should not trim this at all. The problem exists for
ssh only so make sure we only do this when a ssh URL is given.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-02-27 13:44:26 +01:00
3cada04099 podman compose: correctly accept --connection/--url
Make the logic here much simpler, we already pass all the conection info
before so just use the parsed URL here.

Fixes #20943

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-02-27 13:40:41 +01:00
6d3571dcf5 podman compose: build for all arches
Machine only works on amd64 and arm64 but the compose command can still
be used without machine so split out the machine only logic to make it
build for all arches.

[NO NEW TESTS NEEDED]

Fixes #21757

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-02-27 13:40:41 +01:00
8d9ff04d10 vendor update gopkg.in/yaml.v2 to v3
There is no reason for us to use v2 here, we use v3 already in most
places. The go-openapi dependency still uses v2 so we do not get rid of
it yet but it looks like they migrated upstream so once a new version
is released there and finds our way to us then we should get some nice
binary size reduction.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-02-27 12:20:58 +01:00
19b676f855 Enable lint for Darwin and fix identified issues
[NO NEW TESTS NEEDED] Just fixing lint issues

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-02-26 11:01:54 -05:00
36d8e27601 Merge pull request #21517 from jakecorrenti/fix-qemu-todos
machine: Address some QEMU TODOs
2024-02-22 21:21:50 +00:00
d8f07dc608 Merge pull request #21784 from Luap99/events
make podman events json output more docker compatible
2024-02-22 17:58:08 +00:00
be9aba7ccd Remove image provenance from machine inspect
We don't care about the provenance of the machine image, so this is no
longer applicable to have when displaying info.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2024-02-22 08:34:27 -05:00
d68240b150 Update machine files rm order and add QEMU rm
Changes the order in which the machine-specific files are removed in
`Remove()`. Removes the system connections first, then removes the
`configPath` last. `configPath` is removed last, because in the case of
an error with any of the previous files, the removal can be attempted
again since the machine still "exists".

Made the errors in `Remove` hard errors instead of soft errors.

Added the implementation for the QEMU-specific file removal.

[NO NEW TESTS NEEDED]

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2024-02-22 08:31:55 -05:00
8f1cebf96f cmd/podman: remove duplicated event ToHumanReadable()
ToHumanReadable() exists twice now, there is no reason for this just
call the function on the backend event type is fine as this still has to
be used there.

It also fixes a bug where the wrong event type was passed to the
template which did not match the docs and json output.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-02-22 12:10:57 +01:00
a3a1b44c31 libpod/events: Update event time format and add timeNano
Add new event type in cmd/podman to better match the docker format.

Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2024-02-22 11:32:48 +01:00
669e718561 Merge pull request #21636 from jakecorrenti/inspectinfo-hostuser
machine: Remove unnecessary TODOs
2024-02-22 10:29:51 +00:00
59b6f48d90 Merge pull request #21735 from jakecorrenti/inspect-conn-vals
machine: Add `ConnectionInfo` to inspect
2024-02-22 02:36:50 +00:00
70091d57e7 Merge pull request #21699 from vikas-goel/i21663
Comply to Kubernetes specifications for annotation size.
2024-02-21 15:00:25 +00:00
89b415ba37 Comply to Kubernetes specifications for annotation size.
An annotation is a pair of key-value. The key has two parts, viz. a name and an optional prefix in DNS format.

The limitations on name is 63, prefix 253 chars. The limitation on total size of all key+value pairs combined is 256KB.

https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set

Fixes: https://github.com/containers/podman/issues/21663

Signed-off-by: Vikas Goel <vikas.goel@gmail.com>
2024-02-20 14:58:35 -08:00
09095acf2b machine: Add ConnectionInfo to MachineConfig
Adds `ConnectionInfo()` to the `MachineConfig` and fills out
`InspectInfo` accordingly. Additionally fixes the "inspect with go format" test.

Changes `ConfigPath` to `ConfigDir` to better represent the
output.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2024-02-20 09:08:11 -05:00
ec68f07c04 Fix Lint on Windows and enable the job
[NO NEW TESTS NEEDED] Purely refactoring

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-02-20 08:06:18 -05:00
66f39eee5e machine: Remove unnecessary TODOs
Remove TODO to swap `Rootful` in Inspect with `HostUser`

It is unnecessary to remove the vfkit logfile in the provider-specific Remove function. Vfkit is fed the default logfile provided by mc.LogFile which is removed by the generic Remove function.

Removes TODO regarding moving the location of Stop. False TODO.

[NO NEW TESTS NEEDED]

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2024-02-19 19:51:49 -05:00
80b1e95700 Merge pull request #21659 from rhatdan/retry
Allow podman pull to specify --retry and --retry-delay
2024-02-19 11:37:31 +00:00
6c7f987ab3 Merge pull request #21499 from tnk4on/fix-remove-dockersock-symlink
Fixed `podman-mac-helper uninstall` to remove docker.sock symlink
2024-02-18 23:29:49 +00:00
10d748f584 Introduce Podman machine reset
Podman machine reset is a new command that will "reset" your podman
machine environment.  Reset is defined as:

* Stop and Remove all VMs
* Remove the following directories:
    - configuration dir i.e. ~/.config/containers/podman/machine/qemu
    - data dir i.e. ~/.local/.share/containers/podman/machine/qemu

When deleting, if errors are encountered, they will be batched and spit
out at the end.  Podman will try to proceed even in error in doing what
it was told.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-02-18 08:43:12 -06:00
7ba23cd6fc Allow podman pull to specify --retry and --retry-delay
Fixes: https://github.com/containers/podman/issues/19770

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2024-02-17 07:37:26 -05:00
fbb4d5dca6 Merge pull request #21692 from Luap99/machine-cleanup
machine init: validate machine name and username
2024-02-17 12:33:23 +00:00
f036476cfa fix usermode test
Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2024-02-16 09:17:29 -06:00