From 23ae121f2b24a26fcec91141a40c624b19eccad7 Mon Sep 17 00:00:00 2001 From: josedonizetti Date: Sat, 29 Jun 2019 10:53:13 -0300 Subject: [PATCH 1/2] kvm2: simplify connection error message --- pkg/drivers/kvm/domain.go | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/pkg/drivers/kvm/domain.go b/pkg/drivers/kvm/domain.go index 88890fa7b5..dc55069927 100644 --- a/pkg/drivers/kvm/domain.go +++ b/pkg/drivers/kvm/domain.go @@ -88,26 +88,6 @@ const domainTmpl = ` ` -const connectionErrorText = ` -Error connecting to libvirt socket. Have you set up libvirt correctly? - -# Install libvirt and qemu-kvm on your system, e.g. -# Debian/Ubuntu (for older Debian/Ubuntu versions, you may have to use libvirt-bin instead of libvirt-clients and libvirt-daemon-system) -$ sudo apt install libvirt-clients libvirt-daemon-system qemu-kvm -# Fedora/CentOS/RHEL -$ sudo yum install libvirt-daemon-kvm qemu-kvm - -# Add yourself to the libvirt group so you don't need to sudo -# NOTE: For older Debian/Ubuntu versions change the group to [libvirtd] -$ sudo usermod -a -G libvirt $(whoami) - -# Update your current session for the group change to take effect -# NOTE: For older Debian/Ubuntu versions change the group to [libvirtd] -$ newgrp libvirt - -Visit https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#kvm2-driver for more information. -` - func randomMAC() (net.HardwareAddr, error) { buf := make([]byte, 6) _, err := rand.Read(buf) @@ -144,7 +124,7 @@ func (d *Driver) getDomain() (*libvirt.Domain, *libvirt.Connect, error) { func getConnection(connectionURI string) (*libvirt.Connect, error) { conn, err := libvirt.NewConnect(connectionURI) if err != nil { - return nil, errors.Wrap(err, connectionErrorText) + return nil, errors.Wrap(err, "error connecting to libvirt socket.") } return conn, nil From 84ce1d556414980e1af75ce3c0a7e6960d374691 Mon Sep 17 00:00:00 2001 From: josedonizetti Date: Sat, 29 Jun 2019 10:58:05 -0300 Subject: [PATCH 2/2] Add kvm connection error problem message --- pkg/minikube/problem/err_map.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/minikube/problem/err_map.go b/pkg/minikube/problem/err_map.go index e7d1a4d78f..316e5ef6d7 100644 --- a/pkg/minikube/problem/err_map.go +++ b/pkg/minikube/problem/err_map.go @@ -119,6 +119,11 @@ var vmProblems = map[string]match{ URL: "http://mikko.repolainen.fi/documents/virtualization-with-kvm", Issues: []int{2991}, }, + "KVM_CONNECTION_ERROR": { + Regexp: re(`error connecting to libvirt socket`), + Advice: "Have you set up libvirt correctly?", + URL: "https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#kvm2-driver", + }, "DRIVER_CRASHED": { Regexp: re(`Error attempting to get plugin server address for RPC`), Advice: "The VM driver exited with an error, and may be corrupt. Run 'minikube start' with --alsologtostderr -v=8 to see the error",