Skip to content

Commit

Permalink
Trigger daemon reconcilation loop when status changes
Browse files Browse the repository at this point in the history
The sriov config daemon did not reconcile the VFs when users modified
propertities without using sriov policies. The status of the sriov
network node state object was modified though, but this didn't trigger
the start of the reconcilation loop.

Signed-off-by: Marcelo Guerrero <[email protected]>
  • Loading branch information
mlguerrero12 committed Oct 30, 2023
1 parent c4d9e6c commit d4716bf
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"os"
"os/exec"
"path"
"reflect"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -455,7 +456,26 @@ func (dn *Daemon) nodeStateSyncHandler() error {
}
}

if dn.nodeState.GetGeneration() == latest {
if latestState.GetGeneration() == 1 && len(latestState.Spec.Interfaces) == 0 {
err = dn.storeManager.ClearPCIAddressFolder()
if err != nil {
glog.Errorf("failed to clear the PCI address configuration: %v", err)
return err
}

glog.V(0).Infof("nodeStateSyncHandler(): Name: %s, Interface policy spec not yet set by controller", latestState.Name)
if latestState.Status.SyncStatus != "Succeeded" {
dn.refreshCh <- Message{
syncStatus: "Succeeded",
lastSyncError: "",
}
// wait for writer to refresh status
<-dn.syncCh
}
return nil
}

if dn.nodeState.GetGeneration() == latest && reflect.DeepEqual(dn.nodeState.Status.Interfaces, latestState.Status.Interfaces) {
if dn.useSystemdService {
serviceExist, err := dn.serviceManager.IsServiceExist(systemd.SriovServicePath)
if err != nil {
Expand Down Expand Up @@ -502,25 +522,6 @@ func (dn *Daemon) nodeStateSyncHandler() error {
return nil
}

if latestState.GetGeneration() == 1 && len(latestState.Spec.Interfaces) == 0 {
err = dn.storeManager.ClearPCIAddressFolder()
if err != nil {
glog.Errorf("failed to clear the PCI address configuration: %v", err)
return err
}

glog.V(0).Infof("nodeStateSyncHandler(): Name: %s, Interface policy spec not yet set by controller", latestState.Name)
if latestState.Status.SyncStatus != "Succeeded" {
dn.refreshCh <- Message{
syncStatus: "Succeeded",
lastSyncError: "",
}
// wait for writer to refresh status
<-dn.syncCh
}
return nil
}

dn.refreshCh <- Message{
syncStatus: syncStatusInProgress,
lastSyncError: "",
Expand Down

0 comments on commit d4716bf

Please sign in to comment.