diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-01-13 18:06:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-13 18:06:54 +0100 |
commit | eeb76db0fd0dc2a1115c2f2ad12c82eadbc62509 (patch) | |
tree | 4666b0a66a98bd3f29586b3d3ac2c3028bd7443a /libpod/network/internal/util/create.go | |
parent | ab7228b3c27719e447de4dffe9b3fd7f67d6f346 (diff) | |
parent | ece768ff9e7d2b0166c0b1850467a489556b93fc (diff) | |
download | podman-eeb76db0fd0dc2a1115c2f2ad12c82eadbc62509.tar.gz podman-eeb76db0fd0dc2a1115c2f2ad12c82eadbc62509.tar.bz2 podman-eeb76db0fd0dc2a1115c2f2ad12c82eadbc62509.zip |
Merge pull request #12642 from Luap99/libnetwork
use libnetwork from c/common
Diffstat (limited to 'libpod/network/internal/util/create.go')
-rw-r--r-- | libpod/network/internal/util/create.go | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/libpod/network/internal/util/create.go b/libpod/network/internal/util/create.go deleted file mode 100644 index cecfd7133..000000000 --- a/libpod/network/internal/util/create.go +++ /dev/null @@ -1,42 +0,0 @@ -package util - -import ( - "github.com/containers/podman/v3/libpod/define" - "github.com/containers/podman/v3/libpod/network/types" - "github.com/pkg/errors" -) - -func CommonNetworkCreate(n NetUtil, network *types.Network) error { - if network.Labels == nil { - network.Labels = map[string]string{} - } - if network.Options == nil { - network.Options = map[string]string{} - } - if network.IPAMOptions == nil { - network.IPAMOptions = map[string]string{} - } - - var name string - var err error - // validate the name when given - if network.Name != "" { - if !define.NameRegex.MatchString(network.Name) { - return errors.Wrapf(define.RegexError, "network name %s invalid", network.Name) - } - if _, err := n.Network(network.Name); err == nil { - return errors.Wrapf(define.ErrNetworkExists, "network name %s already used", network.Name) - } - } else { - name, err = GetFreeDeviceName(n) - if err != nil { - return err - } - network.Name = name - // also use the name as interface name when we create a bridge network - if network.Driver == types.BridgeNetworkDriver && network.NetworkInterface == "" { - network.NetworkInterface = name - } - } - return nil -} |