Logs for Stop

Signed-off-by: David Gageot <david@gageot.net>
This commit is contained in:
David Gageot 2015-12-30 11:44:53 +01:00
parent e2c4801a93
commit bbe76b5a26
10 changed files with 7 additions and 32 deletions

View File

@ -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)
}

View File

@ -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
}

View File

@ -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 {

View File

@ -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

View File

@ -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
}

View File

@ -548,7 +548,6 @@ func (d *Driver) Stop() error {
break
}
}
log.Infof("Stopping VM...")
d.IPAddress = ""

View File

@ -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 {

View File

@ -498,7 +498,6 @@ func (d *Driver) Start() error {
}
func (d *Driver) Stop() error {
p, err := govcloudair.NewClient()
if err != nil {
return err

View File

@ -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
}

View File

@ -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
}