Remove VBOX_THIRD_PARTY, add GOOS matching

pull/4198/head
Thomas Stromberg 2019-05-03 12:06:28 -07:00
parent e0bf9a55c3
commit 27cd8b1a92
3 changed files with 71 additions and 15 deletions

View File

@ -20,6 +20,7 @@ package exit
import ( import (
"fmt" "fmt"
"os" "os"
"runtime"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/minikube/pkg/minikube/console" "k8s.io/minikube/pkg/minikube/console"
@ -59,7 +60,7 @@ func WithCode(code int, format string, a ...interface{}) {
// WithError outputs an error and exits. // WithError outputs an error and exits.
func WithError(msg string, err error) { func WithError(msg string, err error) {
p := problem.FromError(err) p := problem.FromError(err, runtime.GOOS)
if p != nil { if p != nil {
WithProblem(msg, p) WithProblem(msg, p)
} }

View File

@ -36,10 +36,39 @@ var vmProblems = map[string]match{
Advice: "In some environments, this message is incorrect. Try 'minikube start --no-vtx-check'", Advice: "In some environments, this message is incorrect. Try 'minikube start --no-vtx-check'",
Issues: []int{3900}, Issues: []int{3900},
}, },
"VBOX_THIRD_PARTY": { "VBOX_VERR_VMX_NO_VMX": {
Regexp: re(`The virtual machine * has terminated unexpectedly during startup with exit code 1`), Regexp: re(`VT-x is not available.*VERR_VMX_NO_VMX`),
Advice: "A third-party program may be interfering with VirtualBox. Try disabling any real-time antivirus software, reinstalling VirtualBox and rebooting.", Advice: "Please check your BIOS, and ensure that you are running without HyperV or other nested virtualization that may interfere",
Issues: []int{3910}, Issues: []int{1994},
},
"VBOX_BLOCKED": {
Regexp: re(`NS_ERROR_FAILURE.*0x80004005`),
Advice: "Reinstall VirtualBox and verify that it is not blocked: System Preferences -> Security & Privacy -> General -> Some system software was blocked from loading",
Issues: []int{4107},
GOOS: "darwin",
},
"VBOX_DRV_NOT_LOADED": {
Regexp: re(`The vboxdrv kernel module is not loaded`),
Advice: "Run 'sudo modprobe vboxdrv' and reinstall VirtualBox if it fails.",
Issues: []int{4043},
},
"VBOX_DEVICE_MISSING": {
Regexp: re(`/dev/vboxdrv does not exist`),
Advice: "Run 'sudo modprobe vboxdrv' and reinstall VirtualBox if it fails.",
Issues: []int{3974},
},
"VBOX_HARDENING": {
Regexp: re(`terminated unexpectedly.*VBoxHardening`),
Advice: "Disable real-time anti-virus software, reboot, and reinstall VirtualBox if the problem continues.",
Issues: []int{3859, 3910},
URL: "https://forums.virtualbox.org/viewtopic.php?f=25&t=82106",
GOOS: "windows",
},
"VBOX_HOST_ADAPTER": {
Regexp: re(`The host-only adapter we just created is not visible`),
Advice: "Reboot to complete VirtualBox installation, and verify that VirtualBox is not blocked by your system",
Issues: []int{3614},
URL: "https://stackoverflow.com/questions/52277019/how-to-fix-vm-issue-with-minikube-start",
}, },
"KVM2_NOT_FOUND": { "KVM2_NOT_FOUND": {
Regexp: re(`Driver "kvm2" not found. Do you have the plugin binary .* accessible in your PATH`), Regexp: re(`Driver "kvm2" not found. Do you have the plugin binary .* accessible in your PATH`),
@ -51,16 +80,17 @@ var vmProblems = map[string]match{
Advice: "The KVM driver is unable to resurrect this old VM. Please run `minikube delete` to delete it and try again.", Advice: "The KVM driver is unable to resurrect this old VM. Please run `minikube delete` to delete it and try again.",
Issues: []int{3901, 3566, 3434}, Issues: []int{3901, 3566, 3434},
}, },
"KVM2_NETWORK_DEFINE_XML": {
Regexp: re(`not supported by the connection driver: virNetworkDefineXML`),
Advice: "Rebuild libvirt with virt-network support",
URL: "https://forums.gentoo.org/viewtopic-t-981692-start-0.html",
Issues: []int{4195},
},
"VM_DOES_NOT_EXIST": { "VM_DOES_NOT_EXIST": {
Regexp: re(`Error getting state for host: machine does not exist`), Regexp: re(`Error getting state for host: machine does not exist`),
Advice: "Your system no longer knows about the VM previously created by minikube. Run 'minikube delete' to reset your local state.", Advice: "Your system no longer knows about the VM previously created by minikube. Run 'minikube delete' to reset your local state.",
Issues: []int{3864}, Issues: []int{3864},
}, },
"VM_IP_NOT_FOUND": {
Regexp: re(`Error getting ssh host name for driver: IP not found`),
Advice: "The minikube VM is offline. Please run 'minikube start' to start it again.",
Issues: []int{3849, 3648},
},
"VM_BOOT_FAILED_HYPERV_ENABLED": { "VM_BOOT_FAILED_HYPERV_ENABLED": {
Regexp: re(`VirtualBox won't boot a 64bits VM when Hyper-V is activated`), Regexp: re(`VirtualBox won't boot a 64bits VM when Hyper-V is activated`),
Advice: "Disable Hyper-V when you want to run VirtualBox to boot the VM", Advice: "Disable Hyper-V when you want to run VirtualBox to boot the VM",
@ -156,3 +186,17 @@ var osProblems = map[string]match{
Issues: []int{1574}, Issues: []int{1574},
}, },
} }
// stateProblems are issues relating to local state
var stateProblems = map[string]match{
"MACHINE_DOES_NOT_EXST": {
Regexp: re(`Error getting state for host: machine does not exist`),
Advice: "Run 'minikube delete' to delete the stale VM",
Issues: []int{3864},
},
"IP_NOT_FOUND": {
Regexp: re(`Error getting ssh host name for driver: IP not found`),
Advice: "The minikube VM is offline. Please run 'minikube start' to start it again.",
Issues: []int{3849, 3648},
},
}

View File

@ -27,10 +27,15 @@ const issueBase = "https://github.com/kubernetes/minikube/issues"
// Problem represents a known problem in minikube. // Problem represents a known problem in minikube.
type Problem struct { type Problem struct {
ID string // ID is an arbitrary unique and stable string describing this issue
Err error ID string
// Err is the original error
Err error
// Advice is actionable text that the user should follow
Advice string Advice string
URL string // URL is a reference URL for more information
URL string
// Issues are a list of related issues to this problem
Issues []int Issues []int
} }
@ -40,6 +45,8 @@ type match struct {
Advice string Advice string
URL string URL string
Issues []int Issues []int
// GOOS is what platforms this problem may be specific to, when disambiguation is necessary.
GOOS string
} }
// Display problem metadata to the console // Display problem metadata to the console
@ -62,16 +69,20 @@ func (p *Problem) Display() {
} }
} }
// FromError returns a known problem from an error. // FromError returns a known problem from an error on an OS
func FromError(err error) *Problem { func FromError(err error, os string) *Problem {
maps := []map[string]match{ maps := []map[string]match{
osProblems, osProblems,
vmProblems, vmProblems,
netProblems, netProblems,
deployProblems, deployProblems,
stateProblems,
} }
for _, m := range maps { for _, m := range maps {
for k, v := range m { for k, v := range m {
if v.GOOS != "" && v.GOOS != os {
continue
}
if v.Regexp.MatchString(err.Error()) { if v.Regexp.MatchString(err.Error()) {
return &Problem{ return &Problem{
Err: err, Err: err,