diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-11-26 19:56:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-26 19:56:49 +0100 |
commit | b29928f01598810328fa6b0cf91abb84670d8d01 (patch) | |
tree | 74b87bc339c0ac18cb4293c6361b82f17207132c /libpod/options.go | |
parent | 07c63583dd6c539f70184c4693b10399f367e3e3 (diff) | |
parent | 01ae532a899997cb4c930003d4f2f5d5820ba7d7 (diff) | |
download | podman-b29928f01598810328fa6b0cf91abb84670d8d01.tar.gz podman-b29928f01598810328fa6b0cf91abb84670d8d01.tar.bz2 podman-b29928f01598810328fa6b0cf91abb84670d8d01.zip |
Merge pull request #4542 from mheon/static_ip_single_net_allowed
Allow --ip and --mac to be set when joining a CNI net
Diffstat (limited to 'libpod/options.go')
-rw-r--r-- | libpod/options.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libpod/options.go b/libpod/options.go index bfbbb9e2d..f7f14eb26 100644 --- a/libpod/options.go +++ b/libpod/options.go @@ -1041,8 +1041,8 @@ func WithStaticIP(ip net.IP) CtrCreateOption { return errors.Wrapf(define.ErrInvalidArg, "cannot set a static IP if the container is not creating a network namespace") } - if len(ctr.config.Networks) != 0 { - return errors.Wrapf(define.ErrInvalidArg, "cannot set a static IP if joining additional CNI networks") + if len(ctr.config.Networks) > 1 { + return errors.Wrapf(define.ErrInvalidArg, "cannot set a static IP if joining more than 1 CNI network") } ctr.config.StaticIP = ip @@ -1066,8 +1066,8 @@ func WithStaticMAC(mac net.HardwareAddr) CtrCreateOption { return errors.Wrapf(define.ErrInvalidArg, "cannot set a static MAC if the container is not creating a network namespace") } - if len(ctr.config.Networks) != 0 { - return errors.Wrapf(define.ErrInvalidArg, "cannot set a static MAC if joining additional CNI networks") + if len(ctr.config.Networks) > 1 { + return errors.Wrapf(define.ErrInvalidArg, "cannot set a static MAC if joining more than 1 CNI network") } ctr.config.StaticMAC = mac |