Merge pull request #2695 from dgageot/hyperv-vbox-incompatibility

Detect VBox/HyperV incompatibility
This commit is contained in:
David Gageot 2015-12-28 12:17:41 +01:00
commit 01cc4af89e
4 changed files with 17 additions and 0 deletions

View File

@ -38,6 +38,7 @@ const (
var (
ErrUnableToGenerateRandomIP = errors.New("unable to generate random IP")
ErrMustEnableVTX = errors.New("This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory")
ErrNotCompatibleWithHyperV = errors.New("This computer has Hyper-V installed. VirtualBox refuses to boot a 64bits VM when Hyper-V is installed. See https://www.virtualbox.org/ticket/12350")
ErrNetworkAddrCidr = errors.New("host-only cidr must be specified with a host address, not a network address")
)
@ -213,6 +214,9 @@ func (d *Driver) PreCreateCheck() error {
}
if !d.NoVTXCheck && d.IsVTXDisabled() {
if isHyperVInstalled() {
return ErrNotCompatibleWithHyperV
}
return ErrMustEnableVTX
}

View File

@ -29,3 +29,7 @@ func detectVBoxManageCmd() string {
func getShareDriveAndName() (string, string) {
return "Users", "/Users"
}
func isHyperVInstalled() bool {
return false
}

View File

@ -39,3 +39,7 @@ func detectVBoxManageCmd() string {
func getShareDriveAndName() (string, string) {
return "hosthome", "/home"
}
func isHyperVInstalled() bool {
return false
}

View File

@ -93,3 +93,8 @@ func findVBoxInstallDirInRegistry() (string, error) {
func getShareDriveAndName() (string, string) {
return "c/Users", "c:\\Users"
}
func isHyperVInstalled() bool {
_, err := exec.LookPath("vmms.exe")
return err == nil
}