Add more logging

pull/6452/head
Thomas Stromberg 2020-01-31 18:44:00 -08:00
parent 6760929a72
commit 7f0e83508a
2 changed files with 10 additions and 2 deletions

View File

@ -200,7 +200,7 @@ func (d *Driver) Start() error {
// Stop a host gracefully, including any containers that we are managing.
func (d *Driver) Stop() error {
if err := stopKubelet(d.exec); err != nil {
return err
return errors.Wrap(err, "stop kubelet")
}
containers, err := d.runtime.ListContainers(cruntime.ListOptions{})
if err != nil {
@ -208,9 +208,10 @@ func (d *Driver) Stop() error {
}
if len(containers) > 0 {
if err := d.runtime.StopContainers(containers); err != nil {
return errors.Wrap(err, "stop")
return errors.Wrap(err, "stop containers")
}
}
glog.Infof("none driver is stopped!")
return nil
}

View File

@ -284,6 +284,12 @@ func trySSHPowerOff(h *host.Host) error {
// StopHost stops the host VM, saving state to disk.
func StopHost(api libmachine.API) error {
glog.Infof("Stopping host ...")
start := time.Now()
defer func() {
glog.Infof("Stopped host within %s", time.Since(start))
}()
machineName := viper.GetString(config.MachineProfile)
host, err := api.Load(machineName)
if err != nil {
@ -299,6 +305,7 @@ func StopHost(api libmachine.API) error {
}
if err := host.Stop(); err != nil {
glog.Infof("host.Stop failed: %v", err)
alreadyInStateError, ok := err.(mcnerror.ErrHostAlreadyInState)
if ok && alreadyInStateError.State == state.Stopped {
return nil