return stopped profile status quickly

pull/9557/head
Sharif Elgamal 2020-10-26 13:20:03 -07:00
parent 53ba056626
commit 055de4edf8
5 changed files with 16 additions and 2 deletions

View File

@ -33,6 +33,7 @@ import (
"k8s.io/minikube/pkg/minikube/style"
"github.com/docker/machine/libmachine"
"github.com/docker/machine/libmachine/state"
"github.com/olekukonko/tablewriter"
"github.com/spf13/cobra"
@ -97,6 +98,16 @@ func profileStatus(p *config.Profile, api libmachine.API) string {
return "Unknown"
}
// The machine isn't running, no need to check inside
s, err := host.Driver.GetState()
if err != nil {
klog.Warningf("error getting host state: %v", err)
return "Unknown"
}
if s != state.Running {
return s.String()
}
cr, err := machine.CommandRunner(host)
if err != nil {
klog.Warningf("error loading profiles: %v", err)

1
go.mod
View File

@ -49,6 +49,7 @@ require (
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/libvirt/libvirt-go v3.4.0+incompatible
github.com/machine-drivers/docker-machine-driver-vmware v0.1.1
github.com/machine-drivers/machine v0.16.2 // indirect
github.com/mattn/go-isatty v0.0.12
github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b
github.com/moby/hyperkit v0.0.0-20171020124204-a12cd7250bcd

2
go.sum
View File

@ -755,6 +755,8 @@ github.com/machine-drivers/docker-machine-driver-vmware v0.1.1 h1:+E1IKKk+6kaQrC
github.com/machine-drivers/docker-machine-driver-vmware v0.1.1/go.mod h1:ej014C83EmSnxJeJ8PtVb8OLJ91PJKO1Q8Y7sM5CK0o=
github.com/machine-drivers/machine v0.7.1-0.20200810185219-7d42fed1b770 h1:jc5SzpD28ZqDb+PoA4FxOwkl+slv593qJjrMVM35JFQ=
github.com/machine-drivers/machine v0.7.1-0.20200810185219-7d42fed1b770/go.mod h1:79Uwa2hGd5S39LDJt58s8JZcIhGEK6pkq9bsuTbFWbk=
github.com/machine-drivers/machine v0.16.2 h1:v7+AQ3SdVC5TytHfEf/ivCJbyaxIj+MxNFXFPvqFdc8=
github.com/machine-drivers/machine v0.16.2/go.mod h1:79Uwa2hGd5S39LDJt58s8JZcIhGEK6pkq9bsuTbFWbk=
github.com/magiconair/properties v1.7.6/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=

View File

@ -204,7 +204,7 @@ func ListProfiles(miniHome ...string) (validPs []*Profile, inValidPs []*Profile,
if err != nil {
return nil, nil, err
}
// try to get profiles list based on all contrainers created by docker driver
// try to get profiles list based on all containers created by docker driver
cs, err := oci.ListOwnedContainers(oci.Docker)
if err == nil {
pDirs = append(pDirs, cs...)

View File

@ -26,7 +26,7 @@ import (
// Profile represents a minikube profile
type Profile struct {
Name string
Status string // running, stopped
Status string // running, stopped, paused, unknown
Config *ClusterConfig
}