Skip to content

Commit

Permalink
Merge pull request #26 from leonsmith/master
Browse files Browse the repository at this point in the history
Hypervisor framework compability for QEMU driver with --qemu-hvf flag
  • Loading branch information
afbjorklund authored Nov 21, 2020
2 parents 7574ee6 + caa4dad commit 3a9bcd0
Showing 1 changed file with 11 additions and 0 deletions.
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

0 comments on commit 3a9bcd0

Please sign in to comment.