Add more logging
parent
6760929a72
commit
7f0e83508a
|
@ -200,7 +200,7 @@ func (d *Driver) Start() error {
|
||||||
// Stop a host gracefully, including any containers that we are managing.
|
// Stop a host gracefully, including any containers that we are managing.
|
||||||
func (d *Driver) Stop() error {
|
func (d *Driver) Stop() error {
|
||||||
if err := stopKubelet(d.exec); err != nil {
|
if err := stopKubelet(d.exec); err != nil {
|
||||||
return err
|
return errors.Wrap(err, "stop kubelet")
|
||||||
}
|
}
|
||||||
containers, err := d.runtime.ListContainers(cruntime.ListOptions{})
|
containers, err := d.runtime.ListContainers(cruntime.ListOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -208,9 +208,10 @@ func (d *Driver) Stop() error {
|
||||||
}
|
}
|
||||||
if len(containers) > 0 {
|
if len(containers) > 0 {
|
||||||
if err := d.runtime.StopContainers(containers); err != nil {
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -284,6 +284,12 @@ func trySSHPowerOff(h *host.Host) error {
|
||||||
|
|
||||||
// StopHost stops the host VM, saving state to disk.
|
// StopHost stops the host VM, saving state to disk.
|
||||||
func StopHost(api libmachine.API) error {
|
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)
|
machineName := viper.GetString(config.MachineProfile)
|
||||||
host, err := api.Load(machineName)
|
host, err := api.Load(machineName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -299,6 +305,7 @@ func StopHost(api libmachine.API) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := host.Stop(); err != nil {
|
if err := host.Stop(); err != nil {
|
||||||
|
glog.Infof("host.Stop failed: %v", err)
|
||||||
alreadyInStateError, ok := err.(mcnerror.ErrHostAlreadyInState)
|
alreadyInStateError, ok := err.(mcnerror.ErrHostAlreadyInState)
|
||||||
if ok && alreadyInStateError.State == state.Stopped {
|
if ok && alreadyInStateError.State == state.Stopped {
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue