Skip to content

Commit

Permalink
Merge pull request #3761 from trozet/wait_for_sb_chassis
Browse files Browse the repository at this point in the history
Adds a wait for SB chassis for port binding
  • Loading branch information
trozet committed Jul 12, 2023
2 parents 437d2ab + f7b2777 commit feea09c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions go-controller/pkg/ovn/zone_interconnect/zone_ic_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,21 @@ func (zic *ZoneInterconnectHandler) setRemotePortBindingChassis(nodeName, portNa
Name: chassisId,
}

// the chassis is created in NBDB by ovnk and takes some time to propagate. Let's make sure it exists before we try
// to set the port binding
maxTimeout := 10 * time.Second
var err1 error
err := wait.PollUntilContextTimeout(context.TODO(), 50*time.Millisecond, maxTimeout, true, func(ctx context.Context) (bool, error) {
if _, err1 = libovsdbops.GetChassis(zic.sbClient, &chassis); err1 != nil {
return false, nil
}
return true, nil
})

if err != nil {
return fmt.Errorf("failed to find chassis after %s: %w, %v", maxTimeout, err, err1)
}

if err := libovsdbops.UpdatePortBindingSetChassis(zic.sbClient, &remotePort, &chassis); err != nil {
return fmt.Errorf("failed to update chassis %s for remote port %s, error: %w", nodeName, portName, err)
}
Expand Down

0 comments on commit feea09c

Please sign in to comment.