Show "localhost" information for none driver

pull/4729/head
Anders F Björklund 2019-07-10 17:27:21 +02:00
parent 4642b66ebc
commit fdb4f9b167
3 changed files with 16 additions and 0 deletions

1
go.mod
View File

@ -73,6 +73,7 @@ require (
github.com/r2d4/external-storage v0.0.0-20171222174501-8c0e8605dc7b
github.com/russross/blackfriday v0.0.0-20151117072312-300106c228d5 // indirect
github.com/samalba/dockerclient v0.0.0-20160414174713-91d7393ff859 // indirect
github.com/shirou/gopsutil v2.18.12+incompatible
github.com/shurcooL/sanitized_anchor_name v0.0.0-20151028001915-10ef21a441db // indirect
github.com/sirupsen/logrus v1.4.1 // indirect
github.com/spf13/afero v0.0.0-20160816080757-b28a7effac97 // indirect

2
go.sum
View File

@ -161,6 +161,8 @@ github.com/russross/blackfriday v0.0.0-20151117072312-300106c228d5 h1:+6eORf9Bt4
github.com/russross/blackfriday v0.0.0-20151117072312-300106c228d5/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/samalba/dockerclient v0.0.0-20160414174713-91d7393ff859 h1:XRl74t6xHKI5EVIjDI5nPlHRq0bHED9/TjQuD8/UMkE=
github.com/samalba/dockerclient v0.0.0-20160414174713-91d7393ff859/go.mod h1:yeYR4SlaRZJct6lwNRKR+qd0CocnxxWDE7Vh5dxsn/w=
github.com/shirou/gopsutil v2.18.12+incompatible h1:1eaJvGomDnH74/5cF4CTmTbLHAriGFsTZppLXDX93OM=
github.com/shirou/gopsutil v2.18.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shurcooL/sanitized_anchor_name v0.0.0-20151028001915-10ef21a441db h1:lrOUn8raSZS/V52c7elGaEyuogqSkEo/Qj2Auo2G1ik=
github.com/shurcooL/sanitized_anchor_name v0.0.0-20151028001915-10ef21a441db/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k=

View File

@ -37,6 +37,9 @@ import (
"github.com/docker/machine/libmachine/state"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/mem"
"github.com/spf13/viper"
cfg "k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/console"
@ -344,11 +347,21 @@ To disable this message, run [minikube config set ShowDriverDeprecationNotificat
}
}
func megs(bytes uint64) int {
return int(bytes / 1024 / 1024)
}
func createHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error) {
preCreateHost(&config)
if config.VMDriver != constants.DriverNone {
console.OutStyle(console.StartingVM, "Creating %s VM (CPUs=%d, Memory=%dMB, Disk=%dMB) ...", config.VMDriver, config.CPUs, config.Memory, config.DiskSize)
} else {
i, _ := cpu.Info()
v, _ := mem.VirtualMemory()
d, _ := disk.Usage("/")
console.OutStyle(console.StartingNone, "Running on localhost (CPUs=%d, Memory=%dMB, Disk=%dMB) ...", len(i), megs(v.Total), megs(d.Total))
}
def, err := registry.Driver(config.VMDriver)
if err != nil {
if err == registry.ErrDriverNotFound {