From 1c76c13cbec12f0f89f5f5a59c21cf1d211715b0 Mon Sep 17 00:00:00 2001 From: Andrea Panattoni Date: Thu, 1 Feb 2024 18:58:03 +0100 Subject: [PATCH] openstack: Fix `nil` HostManager in `openstackContext` Refactoring in [1] left the openstackContext uninitialized. [1] https://github.com/k8snetworkplumbingwg/sriov-network-operator/pull/553 Signed-off-by: Andrea Panattoni --- pkg/platforms/openstack/openstack.go | 6 ++++-- pkg/platforms/platforms.go | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pkg/platforms/openstack/openstack.go b/pkg/platforms/openstack/openstack.go index b86e079ca..cc975dbe5 100644 --- a/pkg/platforms/openstack/openstack.go +++ b/pkg/platforms/openstack/openstack.go @@ -102,8 +102,10 @@ type OSPDeviceInfo struct { NetworkID string } -func New() OpenstackInterface { - return &openstackContext{} +func New(hostManager host.HostManagerInterface) OpenstackInterface { + return &openstackContext{ + hostManager: hostManager, + } } // GetOpenstackData gets the metadata and network_data diff --git a/pkg/platforms/platforms.go b/pkg/platforms/platforms.go index 529f51821..19c74cef3 100644 --- a/pkg/platforms/platforms.go +++ b/pkg/platforms/platforms.go @@ -1,8 +1,10 @@ package platforms import ( + "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/host" "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/platforms/openshift" "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/platforms/openstack" + "github.com/k8snetworkplumbingwg/sriov-network-operator/pkg/utils" ) //go:generate ../../bin/mockgen -destination mock/mock_platforms.go -source platforms.go @@ -21,8 +23,9 @@ func NewDefaultPlatformHelper() (Interface, error) { if err != nil { return nil, err } - - openstackContext := openstack.New() + utilsHelper := utils.New() + hostManager := host.NewHostManager(utilsHelper) + openstackContext := openstack.New(hostManager) return &platformHelper{ openshiftContext,