Merge pull request #2732 from dgageot/better-logs

Improve Start/Stop/Kill/Restart lifecycle/logs
This commit is contained in:
David Gageot 2016-01-04 16:24:55 +01:00
commit db63c28917
1 changed files with 13 additions and 23 deletions

View File

@ -383,26 +383,31 @@ func (d *Driver) Create() error {
}
func (d *Driver) Start() error {
log.Debug("Starting OpenStack instance...", map[string]string{"MachineId": d.MachineId})
if err := d.initCompute(); err != nil {
return err
}
if err := d.client.StartInstance(d); err != nil {
return err
}
return nil
return d.client.StartInstance(d)
}
func (d *Driver) Stop() error {
log.Debug("Stopping OpenStack instance...", map[string]string{"MachineId": d.MachineId})
if err := d.initCompute(); err != nil {
return err
}
if err := d.client.StopInstance(d); err != nil {
return d.client.StopInstance(d)
}
func (d *Driver) Restart() error {
if err := d.initCompute(); err != nil {
return err
}
return nil
return d.client.RestartInstance(d)
}
func (d *Driver) Kill() error {
return d.Stop()
}
func (d *Driver) Remove() error {
@ -422,21 +427,6 @@ func (d *Driver) Remove() error {
return nil
}
func (d *Driver) Restart() error {
log.Info("Restarting OpenStack instance...", map[string]string{"MachineId": d.MachineId})
if err := d.initCompute(); err != nil {
return err
}
if err := d.client.RestartInstance(d); err != nil {
return err
}
return nil
}
func (d *Driver) Kill() error {
return d.Stop()
}
const (
errorMandatoryEnvOrOption string = "%s must be specified either using the environment variable %s or the CLI option %s"
errorMandatoryOption string = "%s must be specified using the CLI option %s"