address review comments

pull/7672/head
Medya Gh 2020-04-15 10:17:23 -07:00
parent 36bfdeab7b
commit 1c125e78da
3 changed files with 4 additions and 6 deletions

View File

@ -273,16 +273,15 @@ func (d *Driver) Remove() error {
if err := oci.DeleteContainer(d.NodeConfig.OCIBinary, d.MachineName); err != nil {
if strings.Contains(err.Error(), "is already in progress") {
glog.Warningf("Docker engine is stuck. please restart docker daemon on your computer.")
return err
return errors.Wrap(err, "stuck delete")
}
if strings.Contains(err.Error(), "No such container:") {
glog.Infof("no container name %q found to delete", d.MachineName)
return nil
return nil // nothing was found to delete.
}
}
// check there be no container left after delete
if id, err := oci.ContainerID(d.OCIBinary, d.MachineName); err == nil && id != "" {
return fmt.Errorf("expected no container ID be found for %q after delete. but got %q", d.MachineName, id)
}

View File

@ -47,7 +47,6 @@ func StopHost(api libmachine.API, machineName string) error {
func stop(h *host.Host) error {
start := time.Now()
if driver.NeedsShutdown(h.DriverName) {
glog.Infof("As there are issues with stopping Hyper-V VMs using API, trying to shut down using SSH")
if err := trySSHPowerOff(h); err != nil {
return errors.Wrap(err, "ssh power off")
}
@ -79,6 +78,7 @@ func trySSHPowerOff(h *host.Host) error {
}
out.T(out.Shutdown, `Powering off "{{.profile_name}}" via SSH ...`, out.V{"profile_name": h.Name})
// differnet for kic because RunSSHCommand is not implemented by kic
if driver.IsKIC(h.DriverName) {
err := oci.ShutDown(h.DriverName, h.Name)
glog.Infof("shutdown container: err=%v", err)

View File

@ -53,7 +53,6 @@ func TestPause(t *testing.T) {
})
}
// validateFreshStart
func validateFreshStart(ctx context.Context, t *testing.T, profile string) {
args := append([]string{"start", "-p", profile, "--memory=1800", "--install-addons=false", "--wait=false"}, StartArgs()...)
rr, err := Run(t, exec.CommandContext(ctx, Target(), args...))