Skip to content

Commit

Permalink
kvm2 driver: add static ip
Browse files Browse the repository at this point in the history
  • Loading branch information
prezha committed Mar 26, 2021
1 parent 567af21 commit c543a01
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions pkg/minikube/registry/drvs/kvm2/kvm2.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func status() registry.State {
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()

path, err := exec.LookPath("virsh")
_, err := exec.LookPath("virsh")
if err != nil {
return registry.State{Error: err, Fix: "Install libvirt", Doc: docURL}
}
Expand Down Expand Up @@ -146,23 +146,27 @@ func status() registry.State {
}
}

// On Ubuntu 19.10 (libvirt 5.4), this fails if LIBVIRT_DEFAULT_URI is unset
cmd := exec.CommandContext(ctx, path, "domcapabilities", "--virttype", "kvm")
// below check failes - https://storage.googleapis.com/minikube-builds/logs/10792/567af21/KVM_Linux.html#fail_TestAddons:
// I0326 19:22:53.876790 7733 start.go:729] status for kvm2: {Installed:true Healthy:false Running:true NeedsImprovement:false Error:/usr/bin/virsh domcapabilities --virttype kvm failed:
// error: failed to get emulator capabilities
// error: invalid argument: KVM is not supported by '/usr/bin/qemu-system-x86_64' on this host
// // On Ubuntu 19.10 (libvirt 5.4), this fails if LIBVIRT_DEFAULT_URI is unset
// cmd := exec.CommandContext(ctx, path, "domcapabilities", "--virttype", "kvm")
// cmd.Env = append(os.Environ(), fmt.Sprintf("LIBVIRT_DEFAULT_URI=%s", defaultURI()))
// out, err := cmd.CombinedOutput()
// if err != nil {
// return registry.State{
// Installed: true,
// Running: true,
// Error: fmt.Errorf("%s failed:\n%s\n%v", strings.Join(cmd.Args, " "), strings.TrimSpace(string(out)), err),
// Fix: "Follow your Linux distribution instructions for configuring KVM",
// Doc: docURL,
// }
// }

cmd := exec.CommandContext(ctx, "virsh", "list")
cmd.Env = append(os.Environ(), fmt.Sprintf("LIBVIRT_DEFAULT_URI=%s", defaultURI()))
out, err := cmd.CombinedOutput()
if err != nil {
return registry.State{
Installed: true,
Running: true,
Error: fmt.Errorf("%s failed:\n%s\n%v", strings.Join(cmd.Args, " "), strings.TrimSpace(string(out)), err),
Fix: "Follow your Linux distribution instructions for configuring KVM",
Doc: docURL,
}
}

cmd = exec.CommandContext(ctx, "virsh", "list")
cmd.Env = append(os.Environ(), fmt.Sprintf("LIBVIRT_DEFAULT_URI=%s", defaultURI()))
out, err = cmd.CombinedOutput()
if err != nil {
return registry.State{
Installed: true,
Expand Down

0 comments on commit c543a01

Please sign in to comment.