Adding zone information when using warmed instances
@@ -958,9 +958,11 @@ func (p *gceProvider) stepInsertInstance(c *gceStartContext) multistep.StepActio
logger.WithFields(logrus.Fields{
"ip": warmerResponse.IP,
"name": warmerResponse.Name,
+ "zone": warmerResponse.Zone
}).Info("got instance from warmer")
inst.Name = warmerResponse.Name
+ inst.Zone = warmerResponse.Zone
c.instance = inst
c.instanceWarmedIP = warmerResponse.IP
if p.ic.PublicIPConnect && warmerResponse.PublicIP != "" {
@@ -1466,6 +1468,7 @@ type warmerRequest struct {
type warmerResponse struct {
Name string `json:"name"`
+ Zone string `json:"zone"`
IP string `json:"ip"`
PublicIP string `json:"public_ip"`
SSHPrivateKey string `json:"ssh_private_key"`
@@ -1550,7 +1553,7 @@ func (i *gceInstance) refreshInstance(ctx gocontext.Context) error {
defer span.End()
i.provider.apiRateLimit(ctx)
- inst, err := i.client.Instances.Get(i.projectID, i.zoneName, i.instance.Name).Context(ctx).Do()
+ inst, err := i.client.Instances.Get(i.projectID, i.instance.Zone, i.instance.Name).Context(ctx).Do()
if err != nil {
return err
}
@@ -1812,7 +1815,7 @@ func (i *gceInstance) Stop(ctx gocontext.Context) error {
}
func (i *gceInstance) stepDeleteInstance(c *gceInstanceStopContext) multistep.StepAction {
- op, err := i.client.Instances.Delete(i.projectID, i.zoneName, i.instance.Name).Context(c.ctx).Do()
+ op, err := i.client.Instances.Delete(i.projectID, i.instance.Zone, i.instance.Name).Context(c.ctx).Do()
if err != nil {
c.errChan <- err
return multistep.ActionHalt
@@ -1842,7 +1845,7 @@ func (i *gceInstance) stepWaitForInstanceDeleted(c *gceInstanceStopContext) mult
span.End()
zoneOpCall := i.client.ZoneOperations.Get(i.projectID,
- i.zoneName, c.instanceDeleteOp.Name)
+ i.instance.Zone, c.instanceDeleteOp.Name)
b := backoff.NewExponentialBackOff()
b.InitialInterval = i.ic.StopPollSleep
