Skip to content

Commit

Permalink
CA-401363 Remove backoff retries on terraform destroy
Browse files Browse the repository at this point in the history
Signed-off-by: Fei Su <fei.su@cloud.com>
  • Loading branch information
acefei committed Nov 6, 2024
1 parent 836a15e commit bcb4984
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
6 changes: 1 addition & 5 deletions xenserver/pool_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,7 @@ func cleanupPoolResource(session *xenapi.Session, poolRef xenapi.PoolRef) error
continue
}

operation := func() error {
return xenapi.Pool.Eject(session, hostRef)
}

err = backoff.Retry(operation, backoff.NewExponentialBackOff())
err = xenapi.Pool.Eject(session, hostRef)
if err != nil {
return errors.New(err.Error())
}
Expand Down
20 changes: 11 additions & 9 deletions xenserver/vm_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,17 +624,19 @@ func updateVMResourceModelComputed(ctx context.Context, session *xenapi.Session,
return err
}

checkIPDuration, err := strconv.Atoi(vmRecord.OtherConfig["tf_check_ip_timeout"])
if err != nil {
return errors.New("unable to convert check_ip_timeout to an int value")
}
data.CheckIPTimeout = types.Int64Value(int64(checkIPDuration))
if _, ok := vmRecord.OtherConfig["tf_check_ip_timeout"]; ok {
checkIPDuration, err := strconv.Atoi(vmRecord.OtherConfig["tf_check_ip_timeout"])
if err != nil {
return errors.New("unable to convert check_ip_timeout to an int value")
}
data.CheckIPTimeout = types.Int64Value(int64(checkIPDuration))

ip, err := checkIP(ctx, session, vmRecord)
if err != nil {
return err
ip, err := checkIP(ctx, session, vmRecord)
if err != nil {
return err
}
data.DefaultIP = types.StringValue(ip)
}
data.DefaultIP = types.StringValue(ip)

return nil
}
Expand Down

0 comments on commit bcb4984

Please sign in to comment.