diff --git a/pkg/machine/applehv/stubber.go b/pkg/machine/applehv/stubber.go index ffd6f06c6a..77b5dc8563 100644 --- a/pkg/machine/applehv/stubber.go +++ b/pkg/machine/applehv/stubber.go @@ -137,21 +137,11 @@ func (a AppleHVStubber) StartVM(mc *vmconfigs.MachineConfig) (func() error, func netDevice.SetUnixSocketPath(gvproxySocket.GetPath()) - readySocket, err := mc.ReadySocket() - if err != nil { - return nil, nil, err - } - - logfile, err := mc.LogFile() - if err != nil { - return nil, nil, err - } - // create a one-time virtual machine for starting because we dont want all this information in the // machineconfig if possible. the preference was to derive this stuff vm := vfConfig.NewVirtualMachine(uint(mc.Resources.CPUs), mc.Resources.Memory, mc.AppleHypervisor.Vfkit.VirtualMachine.Bootloader) - defaultDevices, err := getDefaultDevices(mc.ImagePath.GetPath(), logfile.GetPath(), readySocket.GetPath()) + defaultDevices, readySocket, err := getDefaultDevices(mc) if err != nil { return nil, nil, err } diff --git a/pkg/machine/applehv/vfkit.go b/pkg/machine/applehv/vfkit.go index e176053c15..e476614890 100644 --- a/pkg/machine/applehv/vfkit.go +++ b/pkg/machine/applehv/vfkit.go @@ -3,34 +3,43 @@ package applehv import ( + "github.com/containers/podman/v5/pkg/machine/define" "github.com/containers/podman/v5/pkg/machine/vmconfigs" vfConfig "github.com/crc-org/vfkit/pkg/config" ) -// TODO this signature could be an machineconfig -func getDefaultDevices(imagePath, logPath, readyPath string) ([]vfConfig.VirtioDevice, error) { +func getDefaultDevices(mc *vmconfigs.MachineConfig) ([]vfConfig.VirtioDevice, *define.VMFile, error) { var devices []vfConfig.VirtioDevice - disk, err := vfConfig.VirtioBlkNew(imagePath) + disk, err := vfConfig.VirtioBlkNew(mc.ImagePath.GetPath()) if err != nil { - return nil, err + return nil, nil, err } rng, err := vfConfig.VirtioRngNew() if err != nil { - return nil, err + return nil, nil, err } - serial, err := vfConfig.VirtioSerialNew(logPath) + logfile, err := mc.LogFile() if err != nil { - return nil, err + return nil, nil, err + } + serial, err := vfConfig.VirtioSerialNew(logfile.GetPath()) + if err != nil { + return nil, nil, err } - readyDevice, err := vfConfig.VirtioVsockNew(1025, readyPath, true) + readySocket, err := mc.ReadySocket() if err != nil { - return nil, err + return nil, nil, err + } + + readyDevice, err := vfConfig.VirtioVsockNew(1025, readySocket.GetPath(), true) + if err != nil { + return nil, nil, err } devices = append(devices, disk, rng, serial, readyDevice) - return devices, nil + return devices, readySocket, nil } func getDebugDevices() ([]vfConfig.VirtioDevice, error) {