Skip to content

Commit

Permalink
Clearer output when re-using VM's so that users know what they are wa…
Browse files Browse the repository at this point in the history
…iting on
  • Loading branch information
tstromberg committed Feb 12, 2019
1 parent 0a5b64e commit 3454c83
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
6 changes: 0 additions & 6 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,6 @@ func startHost(api libmachine.API, mc cfg.MachineConfig) (*host.Host, bool) {
if mc.VMDriver == constants.DriverNone {
console.OutStyle("starting-none", "Configuring local host environment ...")
prepareNone()
} else {
if exists {
console.OutStyle("waiting", "Spinning up existing VM for %q ...", cfg.GetMachineName())
} else {
console.OutStyle("starting-vm", "Creating %s VM (CPUs=%d, Memory=%dMB, Disk=%dMB) ...", mc.VMDriver, mc.CPUs, mc.Memory, mc.DiskSize)
}
}

var host *host.Host
Expand Down
11 changes: 10 additions & 1 deletion pkg/minikube/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ func StartHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error)
return nil, errors.Wrap(err, "Error getting state for host")
}

if s != state.Running {
if s == state.Running {
console.OutStyle("running", "Re-using the currently running %s VM for %q ...", h.Driver.DriverName(), cfg.GetMachineName())
} else {
console.OutStyle("restarting", "Restarting existing %s VM for %q ...", h.Driver.DriverName(), cfg.GetMachineName())
if err := h.Driver.Start(); err != nil {
return nil, errors.Wrap(err, "start")
}
Expand All @@ -106,6 +109,11 @@ func StartHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error)
}

e := engineOptions(config)
glog.Infof("engine options: %+v", e)

// Slightly counter-intuitive, but this is what DetectProvisioner & ConfigureAuth block on.
console.OutStyle("waiting", "Waiting for SSH access ...")

if len(e.Env) > 0 {
h.HostOptions.EngineOptions.Env = e.Env
provisioner, err := provision.DetectProvisioner(h.Driver)
Expand Down Expand Up @@ -240,6 +248,7 @@ func createHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error
return nil, err
}

console.OutStyle("starting-vm", "Creating %s VM (CPUs=%d, Memory=%dMB, Disk=%dMB) ...", config.VMDriver, config.CPUs, config.Memory, config.DiskSize)
def, err := registry.Driver(config.VMDriver)
if err != nil {
if err == registry.ErrDriverNotFound {
Expand Down
36 changes: 19 additions & 17 deletions pkg/minikube/console/style.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,25 @@ type style struct {
// styles is a map of style name to style struct
// For consistency, ensure that emojis added render with the same width across platforms.
var styles = map[string]style{
"happy": {Prefix: "😄 "},
"success": {Prefix: "✅ "},
"failure": {Prefix: "❌ "},
"conflict": {Prefix: "💥 "},
"fatal": {Prefix: "💣 "},
"notice": {Prefix: "📌 "},
"ready": {Prefix: "🏄 "},
"restarting": {Prefix: "🔄 "},
"stopping": {Prefix: "✋ "},
"stopped": {Prefix: "🛑 "},
"warning": {Prefix: "⚠️ "},
"waiting": {Prefix: "⌛ "},
"usage": {Prefix: "💡 "},
"launch": {Prefix: "🚀 "},
"thumbs-up": {Prefix: "👍 "},
"option": {Prefix: " ▪ "}, // Indented bullet
"crushed": {Prefix: "💔 "},
"happy": {Prefix: "😄 "},
"success": {Prefix: "✅ "},
"failure": {Prefix: "❌ "},
"conflict": {Prefix: "💥 "},
"fatal": {Prefix: "💣 "},
"notice": {Prefix: "📌 "},
"ready": {Prefix: "🏄 "},
"restarting": {Prefix: "🔄 "},
"running": {Prefix: "🏃 "},
"provisioning": {Prefix: "🌱 "},
"stopping": {Prefix: "✋ "},
"stopped": {Prefix: "🛑 "},
"warning": {Prefix: "⚠️ "},
"waiting": {Prefix: "⌛ "},
"usage": {Prefix: "💡 "},
"launch": {Prefix: "🚀 "},
"thumbs-up": {Prefix: "👍 "},
"option": {Prefix: " ▪ "}, // Indented bullet
"crushed": {Prefix: "💔 "},

// Specialized purpose styles
"iso-download": {Prefix: "💿 "},
Expand Down

0 comments on commit 3454c83

Please sign in to comment.