Skip to content

Commit

Permalink
Merge pull request #21577 from jakecorrenti/get-default-devices-machi…
Browse files Browse the repository at this point in the history
…neconfig

machine: change getDefaultDevices signature
  • Loading branch information
openshift-merge-bot[bot] authored Feb 9, 2024
2 parents a9ba80b + 02eb907 commit da5bab6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
12 changes: 1 addition & 11 deletions pkg/machine/applehv/stubber.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,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

0 comments on commit da5bab6

Please sign in to comment.