diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-05-15 07:39:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-15 07:39:35 -0700 |
commit | d5358e676486bf894eadffd0b55c7e5d6a35867b (patch) | |
tree | 2fc9a8895354efbd118b3a02d6e8b362726046f2 /pkg/network/network.go | |
parent | a88cd9a22e5440532519f8ce6746738464f499e5 (diff) | |
parent | 48d83482db11d1ea3432520035cc457dc659c9a9 (diff) | |
download | podman-d5358e676486bf894eadffd0b55c7e5d6a35867b.tar.gz podman-d5358e676486bf894eadffd0b55c7e5d6a35867b.tar.bz2 podman-d5358e676486bf894eadffd0b55c7e5d6a35867b.zip |
Merge pull request #6215 from maxm123/master
Use the containers.conf cni_config_dir option for inspect and delete
Diffstat (limited to 'pkg/network/network.go')
-rw-r--r-- | pkg/network/network.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/pkg/network/network.go b/pkg/network/network.go index bb6f13579..5e9062019 100644 --- a/pkg/network/network.go +++ b/pkg/network/network.go @@ -7,6 +7,7 @@ import ( "github.com/containernetworking/cni/pkg/types" "github.com/containernetworking/plugins/plugins/ipam/host-local/backend/allocator" + "github.com/containers/common/pkg/config" "github.com/containers/libpod/pkg/util" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -56,8 +57,8 @@ func GetLiveNetworkNames() ([]string, error) { // GetFreeNetwork looks for a free network according to existing cni configuration // files and network interfaces. -func GetFreeNetwork() (*net.IPNet, error) { - networks, err := GetNetworksFromFilesystem() +func GetFreeNetwork(config *config.Config) (*net.IPNet, error) { + networks, err := GetNetworksFromFilesystem(config) if err != nil { return nil, err } @@ -131,8 +132,8 @@ func networkIntersect(n1, n2 *net.IPNet) bool { // ValidateUserNetworkIsAvailable returns via an error if a network is available // to be used -func ValidateUserNetworkIsAvailable(userNet *net.IPNet) error { - networks, err := GetNetworksFromFilesystem() +func ValidateUserNetworkIsAvailable(config *config.Config, userNet *net.IPNet) error { + networks, err := GetNetworksFromFilesystem(config) if err != nil { return err } @@ -153,8 +154,8 @@ func ValidateUserNetworkIsAvailable(userNet *net.IPNet) error { // RemoveNetwork removes a given network by name. If the network has container associated with it, that // must be handled outside the context of this. -func RemoveNetwork(name string) error { - cniPath, err := GetCNIConfigPathByName(name) +func RemoveNetwork(config *config.Config, name string) error { + cniPath, err := GetCNIConfigPathByName(config, name) if err != nil { return err } @@ -181,8 +182,8 @@ func RemoveNetwork(name string) error { } // InspectNetwork reads a CNI config and returns its configuration -func InspectNetwork(name string) (map[string]interface{}, error) { - b, err := ReadRawCNIConfByName(name) +func InspectNetwork(config *config.Config, name string) (map[string]interface{}, error) { + b, err := ReadRawCNIConfByName(config, name) if err != nil { return nil, err } |