提交 7f0e8350 编写于 作者: T Thomas Stromberg

Add more logging

上级 6760929a
......@@ -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
}
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册