Skip to content

Commit

Permalink
Add Drivers method to the Network Interface
Browse files Browse the repository at this point in the history
Drivers should return the list of supported network drivers by this
plugin. This is useful for podman info.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
  • Loading branch information
Luap99 committed Sep 15, 2021
1 parent 1bcd006 commit 5e83094
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 1 addition & 3 deletions libpod/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/containers/image/v5/pkg/sysregistriesv2"
"github.com/containers/podman/v3/libpod/define"
"github.com/containers/podman/v3/libpod/linkmode"
"github.com/containers/podman/v3/libpod/network/types"
"github.com/containers/podman/v3/pkg/cgroups"
"github.com/containers/podman/v3/pkg/rootless"
"github.com/containers/storage"
Expand Down Expand Up @@ -73,8 +72,7 @@ func (r *Runtime) info() (*define.Info, error) {
volumePlugins = append(volumePlugins, plugin)
}
info.Plugins.Volume = volumePlugins
// TODO move this into the new network interface
info.Plugins.Network = []string{types.BridgeNetworkDriver, types.MacVLANNetworkDriver}
info.Plugins.Network = r.network.Drivers()
info.Plugins.Log = logDrivers

info.Registries = registries
Expand Down
6 changes: 6 additions & 0 deletions libpod/network/cni/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ func NewCNINetworkInterface(conf InitConfig) (types.ContainerNetwork, error) {
return n, nil
}

// Drivers will return the list of supported network drivers
// for this interface.
func (n *cniNetwork) Drivers() []string {
return []string{types.BridgeNetworkDriver, types.MacVLANNetworkDriver}
}

func (n *cniNetwork) loadNetworks() error {
// skip loading networks if they are already loaded
if n.networks != nil {
Expand Down
4 changes: 4 additions & 0 deletions libpod/network/types/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ type ContainerNetwork interface {
Setup(namespacePath string, options SetupOptions) (map[string]StatusBlock, error)
// Teardown will teardown the container network namespace.
Teardown(namespacePath string, options TeardownOptions) error

// Drivers will return the list of supported network drivers
// for this interface.
Drivers() []string
}

// Network describes the Network attributes.
Expand Down

0 comments on commit 5e83094

Please sign in to comment.