Skip to content

Commit

Permalink
Fix in the code for the externallyManage
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Sch <[email protected]>
  • Loading branch information
SchSeba committed Jun 19, 2023
1 parent 4e5a5e0 commit 4b6cd35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 9 additions & 0 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,15 @@ func (dn *Daemon) nodeStateSyncHandler() error {
syncStatus: syncStatusInProgress,
lastSyncError: "",
}
// wait for writer to refresh status then pull again the latest node state
<-dn.syncCh
updatedState, err := dn.client.SriovnetworkV1().SriovNetworkNodeStates(namespace).Get(context.Background(), dn.name, metav1.GetOptions{})
if err != nil {
glog.Warningf("nodeStateSyncHandler(): Failed to fetch node state %s: %v", dn.name, err)
return err
}
// we only update the status to avoid any race conditions where a new policy can be applied
latestState.Status = updatedState.Status

// load plugins if has not loaded
if len(dn.enabledPlugins) == 0 {
Expand Down
5 changes: 1 addition & 4 deletions pkg/daemon/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,7 @@ func (w *NodeStateStatusWriter) Run(stop <-chan struct{}, refresh <-chan Message
if err != nil {
glog.Errorf("Run() refresh: writing to node status failed: %v", err)
}

if msg.syncStatus == syncStatusSucceeded || msg.syncStatus == syncStatusFailed {
syncCh <- struct{}{}
}
syncCh <- struct{}{}
case <-time.After(30 * time.Second):
glog.V(2).Info("Run(): period refresh")
if err := w.pollNicStatus(platformType); err != nil {
Expand Down

0 comments on commit 4b6cd35

Please sign in to comment.