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

Hypervisor framework compability for QEMU driver with --qemu-hvf flag #26

Merged
merged 1 commit into from
Nov 21, 2020
Merged
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
11 changes: 11 additions & 0 deletions drivers/qemu/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type Driver struct {
NetVlan bool
Nographic bool
VirtioDrives bool
HVF bool
Network string
PrivateNetwork string
Boot2PodmanURL string
Expand Down Expand Up @@ -109,6 +110,10 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
Name: "qemu-virtio-drives",
Usage: "Use virtio for drives (cdrom and disk)",
},
mcnflag.BoolFlag{
Name: "qemu-hvf",
Usage: "Use the macOS Hypervisor.framework",
},
mcnflag.StringFlag{
Name: "qemu-network",
Usage: "Name of network to connect to (user, tap, bridge)",
Expand Down Expand Up @@ -208,6 +213,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.NetVlan = flags.Bool("qemu-net-vlan")
d.Nographic = flags.Bool("qemu-nographic")
d.VirtioDrives = flags.Bool("qemu-virtio-drives")
d.HVF = flags.Bool("qemu-hvf")
d.Network = flags.String("qemu-network")
d.Boot2PodmanURL = flags.String("qemu-boot2podman-url")
d.NetworkInterface = flags.String("qemu-network-interface")
Expand Down Expand Up @@ -502,6 +508,11 @@ func (d *Driver) Start() error {

startCmd = append(startCmd, "-daemonize")

if d.HVF {
startCmd = append(startCmd, "-accel", "hvf")
startCmd = append(startCmd, "-cpu", "host")
}

// other options
// "-enable-kvm" if its available
if _, err := os.Stat("/dev/kvm"); err == nil {
Expand Down