Minor improvements to the clarity of hypervisor errors
parent
c925f65629
commit
8920a884c3
|
|
@ -63,6 +63,7 @@ import (
|
|||
"k8s.io/minikube/pkg/minikube/notify"
|
||||
"k8s.io/minikube/pkg/minikube/out"
|
||||
"k8s.io/minikube/pkg/minikube/proxy"
|
||||
"k8s.io/minikube/pkg/minikube/translate"
|
||||
pkgutil "k8s.io/minikube/pkg/util"
|
||||
"k8s.io/minikube/pkg/util/lock"
|
||||
"k8s.io/minikube/pkg/util/retry"
|
||||
|
|
@ -545,13 +546,15 @@ func selectDriver(oldConfig *cfg.Config) string {
|
|||
return oldConfig.MachineConfig.VMDriver
|
||||
}
|
||||
options := driver.Choices()
|
||||
if len(options) == 0 {
|
||||
exit.WithCodeT(exit.Config, "Unable to find a usable default driver. Try specifying --vm-driver")
|
||||
}
|
||||
pick, alts := driver.Choose(options)
|
||||
if len(options) > 1 {
|
||||
out.T(out.Sparkle, `Automatically selected the '{{.driver}}' driver (alternates: {{.alternates}})`, out.V{"driver": pick.Name, "alternates": alts})
|
||||
}
|
||||
|
||||
if pick.Name == "" {
|
||||
exit.WithCodeT(exit.Config, "Unable to determine a default driver to use. Try specifying --vm-driver, or visiting https://minikube.sigs.k8s.io/docs/start/")
|
||||
}
|
||||
|
||||
name = pick.Name
|
||||
}
|
||||
if !driver.Supported(name) {
|
||||
|
|
@ -560,7 +563,13 @@ func selectDriver(oldConfig *cfg.Config) string {
|
|||
|
||||
st := driver.Status(name)
|
||||
if st.Error != nil {
|
||||
out.WarningT("'{{.driver}} error: {{.error}}", out.V{"driver": name, "error": st.Error})
|
||||
out.ErrLn("")
|
||||
out.WarningT("'{{.driver}}' driver reported a possible issue: {{.error}}", out.V{"driver": name, "error": st.Error, "fix": st.Fix})
|
||||
out.ErrT(out.Tip, "Suggestion: {{.fix}}", out.V{"fix": translate.T(st.Fix)})
|
||||
if st.Doc != "" {
|
||||
out.ErrT(out.Documentation, "Documentation: {{.url}}", out.V{"url": st.Doc})
|
||||
}
|
||||
out.ErrLn("")
|
||||
}
|
||||
|
||||
// Detect if our driver conflicts with a previously created VM. If we run into any errors, just move on.
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ import (
|
|||
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"github.com/pborman/uuid"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"k8s.io/minikube/pkg/drivers/hyperkit"
|
||||
cfg "k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
|
|
@ -72,14 +74,14 @@ func configure(config cfg.MachineConfig) interface{} {
|
|||
}
|
||||
|
||||
func status() registry.State {
|
||||
path, err := exec.LookPath("hyperkit")
|
||||
path, err := exec.LookPath("hyperkitz")
|
||||
if err != nil {
|
||||
return registry.State{Error: err, Fix: "Run 'brew install hyperkit'", Doc: docURL}
|
||||
}
|
||||
|
||||
err = exec.Command(path, "-v").Run()
|
||||
if err != nil {
|
||||
return registry.State{Installed: true, Error: err, Fix: "Run 'brew install hyperkit'", Doc: docURL}
|
||||
return registry.State{Installed: true, Error: errors.Wrap(err, "hyperkit -v"), Fix: "Run 'brew install hyperkit'", Doc: docURL}
|
||||
}
|
||||
|
||||
return registry.State{Installed: true, Healthy: true}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
// +build windows
|
||||
|
||||
/*
|
||||
Copyright 2018 The Kubernetes Authors All rights reserved.
|
||||
|
||||
|
|
@ -19,9 +21,12 @@ package hyperv
|
|||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/machine/drivers/hyperv"
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
cfg "k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
|
|
@ -62,9 +67,10 @@ func status() registry.State {
|
|||
return registry.State{Error: err}
|
||||
}
|
||||
|
||||
err = exec.Command(path, "Get-WindowsOptionalFeature", "-FeatureName", "Microsoft-Hyper-V-All", "-Online").Run()
|
||||
cmd := exec.Command(path, "Get-WindowsOptionalFeature", "-FeatureName", "Microsoft-Hyper-V-All", "-Online")
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
return registry.State{Installed: false, Error: err, Fix: "Start PowerShell as Administrator, and run: 'Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All'", Doc: docURL}
|
||||
return registry.State{Installed: false, Error: errors.Wrapf(err, strings.Join(cmd.Args, " ")), Fix: "Start PowerShell as Administrator, and run: 'Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All'", Doc: docURL}
|
||||
}
|
||||
return registry.State{Installed: true, Healthy: true}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ import (
|
|||
"path/filepath"
|
||||
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
|
|
@ -90,14 +92,16 @@ func status() registry.State {
|
|||
return registry.State{Error: err, Fix: "Install libvirt", Doc: docURL}
|
||||
}
|
||||
|
||||
err = exec.Command(path, "qemu").Run()
|
||||
cmd := exec.Command(path, "qemu")
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
return registry.State{Installed: true, Error: err, Fix: "Check output of 'virt-host-validate qemu'", Doc: docURL}
|
||||
return registry.State{Installed: true, Error: errors.Wrap(err, "virt-host-validate"), Fix: fmt.Sprintf("Check output of '%s'", strings.Join(cmd.Args, " ")), Doc: docURL}
|
||||
}
|
||||
|
||||
err = exec.Command("virsh", "list").Run()
|
||||
cmd = exec.Command("virsh", "list")
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
return registry.State{Installed: true, Error: err, Fix: "Check output of 'virsh list'", Doc: docURL}
|
||||
return registry.State{Installed: true, Error: errors.Wrap(err, "virsh list"), Fix: fmt.Sprintf("Check output of '%s'", , strings.Join(cmd.Args, " ")), Doc: docURL}
|
||||
}
|
||||
|
||||
return registry.State{Installed: true, Healthy: true}
|
||||
|
|
|
|||
|
|
@ -19,9 +19,12 @@ package virtualbox
|
|||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/machine/drivers/virtualbox"
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
|
|
@ -65,12 +68,13 @@ func configure(mc config.MachineConfig) interface{} {
|
|||
func status() registry.State {
|
||||
path, err := exec.LookPath("vboxmanage")
|
||||
if err != nil {
|
||||
return registry.State{Error: err, Fix: "Install VirtualBox", Doc: docURL}
|
||||
return registry.State{Error: errors.Wrap(err, "vboxmanage path check"), Fix: "Install VirtualBox", Doc: docURL}
|
||||
}
|
||||
|
||||
err = exec.Command(path, "list", "hostinfo").Run()
|
||||
cmd := exec.Command(path, "list", "hostinfo")
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
return registry.State{Installed: true, Error: err, Fix: "Install the latest version of VirtualBox", Doc: docURL}
|
||||
return registry.State{Installed: true, Error: errors.Wrap(err, strings.Join(cmd.Args, " ")), Fix: "Install the latest version of VirtualBox", Doc: docURL}
|
||||
}
|
||||
|
||||
return registry.State{Installed: true, Healthy: true}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ import (
|
|||
|
||||
"github.com/docker/machine/drivers/vmwarefusion"
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
cfg "k8s.io/minikube/pkg/minikube/config"
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
"k8s.io/minikube/pkg/minikube/localpath"
|
||||
|
|
@ -58,7 +60,7 @@ func configure(config cfg.MachineConfig) interface{} {
|
|||
func status() registry.State {
|
||||
_, err := exec.LookPath("vmrun")
|
||||
if err != nil {
|
||||
return registry.State{Error: err, Fix: "Install VMWare Fusion", Doc: "https://minikube.sigs.k8s.io/docs/reference/drivers/vmwarefusion/"}
|
||||
return registry.State{Error: errors.Wrap(err, "vmrun path check"), Fix: "Install VMWare Fusion", Doc: "https://minikube.sigs.k8s.io/docs/reference/drivers/vmwarefusion/"}
|
||||
}
|
||||
return registry.State{Installed: true, Healthy: true}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue