Merge pull request #2732 from dgageot/better-logs
Improve Start/Stop/Kill/Restart lifecycle/logs
This commit is contained in:
commit
db63c28917
|
@ -383,26 +383,31 @@ func (d *Driver) Create() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Driver) Start() error {
|
func (d *Driver) Start() error {
|
||||||
log.Debug("Starting OpenStack instance...", map[string]string{"MachineId": d.MachineId})
|
|
||||||
if err := d.initCompute(); err != nil {
|
if err := d.initCompute(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := d.client.StartInstance(d); err != nil {
|
|
||||||
return err
|
return d.client.StartInstance(d)
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Driver) Stop() error {
|
func (d *Driver) Stop() error {
|
||||||
log.Debug("Stopping OpenStack instance...", map[string]string{"MachineId": d.MachineId})
|
|
||||||
if err := d.initCompute(); err != nil {
|
if err := d.initCompute(); err != nil {
|
||||||
return err
|
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 err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return d.client.RestartInstance(d)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Driver) Kill() error {
|
||||||
|
return d.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Driver) Remove() error {
|
func (d *Driver) Remove() error {
|
||||||
|
@ -422,21 +427,6 @@ func (d *Driver) Remove() error {
|
||||||
return nil
|
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 (
|
const (
|
||||||
errorMandatoryEnvOrOption string = "%s must be specified either using the environment variable %s or the CLI option %s"
|
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"
|
errorMandatoryOption string = "%s must be specified using the CLI option %s"
|
||||||
|
|
Loading…
Reference in New Issue