25 Commits

Author SHA1 Message Date
2588b96993 Fix logging podman machine server9 output
Command `podman machine init` for Hyper-V machines invokes the command
`podman machine server9` and redirects it's output to a file. But the
file descriptor was closed before beeing used and the output file was
always empty.

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2025-04-28 15:42:43 +00:00
a776c1d82a pkg/machine/vmconfigs: simplify IsFirstBoot
This is faster and, to my best knowledge, is equivalent to the old code.

Remove the error return (as we don't guarantee stable API here), and
simplify callers.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2025-03-28 17:55:53 -07:00
1227f19393 Added escaping to invoked powershell command for hyperv stubber.
Signed-off-by: ThaddeusTreloar <thaddeus.treloar@protonmail.com>
2024-10-16 13:16:39 +11:00
b2e6d53265 Get WSL disk as an OCI artifact
[Since a few days][1] WSL disk releases are also pushed
to [quay.io/podman/machine-os-wsl][2]. This PR updates
`podman machine init` mechanism to download WSL disk
images. The WSL disk images are now pulled from quay.io
as for the rest of the providers.

Fixes [#22927][3] and [RUN-2177][4]

[1]: https://github.com/containers/podman-machine-wsl-os/pull/6
[2]: https://quay.io/repository/podman/machine-os-wsl?tab=tags
[3]: https://github.com/containers/podman/issues/22927
[4]: https://issues.redhat.com/browse/RUN-2177

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
2024-09-16 14:36:50 +02:00
fe7cc67ef4 Add Rosetta support for Apple Silicon mac
Signed-off-by: Shion Tanaka <shtanaka@redhat.com>
2024-05-17 17:53:28 +09:00
a6ffb5656f hyperv: fix machine rm -r
this pr fixes two hyperv bugs.  previous podman 5 versions of hyperv
failed to actually remove the vm from hyperv when machine rm -f was
called.

also fixes an annoying bug where removal of the hyperv ignition entries
were failing because this can only be done (with the current api) when
the vm is running.  new api in latest libhvee fixes this.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-03-22 11:09:17 -05: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
6272abbbb8 Resurrect auto-port reassignment, but for all providers
- Updates common to pull in new locked edit

[NO NEW TESTS NEEDED]

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2024-03-04 23:55:36 -06: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
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
c93ed35b09 Merge pull request #21848 from baude/machinestartcleanup
Clean up gvproxy if machine start fails
2024-02-28 12:08:21 +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
dfae51a4b8 Clean up gvproxy if machine start fails
Matt found a bug where if a machine start did not run to completion, a
gvproxy was left around running.  This gvproxy then subsequently stopped
the next attempt to start.

Signed-off-by: Brent Baude <bbaude@redhat.com>

[NO NEW TESTS NEEDED]
2024-02-27 13:33:43 -06:00
b68d3c7a0e Fix race conditions in hyperv readiness checking
- Listen before starting the vm
- Fix a device race caused by lazy hv_vsock init by waiting on network manager

[NO NEW TESTS NEEDED]

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2024-02-24 01:43:28 -06: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
bed619ca3d Merge pull request #21664 from n1hility/wsl-fix-conflict
Fixes VM name conflict checking with WSL
2024-02-15 20:24:22 +00:00
d23dd35dc1 Correct VM existance check on WSL
Replaces GetHyperVisorVMs() with Exists() to better abstract the underlying
use-case and slightly imrpove efficiency.

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2024-02-14 15:27:56 -06:00
0e9d867555 machine: machine set only when machine's stopped
Requires that the specified machine's state is `define.Stopped` in order
to set settings.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2024-02-13 16:50:22 -05:00
487219d809 Complete WSL implementation, refactor a few areas
Also addresses a number of issues:
- StopHostNetworking isn't plumbed, win-sshproxy leaks on hyperv
- Wait api and print output doesn't work properly on Windows
- API forwarding doesn't work on WSL
- Terminal corruption with after start/stop on Windows
- Gvproxy is forcefully killed vs gracefully quit
- Switching rootful/rootless does not update /var/run/docker.sock on the guest
- File already closed error on init
- HyperV backend is publishing Unix sockets when it should be named pipes
- User-mode networking doesn't always work
- Stop state outside of lock boundaries
- WSL blocks parallel machined (should be supported)

[NO NEW TESTS NEEDED]

Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
2024-02-11 12:58:11 -06:00
d7cb66492b wsl - wip
Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-02-11 12:58:11 -06:00
2a61998f07 Fail if vm exists in hyperv already
Fix a bug where if a vm exists, created by some other process/user, and
you attempt to make a podman machine with the same name.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-02-10 14:49:34 -06:00
7be6cd4b09 machine: USB passthrough
Sets up USB passthrough for machine. Additionally moves `SetOptions` out
from `pkg/machine/config.go` to its own file in
`pkg/machine/define/setopts.go`.

[NO NEW TESTS NEEDED]

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
2024-02-08 20:30:43 -05:00
72f1617fac Bump Go module to v5
Moving from Go module v4 to v5 prepares us for public releases.

Move done using gomove [1] as with the v3 and v4 moves.

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

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-02-08 09:35:39 -05:00
90c938737a Add functionality for podman machine set --rootful
Adds the functionality for `podman machine set --rootful` for AppleHV,
QEMU, and HyperV. Abstracts the functionality out to a method of
`MachineConfig`. WSL currently uses a function `SetRootful` that is
provided by the `machine` package, which will eventually get changed
when WSL moves to the refactored structure.

Re-enables the "set rootful with docker sock change" test.

[NO NEW TESTS NEEDED]

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-02-07 13:24:18 -06:00
b1ce6ef9a8 podman machine 5 - hyperv
this pr represents the podman 5 maching refactoring for HyperV.  with
the exception of already skipped tests, all local tests pass.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2024-02-07 09:18:51 -06:00