Commit graph

1096 commits

Author SHA1 Message Date
Matt Heon
f63cf24b00
Merge pull request #29460 from RudraDudhat2509/fix/hyperv-vsock-ready-timeout
hyperv: add timeout to vsock ready wait
2026-08-19 05:11:28 -04:00
Danish Prakash
598920feef
Merge pull request #29322 from ROKUMATE/test-pkg-machine-env
pkg/machine/env: add tests for WithPodmanPrefix and dir prefixes
2026-08-18 10:08:39 +05:30
Jan Rodák
4b6873a5ef
Merge pull request #29527 from vishnukothakapu/perf-strings-equalfold
Performance: Replace strings.ToLower with strings.EqualFold
2026-08-17 21:59:25 +02:00
Paul Holzinger
5b366f4b34
Merge pull request #29511 from vishnukothakapu/perf-regexp-mustcompile
Performance: Hoist regexp.MustCompile out of functions
2026-08-17 12:53:04 +02:00
Vishnu Kothakapu
0a2350324a Performance: Replace strings.ToLower with strings.EqualFold
Replaces unnecessary heap allocations for case-insensitive equality
checks with standard library strings.EqualFold.

Fixes: #29526
Signed-off-by: Vishnu Kothakapu <vishnukothakapu27@gmail.com>
2026-08-15 02:17:47 +05:30
Vishnu Kothakapu
e3797d95b1 Performance: Use delayed regex compilation
Replaces regexp.MustCompile with regexp.Delayed from go.podman.io/storage/pkg/regexp
for global regular expressions. This avoids compiling regular expressions
during the global init scope, improving startup performance for all commands.

Tests are kept using regexp.MustCompile where applicable.

Fixes: #29510
Signed-off-by: Vishnu Kothakapu <vishnukothakapu27@gmail.com>
2026-08-14 21:14:17 +05:30
Jan Rodák
b4aadcdd1a
Merge pull request #29502 from vishnukothakapu/refactor-err-error
Refactor: Remove redundant err.Error() in pkg/machine
2026-08-14 16:06:58 +02:00
ROKUMATE
4a7be9e307 pkg/machine/env: add tests for WithPodmanPrefix
Fixes: #29314
Signed-off-by: ROKUMATE <rohitkumawat0110@gmail.com>
2026-08-14 17:28:31 +05:30
nXtCyberNet
f76d9de01a added errorlint
Fixes: #29488
Signed-off-by: nXtCyberNet <rohantech2005@gmail.com>
2026-08-14 01:35:03 +05:30
Vishnu Kothakapu
d5f84c7167 Refactor: Remove redundant err.Error() in pkg/machine
When passing an error to fmt.Errorf or logrus with formatting verbs like
%v or %w, it is not necessary to explicitly call err.Error(). The format
functions will automatically call the Error() method because the value
implements the error interface. Removing these explicit calls makes the
code cleaner and more idiomatic.

Fixes: #29501
Signed-off-by: Vishnu Kothakapu <vishnukothakapu27@gmail.com>
2026-08-14 01:09:08 +05:30
Matt Heon
b85a2c7f39
Merge pull request #29459 from vishnukothakapu/refactor-machine-error-wrap
Refactor: use %w for error wrapping in pkg/machine
2026-08-12 06:27:23 -04:00
Rudra Dudhat
dd28c14f8c hyperv: add timeout to vsock ready wait
ListenSetupWait() waited on errChan with no timeout, so podman machine
init/start could hang forever if the guest never signaled ready. Added
waitForReady(errChan, timeout) with a 30 second bound. Full details in
the issue.

Fixes: #29455

Signed-off-by: Rudra Dudhat <contact.rdudhat@gmail.com>
2026-08-12 14:28:26 +05:30
Matt Heon
0d43350b9c
Merge pull request #29466 from ROKUMATE/fix-machine-volume-unknown-opt-log
Some checks are pending
ci / sys local root fedora-prior (push) Blocked by required conditions
ci / int local rootless fedora-prior (push) Blocked by required conditions
ci / sys local rootless fedora-prior (push) Blocked by required conditions
ci / int remote root fedora-prior (push) Blocked by required conditions
ci / sys remote root fedora-prior (push) Blocked by required conditions
ci / int local root fedora-rawhide (push) Blocked by required conditions
ci / sys local root fedora-rawhide (push) Blocked by required conditions
ci / int local rootless fedora-rawhide (push) Blocked by required conditions
ci / sys local rootless fedora-rawhide (push) Blocked by required conditions
ci / int remote root fedora-rawhide (push) Blocked by required conditions
ci / sys remote root fedora-rawhide (push) Blocked by required conditions
ci / apiv2 root fedora-current (push) Blocked by required conditions
ci / bindings root fedora-current (push) Blocked by required conditions
ci / compose_v2 root fedora-current (push) Blocked by required conditions
ci / docker_py root fedora-current (push) Blocked by required conditions
ci / unit root fedora-current (push) Blocked by required conditions
ci / apiv2 rootless fedora-current (push) Blocked by required conditions
ci / compose_v2 rootless fedora-current (push) Blocked by required conditions
ci / unit rootless fedora-current (push) Blocked by required conditions
ci / upgrade v5.3.1 root fedora-current (push) Blocked by required conditions
ci / upgrade v5.6.2 root fedora-current (push) Blocked by required conditions
ci / machine linux amd64 (push) Blocked by required conditions
ci / windows unit (push) Blocked by required conditions
ci / windows e2e (push) Blocked by required conditions
ci / windows machine hyperv (push) Blocked by required conditions
ci / windows machine wsl (push) Blocked by required conditions
ci / macos machine applehv (push) Blocked by required conditions
ci / macos machine libkrun (push) Blocked by required conditions
ci / Total Success (push) Blocked by required conditions
zizmor: GitHub Actions Security Analysis / Zizmor (push) Waiting to run
pkg/machine/vmconfigs: log unknown volume option instead of printing to stdout
2026-08-11 19:27:13 -04:00
ROKUMATE
d591b83fce pkg/machine/vmconfigs: log unknown volume option instead of printing to stdout
Fixes: #29465
Signed-off-by: ROKUMATE <rohitkumawat0110@gmail.com>
2026-08-12 03:41:19 +05:30
Vishnu Kothakapu
2dac3a97fb Refactor: use %w for error wrapping in pkg/machine
Signed-off-by: Vishnu Kothakapu <vishnukothakapu27@gmail.com>
2026-08-12 02:23:44 +05:30
Aryanbhargava18
c8e8cb23cc pkg/machine: remove unused provider functions
The InstalledProviders and SupportedProviders functions were only
used in their own tests and were otherwise dead code. Removing them
entirely cleans up the API surface.

Signed-off-by: Aryanbhargava18 <aryanbhargava644@gmail.com>
2026-08-04 15:09:41 +05:30
Danish Prakash
e121ed6264
Merge pull request #28687 from jaitjacob/add-podman-machine-restart-command
Add `podman machine restart` subcommand
2026-07-22 09:53:10 +05:30
Jait Jacob
eb26516dba
make return explicit so CleanIfErr runs as expectd
Signed-off-by: Jait Jacob <jai8.jacob@gmail.com>
2026-07-21 23:30:29 +05:30
Jait Jacob
2ad3a79631
Add podman machine restart subcommand
Signed-off-by: Jait Jacob <jai8.jacob@gmail.com>
2026-07-16 21:51:11 +05:30
Mario Loriedo
452c40a1b6 Add machine e2e test for host.containers.internal
Add one more test to the basic podman commands e2e tests:
- starts an HTTP server on the host
- verify HTTP requests from a container, using
`host.containers.internal` or `host.docker.internal`, are routed
successfully to the server running on the host

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>

test

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-07-16 14:33:18 +02:00
Mario Loriedo
48f21de496 Fixing machine e2e gvproxy test
The lookup for the gvproxy process was broken on Windows:
- We looked for gvproxy, not gvproxy.exe, and `tasklist` was always
failing
- But `pgrep` wasn't failing because we looked for the wrong `tasklist`
error message (the correct error message on my laptop is "INFO: No tasks
are running which match the specified criteria.")
- WSL uses win-sshproxy.exe, not gvproxy.exe

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-07-15 11:42:11 +02:00
Mario Loriedo
d20b363e02 Always unprovision if the WSL machine init fail
Remove the just provisioned WSL distribution if one of the post install
scripts fail.

Fixes #27036

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-07-13 14:07:17 +02:00
Mario Loriedo
bec840d716 Fix lookup of HyperV VMs with matching name
Fixes https://github.com/podman-container-tools/podman/issues/29138

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-07-07 23:40:18 +02:00
Brent Baude
9ac9834a50
Merge pull request #29100 from afbjorklund/machine-cache
Restore caching of the default machine image
2026-07-02 10:05:27 -05:00
Brent Baude
4d5435f47e
Merge pull request #29103 from Luap99/wsl-config-mount
machine/wsl: fix config mount logic
2026-07-02 10:05:04 -05:00
Paul Holzinger
114bb1efa7
machine/wsl: fix config mount logic
The current systemd service to mount /etc/containers is not working
right. The Before=podman.socket causes a ordering conflict which causes
the socket to be disabled and thus all podman remote connections fail.

The problem is the unit is wanted by the default.target while the socket
is wanted by sockets.target which can be before the default.target is
triggered. That means that the Before= line cannot be fulfilled and
sometimes systemd thus seems to not start the socket. It is unclear to
me why this is racy as it is sometimes also works.

This was reported by Vladimir Lazar from the PD team, our CI did not
caught this as we use rootless machines by default and the problem only
happens for the rootful socket so we do not see connection failures.
To fix this add at least one rootful socket check.

We do however have a different CI flake that was also caused by the
incorrect mount dependencies. The mount could happen after sshd or other
programs run. So to fix this we must hook the podman-mnt-config.service
into the local-fs.target which runs much earlier and is used for all the
mounts.

Fixes: #29003

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-07-02 14:01:43 +02:00
Anders F Björklund
d4a1efbe9b Restore caching of the default machine image
It was removed, with the hardcoded image reference.

So cache was always off, even for the default image.

Fixes: #29090

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2026-07-01 18:09:21 +02:00
Paul Holzinger
838fc24d3e
machine: simplify ssh debug output logging
When the command output is logged we do not need an extra pipe and
scanner to read the output line by line, we can just log it directly via
a writer.

Now this of course does loose the line by line parsing of the scanner
but IMO this is better as it is simpler and less code to worry about.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-30 10:32:32 +02:00
Paul Holzinger
278068ef18
fix some missing scanner error checks
Found by scannererr:
https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/scannererr

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-30 10:32:32 +02:00
Paul Holzinger
4cbae8b6a7
Merge pull request #28991 from l0rd/fix-machine-start-signal-handling
Fix signal handling during machine start on macOS
2026-06-29 18:50:09 +02:00
Mario Loriedo
80203302f9 Fix lookup of WSL VMs with matching name
When WSL wasn't installed, the lookup erroneously reported that
a VM with the same name existed. Instead, in this case, the lookup
should return zero matching VMs.

Fixes https://github.com/podman-container-tools/podman/issues/29053

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-06-27 10:52:26 +02:00
Mario Loriedo
697f91164a Fix WSL check: assume not installed when --status returns an error
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-06-27 00:43:33 +02:00
Mario Loriedo
12ea195526 Add new machine test that covers interrupted start command
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-06-24 18:52:15 +02:00
Mario Loriedo
f5d51593ca Fix cleanup callbacks registration in machines Start() function
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-06-24 18:52:15 +02:00
Mario Loriedo
2f3e645b58 Reap completed gvproxy process if machine start fails on Unix
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-06-24 18:52:15 +02:00
Mario Loriedo
37c8dea92a Machine: extend lock to ensure cleanup callbacks completion
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-06-24 18:52:15 +02:00
Mario Loriedo
c6945741e4 Propagate SIGTERM to the VM process during machine start on macOS
Related to https://github.com/podman-container-tools/podman/issues/28318

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2026-06-24 18:52:12 +02:00
Paul Holzinger
81fd1e6e85
machine/wsl: drop cgroup_manager cgroupfs
I think this should work fine with the defaults. Since we mount the
/etc/containers dir always we should no longer write to /etc/containers.
If we still need this it should be moved into the image and not done at
init time.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-23 13:07:34 +02:00
Mario Loriedo
835c8f2d1d
Merge pull request #28871 from Luap99/hyperv-flake
machine/hyperV: move ssh mounts to after the ready check
2026-06-19 12:05:58 +02:00
Ashley Cui
66a082ed1b
Merge pull request #28915 from chanhyeokseo/fix-machine-virtiofs-fcos-home-28911
machine: fix virtiofs mount targets on FCOS
2026-06-17 10:36:51 -04:00
Chanhyeok Seo
61dea3749f
machine: fix virtiofs mount targets on FCOS
FCOS symlinks /home to var/home. systemd rejects a mount unit whose
Where= path traverses a symlink, breaking default home dir mounts.

Resolve known FCOS symlinks before writing the ignition unit.

Fixes: #28911
Signed-off-by: Chanhyeok Seo <chanhyeok.seo@datadoghq.com>
2026-06-16 22:52:33 +09:00
Jan Rodák
f1d0ded43c
Convert if/else to switch for transport name comparison
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-06-12 10:12:49 +02:00
Jan Rodák
b294a92a25
Add reasons to all staticcheck suppressions
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2026-06-12 10:12:40 +02:00
crawfordxx
d0f97989ad machine: escape % as %% in proxy values written to systemd unit conf
systemd interprets % as specifier characters in unit configuration files
(e.g. %H, %u, %40). Proxy environment variable values that contain
percent-encoded URL characters (such as %40 for @ in usernames) cause
systemd to emit warnings and fail to parse the generated
/etc/systemd/system.conf.d/default-env.conf:

  system.conf.d/default-env.conf:2: Failed to resolve specifiers in
  HTTP_PROXY=http://user%40example.com@proxy:3128

Fix by adding a bash variable substitution that doubles every % to %%
before writing to the systemd unit conf files. The profile.d and
environment.d destinations do not need this escaping and continue to
use the original value.

Fixes #28698

Signed-off-by: crawfordxx <crawfordxx@users.noreply.github.com>
2026-06-06 12:04:48 +08:00
Paul Holzinger
8472bf223e
machine/hyperV: move ssh mounts to after the ready check
We are seeing frequent flakes in hyperV machine tests. The machine start
fails with an ssh handshake failure:

ssh: handshake failed: read tcp 127.0.0.1:56425->127.0.0.1:56377:
wsarecv: An existing connection was forcibly closed by the remote host.

Normally we do the ssh probe in conductVMReadinessCheck() with a retry
mechanism, however because the hyperV mount code already used ssh in
PostStartNetworking() we never got there and failed early.

PostStartNetworking seems the wrong place to mount anyway so move this
to MountVolumesToVM() instead which is placed after the ready check
already so it should have a working ssh by then.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2026-06-05 18:34:44 +02:00
Nicola Sella
d6cf6e8495
machine: share virtiofs systemd unit generation
Make GenerateSystemDFilesForVirtiofsMounts an agnostic function
and move the code from apple to pkg/machine/volume_systemd.go

MountVolumesToVM  is now a no-op matching the AppleHV and
LibKrun behaviour.

Continues from PR: https://github.com/podman-container-tools/podman/pull/28736

Fixes: https://redhat.atlassian.net/browse/RUN-4742

Signed-off-by: Nicola Sella <nsella@redhat.com>
2026-06-02 14:47:08 +02:00
Brent Baude
e581ddc253
Merge pull request #28731 from lstocchi/hyperv_enhancements
Fixes for Hyper-V user experience
2026-05-26 10:30:18 -05:00
Paul Holzinger
22c5f3fa55
Merge pull request #28527 from vyasgun/pr/krunkit-timesync
machine: add vfkit timesync device for Apple VMs
2026-05-26 12:23:04 +02:00
lstocchi
f96cbda1b0
hyperv: propagate detailed error from Hyper-V permission checks
Change isHyperVAdminMember from returning a bool to returning an error so that callers surface the specific failure reason — particularly distinguishing "not in the group" from "in the group but session not updated" (new ErrHypervUserSessionNotUpdated sentinel). This gives users actionable guidance instead of a generic permission error.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2026-05-25 00:10:18 +02:00
Kir Kolyshkin
d4f60b5826 libpod: some modernize fixes for freebsd and darwin
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2026-05-22 14:15:49 -07:00