Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

machine: change getDefaultDevices signature #21577

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions pkg/machine/applehv/stubber.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
29 changes: 19 additions & 10 deletions pkg/machine/applehv/vfkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading