Skip to content

Commit

Permalink
ibmcloud-powervs: fix timeout creating PowerVS (DHCP request)
Browse files Browse the repository at this point in the history
This PR ensures that the timeout used to wait the VM to be active
is not used for getting the VM ip.

Fixes: #2177

Signed-off-by: Silenio Quarti <[email protected]>
  • Loading branch information
squarti committed Jan 20, 2025
1 parent ad0401b commit f40ef75
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cloud-providers/ibmcloud-powervs/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ func (p *ibmcloudPowerVSProvider) CreateInstance(ctx context.Context, podName, s
ins := (*pvsInstances)[0]
instanceID := *ins.PvmInstanceID

ctx, cancel := context.WithTimeout(ctx, 150*time.Second)
getctx, cancel := context.WithTimeout(ctx, 150*time.Second)
defer cancel()

logger.Printf("Waiting for instance to reach state: ACTIVE")
err = retry.Do(
func() error {
in, err := p.powervsService.instanceClient(ctx).Get(*ins.PvmInstanceID)
in, err := p.powervsService.instanceClient(getctx).Get(*ins.PvmInstanceID)
if err != nil {
return fmt.Errorf("failed to get the instance: %v", err)
}
Expand All @@ -109,7 +109,7 @@ func (p *ibmcloudPowerVSProvider) CreateInstance(ctx context.Context, podName, s

return fmt.Errorf("Instance failed to reach ACTIVE state")
},
retry.Context(ctx),
retry.Context(getctx),
retry.Attempts(0),
retry.MaxDelay(5*time.Second),
)
Expand Down

0 comments on commit f40ef75

Please sign in to comment.