Skip to content

Commit

Permalink
Merge pull request #610 from zeeke/openstack-panic-fix
Browse files Browse the repository at this point in the history
openstack: Fix `nil` HostManager in `openstackContext`
  • Loading branch information
adrianchiris authored Feb 8, 2024
2 parents a7d40a7 + 1c76c13 commit f8405cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pkg/platforms/openstack/openstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions pkg/platforms/platforms.go
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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,
Expand Down

0 comments on commit f8405cf

Please sign in to comment.