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 41eb270
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 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
10 changes: 6 additions & 4 deletions xenserver/vm_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,11 +624,13 @@ 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")
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))
}
data.CheckIPTimeout = types.Int64Value(int64(checkIPDuration))

ip, err := checkIP(ctx, session, vmRecord)
if err != nil {
Expand Down

0 comments on commit 41eb270

Please sign in to comment.