Commit Graph

979 Commits

Author SHA1 Message Date
Paul Holzinger
200030914f pkg/machine: make mount units hook into local-fs
The virtiofs mount points do not actually are network mounts so we can
mount them earlier and using multi-user.target to enable them was wrong.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-25 18:13:13 +01:00
openshift-merge-bot[bot]
095ddfe995 Merge pull request #26277 from lstocchi/i25038
HyperV machine should reuse hvsock registry entries when possible
2025-11-21 11:32:09 +00:00
Mario Loriedo
9c2a738963 Stop enforcing iptables on WSL
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-11-21 01:01:47 +01:00
openshift-merge-bot[bot]
fac259ef9c Merge pull request #27566 from grey3228/fix/check_newGenericDecompressor_err
check err returned by newGenericDecompressor
2025-11-20 23:15:56 +00:00
openshift-merge-bot[bot]
18aa784988 Merge pull request #27546 from jakecorrenti/libkrun-as-default
machine: change default macOS provider to libkrun
2025-11-20 16:00:23 +00:00
lstocchi
901bd69e05 remove legacy registry entry
if users have legacy VMs (podman machines having hvsock registry entries
with the machineName field) when using podman with this patch, their
Registry entries will never be deleted by the functions added in
previous commits.

This commit adds a helper func to clean the Registry when these legacy
machines get removed

Signed-off-by: lstocchi <lstocchi@redhat.com>
2025-11-20 16:51:47 +01:00
lstocchi
23a297198e add test to verify init reuse hvsock entries for hyperv machines
Signed-off-by: lstocchi <lstocchi@redhat.com>
2025-11-20 16:51:45 +01:00
lstocchi
ab89922f4b hyperv should reuse hvsock registry entries when possible
Previously, each new HyperV Podman machine required creating new hvsock
registry entries, necessitating administrator privileges.

This change modifies the HyperV provider to reuse existing hvsock
entries if found. This is possible due to Podman's current
limitation of running only one HyperV machine at a time.

As a result, administrator privileges are only needed for the first initial
machine setup (when the registry is empty). Subsequent machines can be created by users in the
"Hyper-V Administrators" group without being Admin.

Hvsock entries are no longer deleted on each machine removal; cleanup
is handled when the last machine gets removed.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2025-11-20 16:51:31 +01:00
lstocchi
b62c82bff6 move HasAdminRights to windows pkg
this commit moves the HasAdminRights func from the wsl package to a generic windows package as this could also be used by the HyperV provider.

Signed-off-by: lstocchi <lstocchi@redhat.com>
2025-11-20 15:20:57 +01:00
openshift-merge-bot[bot]
dfdd3b5074 Merge pull request #27557 from baude/issue27556
Ignore prompt if stdin not a tty on machine start
2025-11-20 10:03:32 +00:00
Mikhail Dmitrichenko
fdc738b0df fix: check err returned by newGenericDecompressor
There is a couple of newGenericDecompressor function usages, where
returned possibly non-nil `err` is not checked before dereferencing
returned decompressor. It may lead to nil ptr dereferencing.

This commit adds check for `err` to prevent dereferencing potentially
nullable decompressor.

Found by Linux Verification Center (linuxtesting.org) with SVACE

Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
2025-11-20 12:07:37 +03:00
Brent Baude
6541fc4fb2 Merge pull request #27510 from baude/fakehyperv
fake images: windows hyperv
2025-11-19 12:12:22 -06:00
Brent Baude
3d566d85cf Ignore prompt if stdin not a tty on machine start
When starting a machine and the user has not explicitly passed
-u=true|false AND stdin is a not a tty, we should not prompt to update
connections.

Fixes: #27556

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-19 11:50:25 -06:00
Jake Correnti
453a45142f machine: change default macOS provider to libkrun
Now that Podman 6.0 no longer supports Intel Macs, use libkrun as the
default machine provider.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2025-11-17 09:32:29 -05:00
openshift-merge-bot[bot]
d388f9bbd2 Merge pull request #27342 from inknos/run-3578
Remove hardcoded refs from ociartifact code
2025-11-14 12:39:32 +00:00
Nicola Sella
df4905d68b Remove hardcoded refs from ociartifact code
Fixes: https://issues.redhat.com/browse/RUN-3578

Signed-off-by: Nicola Sella <nsella@redhat.com>
2025-11-13 22:57:21 +01:00
Brent Baude
d58dddee66 fake images: windows hyperv
this pr is a follow on to #27493.  it adds support for hyperv "fake"
images and suggests a benefit in terms of test speed.  for hyperv, we
create a generic 4MB vhdx and stick it into the temp dir.  this saves us
from any image copy or compression.

i also followed up on a few comments Paul made about using windows|unix
instead of each platform.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-12 12:53:42 -06:00
Brent Baude
57052a8cc7 Fix regression in podman machine ssh
While doing the provider obfuscation, I injected a regression where
podman ssh machine failed.  The regression was added in
0f22c1c772.  I have fixed the regression
and added a test to prevent future occurance.

Fixes: #27491

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-12 10:37:48 -06:00
Paul Holzinger
675182c2e9 fix gofumpt issues on main
Two PRs[1,2] were merged without rebasing resulting in a conflict since
the one enabled gofumpt while the other PR contained formatting not
according to that so now the lint fails.

[1] https://github.com/containers/podman/pull/27498
[2] https://github.com/containers/podman/pull/27493

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-12 15:44:26 +01:00
openshift-merge-bot[bot]
d5865c1462 Merge pull request #27498 from Luap99/gofumpt
enable gofumpt formatter
2025-11-12 13:29:45 +00:00
Paul Holzinger
5c1ed12d8d enable gofumpt formatter
Based on our discussion gofumpt won the vote so use that one via
golangci-lint.

https://github.com/containers/podman/discussions/27291

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-11-11 12:32:46 +01:00
Brent Baude
9cbb64c525 Use fake images for machine tests
In tests that do not start a machine, we can use "fake" images to speed
up tests.  In the case of darwin and Linux, that can be /dev/null.  The
hypervisors don't care.

In the case of Windows, some research will need to be done to determine
the same approach but this is a start.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-10 10:51:23 -06:00
Brent Baude
e059055aa5 Fix WSL machine start with --update-connection
In my previous PR, #27405, the optional WSL tests do not pass because of
an early return consistent with WSL's networking.  This PR corrects the
problem.

Fixes: #27469

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-07 10:41:32 -06:00
openshift-merge-bot[bot]
17beac160c Merge pull request #27405 from baude/setdefaultconnection
Add `update-connection` to machine start and init
2025-11-04 20:03:58 +00:00
Brent Baude
b4ec460ed4 Add update-connection to machine start and init
This allows users to set the associated machine's system connection to the system default when running `podman machine init --now` or `podman machine start`.  It also changes the default bbehavior of these commands in that the user will be prompted and asked if they would like to switch the system connection.  It also introduces a command line switch called `--update-connection`.  If the switch is unset, then the user will be prmpted.  If the command value is explicitly set to `false`, the user will not be prompted and the system connection will not be altered.  If the value is set to `true`, the system connection will be made the default and the user will not be prompted.

Fixes: https://issues.redhat.com/browse/RUN-3632

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-11-04 10:35:28 -06:00
Mario Loriedo
7c51ad0ef8 Fix cache misses when pulling WSL machine image
Fixes a regression introduced by b2e6d53 that made always failing the
match of the WSL image from the registry with the image in the local
cache. The result was that the WSL machine image was always pulled from
quay.io even if an identical image was in the local cache.

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-11-04 12:12:10 +01:00
Brent Baude
553c4a16d5 Fix use of duplicate machine names
A condition was changed in the refgactor of init where duplicate names would be allowed but no machine was created.  Duplicate names are not permitted and should return an error.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-10-30 07:50:08 -05:00
Brent Baude
5e1c2f8d7d Machine init --provider
Add the ability for users to override the default provider when creating mahcines.  The new flag is `--provider` and allows you to specifiy a valid vmtype for the platform.  This PR also removes the previous list test where we tested listing all providers.  I added a PR for testing --provider which includes a standard `machine ls` which defaults now to showing all providers.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-10-29 07:59:34 -05:00
Brent Baude
0f22c1c772 Provider obfuscation in command line
For Podman 6, we still have providers and will continue to have a default provider for each platform.  But where a platform has multiple providers, we want users to be able to cross provider boudnaries imposed in Podman 4/5.  The key change is to look up virtual machines by name, as before, but to then also iterate all possible providers.  As of this PR, init will still only create with the default provider, but a subsequent PR will introdouce an provider override.

I also removed the "--all-providers" command line option on `podman
machine ls` because it no longer makes sense. And I marked the all
provider list test to be skipped.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2025-10-27 08:40:19 -05:00
Matt Heon
34166fc004 Bump Go version to v6
Tremendous amount of changes in here, but all should amount to
the same thing: changing Go import paths from v5 to v6.

Also bumped go.mod to github.com/containers/podman/v6 and updated
version to v6.0.0-dev.

Signed-off-by: Matt Heon <mheon@redhat.com>
2025-10-23 11:00:15 -04:00
openshift-merge-bot[bot]
49c1fd6cea Merge pull request #27270 from lsm5/new-octal-format
fileperms: newer Go 1.13+ octal literal format
2025-10-17 14:36:36 +00:00
Daniel J Walsh
a27fd9bd89 Allow artifact add to override org.opencontainers.image.title annotation
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2025-10-16 14:24:57 -04:00
Lokesh Mandvekar
74788a3fe1 fileperms: newer Go 1.13+ octal literal format
Problem: While removing cgroupsv1 code, I noticed my neovim Go config
automatically changed fileperms to the new octal format and I didn't
want that polluting my diffs.

Decision: I thought it best to switch to the new octal format in a dedicated PR.

Action:
- Cursor switched to new octal format for all fileperm ocurrences in Go
 source and test files.
- vendor/, docs/ and non-Go files were ignored.
- Reviewed manually.

Ref: https://go.dev/ref/spec#Go_1.13

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
2025-10-16 14:11:29 -04:00
Matt Souza
090304a054 lint: reenable revive unused-parameter check
Signed-off-by: Matt Souza <medsouz99@gmail.com>
2025-10-01 10:42:08 -04:00
Kir Kolyshkin
f198fe6b13 pkg/machine/wsl: use any instead of interface{}
Since Go 1.18, any is a type alias for interface{}. After commit 8631032556
there is still one last instance of interface{} left -- replace it
manually.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-09-29 22:11:39 -07:00
Kir Kolyshkin
5824197774 pkg/machine/e2e: remove obsoleted comment
The code which comment refers to was removed by commit 2e4e1bb97c
("podman machine ssh handling"), so the comment is no longer valid.

Remove it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-09-29 22:05:58 -07:00
Paul Holzinger
8631032556 run modernize -fix ./...
Using golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize

+ some manual cleanup in libpod/lock/shm/shm_lock_test.go as it
  generated an unused variable
+ restored one removed comment

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-09-10 16:17:04 +02:00
Paul Holzinger
b97525a78d use strings.SplitSeq where possible
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-09-10 16:17:04 +02:00
openshift-merge-bot[bot]
9dd5fb2c99 Merge pull request #26950 from jiridostal/sigpipe-handler
Handle SIGPIPE to prevent machine stuck in Starting state
2025-09-08 14:12:54 +00:00
Jiri Dostal
59df0782f2 Handle SIGPIPE to prevent machine stuck in Starting state
Fixes: #26949
Signed-off-by: Jiri Dostal <jdostal@redhat.com>
2025-09-02 09:39:29 +02:00
Jan Kaluza
a98154a978 Switch common, storage and image to monorepo.
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
2025-09-01 12:33:04 +02:00
Paul Holzinger
5a2098cf61 windows: do not convert unconfined seccomp path
unconfined is a special value and not a path as such it must not be
converted otherwise --security-opt seccomp=unconfined fails as it tries
to access a file called unconfined.

Fixes: 3e8b2d7d96 ("Fix seccomp profile path on Windows")
Fixes: #26855

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-08-20 13:19:40 +02:00
Jan Rodák
cfe4d46d89 Optimize image loading for Podman machines
Add support for loading images directly from machine paths to avoid
unnecessary file transfers when the image archive is already accessible
on the running machine through mounted directories.

Changes include:
- New /libpod/local/images/load API endpoint for direct machine loading
- Machine detection and path mapping functionality
- Fallback in tunnel mode to try optimized loading first

This optimization significantly speeds up image loading operations
when working with remote Podman machines by eliminating redundant
file transfers for already-accessible image archives.

Fixes: https://issues.redhat.com/browse/RUN-3249
Fixes: https://github.com/containers/podman/issues/26321

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2025-08-19 12:33:15 +02:00
openshift-merge-bot[bot]
9f7af81cf8 Merge pull request #26718 from ninja-quokka/machine_init_tls_verify
Add support for configuring tls verification with machine init
2025-08-09 16:25:14 +00:00
Lewis Roy
67ec2037c0 Add support for configuring tls verification with machine init
This patch adds a new --tls-verify flag to the `podman machine init`
sub command which matches many of our other commands. This allows the
user to optionally control whether TLS verification is enabled or
disabled for download of the machine image.

The default remains to leave the TLS verification decision to the
backend library which defaults to enabling it, this patch just
allows the user to explicitly set it on the CLI.

Fixes: #26517

Signed-off-by: Lewis Roy <lewis@redhat.com>
2025-08-05 21:02:28 +10:00
Paul Holzinger
69f8f26d98 pkg/machine/e2e: remove build context skip
The machine images should contain a new enough podman on the server side
to support this so the skips can be removed.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2025-08-05 12:53:35 +02:00
Joshua Arrevillaga
73f3e98947 Feat: send additional build contexts for remote builds
Fixed the --build-context flag to properly send files for remote builds. Previously
only the main context was sent over as a tar while additional contexts were passed as
local paths and this would cause builds to fail since the files wouldn't exist.

New changes modifies the Build API to use multipart HTTP requests allowing multiple
build contexts to be used. Each additional context is packaged and
transferred based on its type:
- Local Directories: Sent as tar archives
- Git Repositories: link sent to the server where its then cloned
- Container Images: Image reference sent to the server, it then pulls the image there
- URLs/archives: URL sent to the server, which handles the download

Fixes: #23433

Signed-off-by: Joshua Arrevillaga <2004jarrevillaga@gmail.com>
2025-07-23 11:34:38 -04:00
Mario Loriedo
68e7136536 Enforce wsl.exe UTF-8 encoded output
Currently WSL uses UTF-16 encoded output by default but is planning
to use UTF-8.

See https://github.com/containers/podman/issues/26527

To get ready for the change we are enforcing UTF-8 encoded output by
setting the environment variable `WSL_UTF8=1` and by updating the
code that transfomed wsl output from UTF-16 to UTF-8.

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

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-07-02 20:18:52 +00:00
Mario Loriedo
9fbe2fffe9 WSL commands execution refactoring
Introduced a new function to encapsulate the code to execute WSL
commands.

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-07-02 20:18:52 +00:00
openshift-merge-bot[bot]
6355a15082 Merge pull request #25922 from jakecorrenti/krunkit-cmdline
machine: enable nested virt on libkrun by default
2025-07-01 13:39:19 +00:00