Skip to content

Commit

Permalink
Remove 'old' argument from plugins OnNodeStateChange method
Browse files Browse the repository at this point in the history
'old' argument is not used in any existing plugin.

We can re-visit this change if some plugin requires it in the future.
  • Loading branch information
e0ne committed Jul 15, 2022
1 parent e3af669 commit ee3f3f4
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ func (dn *Daemon) nodeStateSyncHandler(generation int64) error {
reqDrain := false
for k, p := range dn.enabledPlugins {
d, r := false, false
d, r, err = p.OnNodeStateChange(dn.nodeState, latestState)
d, r, err = p.OnNodeStateChange(latestState)
if err != nil {
glog.Errorf("nodeStateSyncHandler(): plugin %s error: %v", k, err)
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/generic/generic_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (p *GenericPlugin) Spec() string {
}

// OnNodeStateChange Invoked when SriovNetworkNodeState CR is created or updated, return if need dain and/or reboot node
func (p *GenericPlugin) OnNodeStateChange(old, new *sriovnetworkv1.SriovNetworkNodeState) (needDrain bool, needReboot bool, err error) {
func (p *GenericPlugin) OnNodeStateChange(new *sriovnetworkv1.SriovNetworkNodeState) (needDrain bool, needReboot bool, err error) {
glog.Info("generic-plugin OnNodeStateChange()")
needDrain = false
needReboot = false
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/intel/intel_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (p *IntelPlugin) Spec() string {
}

// OnNodeStateChange Invoked when SriovNetworkNodeState CR is created or updated, return if need dain and/or reboot node
func (p *IntelPlugin) OnNodeStateChange(old, new *sriovnetworkv1.SriovNetworkNodeState) (needDrain bool, needReboot bool, err error) {
func (p *IntelPlugin) OnNodeStateChange(new *sriovnetworkv1.SriovNetworkNodeState) (needDrain bool, needReboot bool, err error) {
glog.Info("intel-plugin OnNodeStateChange()")
return false, false, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/k8s/k8s_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (p *K8sPlugin) Spec() string {
}

// OnNodeStateChange Invoked when SriovNetworkNodeState CR is created or updated, return if need dain and/or reboot node
func (p *K8sPlugin) OnNodeStateChange(old, new *sriovnetworkv1.SriovNetworkNodeState) (needDrain bool, needReboot bool, err error) {
func (p *K8sPlugin) OnNodeStateChange(new *sriovnetworkv1.SriovNetworkNodeState) (needDrain bool, needReboot bool, err error) {
glog.Info("k8s-plugin OnNodeStateChange()")
needDrain = false
needReboot = false
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/mellanox/mellanox_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (p *MellanoxPlugin) Spec() string {
}

// OnNodeStateChange Invoked when SriovNetworkNodeState CR is created or updated, return if need dain and/or reboot node
func (p *MellanoxPlugin) OnNodeStateChange(old, new *sriovnetworkv1.SriovNetworkNodeState) (needDrain bool, needReboot bool, err error) {
func (p *MellanoxPlugin) OnNodeStateChange(new *sriovnetworkv1.SriovNetworkNodeState) (needDrain bool, needReboot bool, err error) {
glog.Info("mellanox-Plugin OnNodeStateChange()")

needDrain = false
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugins/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type VendorPlugin interface {
// Return the SpecVersion followed by plugin
Spec() string
// Invoked when SriovNetworkNodeState CR is created or updated, return if need dain and/or reboot node
OnNodeStateChange(old, new *sriovnetworkv1.SriovNetworkNodeState) (bool, bool, error)
OnNodeStateChange(new *sriovnetworkv1.SriovNetworkNodeState) (bool, bool, error)
// Apply config change
Apply() error
}
2 changes: 1 addition & 1 deletion pkg/plugins/virtual/virtual_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (p *VirtualPlugin) Spec() string {
}

// OnNodeStateChange Invoked when SriovNetworkNodeState CR is created or updated, return if need dain and/or reboot node
func (p *VirtualPlugin) OnNodeStateChange(old, new *sriovnetworkv1.SriovNetworkNodeState) (needDrain bool, needReboot bool, err error) {
func (p *VirtualPlugin) OnNodeStateChange(new *sriovnetworkv1.SriovNetworkNodeState) (needDrain bool, needReboot bool, err error) {
glog.Info("virtual-plugin OnNodeStateChange()")
needDrain = false
needReboot = false
Expand Down

0 comments on commit ee3f3f4

Please sign in to comment.