From ee3f3f4c853d211d00aa4af557d1f855b0935952 Mon Sep 17 00:00:00 2001 From: Ivan Kolodyazhny Date: Fri, 15 Jul 2022 15:56:50 +0300 Subject: [PATCH] Remove 'old' argument from plugins OnNodeStateChange method 'old' argument is not used in any existing plugin. We can re-visit this change if some plugin requires it in the future. --- pkg/daemon/daemon.go | 2 +- pkg/plugins/generic/generic_plugin.go | 2 +- pkg/plugins/intel/intel_plugin.go | 2 +- pkg/plugins/k8s/k8s_plugin.go | 2 +- pkg/plugins/mellanox/mellanox_plugin.go | 2 +- pkg/plugins/plugin.go | 2 +- pkg/plugins/virtual/virtual_plugin.go | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go index ddca64c124..0c017b8b55 100644 --- a/pkg/daemon/daemon.go +++ b/pkg/daemon/daemon.go @@ -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 diff --git a/pkg/plugins/generic/generic_plugin.go b/pkg/plugins/generic/generic_plugin.go index 9f7a928ccf..3443ff6ddb 100644 --- a/pkg/plugins/generic/generic_plugin.go +++ b/pkg/plugins/generic/generic_plugin.go @@ -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 diff --git a/pkg/plugins/intel/intel_plugin.go b/pkg/plugins/intel/intel_plugin.go index 1a1c77136d..36fd5d02ce 100644 --- a/pkg/plugins/intel/intel_plugin.go +++ b/pkg/plugins/intel/intel_plugin.go @@ -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 } diff --git a/pkg/plugins/k8s/k8s_plugin.go b/pkg/plugins/k8s/k8s_plugin.go index ad30310420..948e51a5e8 100644 --- a/pkg/plugins/k8s/k8s_plugin.go +++ b/pkg/plugins/k8s/k8s_plugin.go @@ -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 diff --git a/pkg/plugins/mellanox/mellanox_plugin.go b/pkg/plugins/mellanox/mellanox_plugin.go index 97b2515abe..cd2e2f0106 100644 --- a/pkg/plugins/mellanox/mellanox_plugin.go +++ b/pkg/plugins/mellanox/mellanox_plugin.go @@ -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 diff --git a/pkg/plugins/plugin.go b/pkg/plugins/plugin.go index 5769ee3e99..1723ca6109 100644 --- a/pkg/plugins/plugin.go +++ b/pkg/plugins/plugin.go @@ -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 } diff --git a/pkg/plugins/virtual/virtual_plugin.go b/pkg/plugins/virtual/virtual_plugin.go index 10789df6bb..673c7d07b2 100644 --- a/pkg/plugins/virtual/virtual_plugin.go +++ b/pkg/plugins/virtual/virtual_plugin.go @@ -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