diff --git a/drivers/amazonec2/amazonec2.go b/drivers/amazonec2/amazonec2.go index b0f268e6d7..26734ee355 100644 --- a/drivers/amazonec2/amazonec2.go +++ b/drivers/amazonec2/amazonec2.go @@ -630,7 +630,6 @@ func (d *Driver) Stop() error { } func (d *Driver) Remove() error { - if err := d.terminate(); err != nil { return fmt.Errorf("unable to terminate instance: %s", err) } diff --git a/drivers/azure/azure.go b/drivers/azure/azure.go index f898425888..fae0f0255d 100644 --- a/drivers/azure/azure.go +++ b/drivers/azure/azure.go @@ -304,15 +304,6 @@ func (d *Driver) Stop() error { return err } - if vmState, err := d.GetState(); err != nil { - return err - } else if vmState == state.Stopped { - log.Infof("Host is already stopped") - return nil - } - - log.Debugf("stopping %s", d.MachineName) - if err := vmClient.ShutdownRole(d.MachineName, d.MachineName, d.MachineName); err != nil { return err } diff --git a/drivers/exoscale/exoscale.go b/drivers/exoscale/exoscale.go index cdc069f2d6..297c71349f 100644 --- a/drivers/exoscale/exoscale.go +++ b/drivers/exoscale/exoscale.go @@ -343,24 +343,14 @@ func (d *Driver) Start() error { } func (d *Driver) Stop() error { - vmstate, err := d.GetState() - if err != nil { - return err - } - if vmstate == state.Stopped { - log.Infof("Host is already stopped") - return nil - } - client := egoscale.NewClient(d.URL, d.APIKey, d.APISecretKey) + svmresp, err := client.StopVirtualMachine(d.ID) if err != nil { return err } - if err = d.waitForJob(client, svmresp); err != nil { - return err - } - return nil + + return d.waitForJob(client, svmresp) } func (d *Driver) Remove() error { diff --git a/drivers/google/compute_util.go b/drivers/google/compute_util.go index 846b9deae4..729bbffb43 100644 --- a/drivers/google/compute_util.go +++ b/drivers/google/compute_util.go @@ -340,7 +340,6 @@ func (c *ComputeUtil) deleteInstance() error { // stopInstance stops the instance. func (c *ComputeUtil) stopInstance() error { - log.Infof("Stopping instance.") op, err := c.service.Instances.Stop(c.project, c.zone, c.instanceName).Do() if err != nil { return err diff --git a/drivers/openstack/openstack.go b/drivers/openstack/openstack.go index d2dd0d58c9..a74eba18cd 100644 --- a/drivers/openstack/openstack.go +++ b/drivers/openstack/openstack.go @@ -396,7 +396,6 @@ func (d *Driver) Start() error { } func (d *Driver) Stop() error { - log.Debug("Stopping OpenStack instance...", map[string]string{"MachineId": d.MachineId}) if err := d.initCompute(); err != nil { return err } diff --git a/drivers/virtualbox/virtualbox.go b/drivers/virtualbox/virtualbox.go index 15d89e2615..c311a014a2 100644 --- a/drivers/virtualbox/virtualbox.go +++ b/drivers/virtualbox/virtualbox.go @@ -548,7 +548,6 @@ func (d *Driver) Stop() error { break } } - log.Infof("Stopping VM...") d.IPAddress = "" diff --git a/drivers/vmwarefusion/fusion_darwin.go b/drivers/vmwarefusion/fusion_darwin.go index 8d17660ddf..190ab4d432 100644 --- a/drivers/vmwarefusion/fusion_darwin.go +++ b/drivers/vmwarefusion/fusion_darwin.go @@ -408,13 +408,11 @@ func (d *Driver) Start() error { } func (d *Driver) Stop() error { - log.Infof("Gracefully shutting down %s...", d.MachineName) - vmrun("stop", d.vmxPath(), "nogui") - return nil + _, _, err := vmrun("stop", d.vmxPath(), "nogui") + return err } func (d *Driver) Remove() error { - s, _ := d.GetState() if s == state.Running { if err := d.Kill(); err != nil { diff --git a/drivers/vmwarevcloudair/vcloudair.go b/drivers/vmwarevcloudair/vcloudair.go index d90287485e..5a003ac057 100644 --- a/drivers/vmwarevcloudair/vcloudair.go +++ b/drivers/vmwarevcloudair/vcloudair.go @@ -498,7 +498,6 @@ func (d *Driver) Start() error { } func (d *Driver) Stop() error { - p, err := govcloudair.NewClient() if err != nil { return err diff --git a/drivers/vmwarevsphere/vsphere.go b/drivers/vmwarevsphere/vsphere.go index 83f36f34a8..ef51f47acd 100644 --- a/drivers/vmwarevsphere/vsphere.go +++ b/drivers/vmwarevsphere/vsphere.go @@ -597,7 +597,7 @@ func (d *Driver) Stop() error { if err != nil { return err } - log.Infof("Powering off VM...") + if err := vm.ShutdownGuest(ctx); err != nil { return err } diff --git a/libmachine/host/host.go b/libmachine/host/host.go index f2778ac0af..363e79fc13 100644 --- a/libmachine/host/host.go +++ b/libmachine/host/host.go @@ -103,6 +103,7 @@ func (h *Host) Start() error { } func (h *Host) Stop() error { + log.Infof("Stopping %q...", h.Name) if err := h.runActionForState(h.Driver.Stop, state.Stopped); err != nil { return err }