mirror of https://github.com/docker/docs.git
adding hypervisor check to hyper-v driver
Signed-off-by: Theo Thompson <theot@microsoft.com>
This commit is contained in:
parent
5b9663f896
commit
b419c5d9ca
|
|
@ -36,7 +36,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("Hyper-V is installed. VirtualBox won't boot a 64bits VM when Hyper-V is activated. If it's installed but deactivated, you can use --virtualbox-no-vtx-check to try anyways")
|
||||
ErrNotCompatibleWithHyperV = errors.New("This computer is running Hyper-V. VirtualBox won't boot a 64bits VM when Hyper-V is activated. Either use Hyper-V as a driver, or disable the Hyper-V hypervisor. (To skip this check, use --virtualbox-no-vtx-check)")
|
||||
ErrNetworkAddrCidr = errors.New("host-only cidr must be specified with a host address, not a network address")
|
||||
ErrNetworkAddrCollision = errors.New("host-only cidr conflicts with the network address of a host interface")
|
||||
)
|
||||
|
|
|
|||
|
|
@ -95,6 +95,25 @@ func getShareDriveAndName() (string, string) {
|
|||
}
|
||||
|
||||
func isHyperVInstalled() bool {
|
||||
// check if hyper-v is installed
|
||||
_, err := exec.LookPath("vmms.exe")
|
||||
return err == nil
|
||||
if err != nil {
|
||||
errmsg := "Hyper-V is not installed."
|
||||
log.Debugf(errmsg, err)
|
||||
return false
|
||||
}
|
||||
|
||||
// check to see if a hypervisor is present. if hyper-v is installed and enabled,
|
||||
// display an error explaining the incompatibility between virtualbox and hyper-v.
|
||||
output, err := cmdOutput("wmic", "computersystem", "get", "hypervisorpresent")
|
||||
|
||||
if err != nil {
|
||||
errmsg := "Could not check to see if Hyper-V is running."
|
||||
log.Debugf(errmsg, err)
|
||||
return false
|
||||
}
|
||||
|
||||
enabled := strings.Contains(output, "TRUE")
|
||||
return enabled
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue