diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-03-02 12:35:34 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-03-02 19:20:26 +0000 |
commit | d1abdebdcdcabbe5f702a31a1958ed1235839db9 (patch) | |
tree | 8db6a249908807e4c19df0f424fdcd5d6169e919 | |
parent | cd670ff83978f27dd781696496d1328785329dbf (diff) | |
download | podman-d1abdebdcdcabbe5f702a31a1958ed1235839db9.tar.gz podman-d1abdebdcdcabbe5f702a31a1958ed1235839db9.tar.bz2 podman-d1abdebdcdcabbe5f702a31a1958ed1235839db9.zip |
Remove unused existing IP addresses function
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Closes: #440
Approved by: baude
-rw-r--r-- | libpod/container.go | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/libpod/container.go b/libpod/container.go index 0e57f7296..b6c3d1f40 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -663,7 +663,7 @@ func (c *Container) IPs() ([]net.IPNet, error) { } if !c.config.CreateNetNS { - return errors.Wrapf(ErrInvalidArg, "container %s network namespace is not managed by libpod") + return nil, errors.Wrapf(ErrInvalidArg, "container %s network namespace is not managed by libpod") } ips := make([]net.IPNet, 0, len(c.state.IPs)) @@ -688,12 +688,12 @@ func (c *Container) Routes() ([]types.Route, error) { } } - routes := make([]types.Route, 0, len(c.state.Routes)) - if !c.config.CreateNetNS { - return errors.Wrapf(ErrInvalidArg, "container %s network namespace is not managed by libpod") + return nil, errors.Wrapf(ErrInvalidArg, "container %s network namespace is not managed by libpod") } + routes := make([]types.Route, 0, len(c.state.Routes)) + for _, route := range c.state.Routes { newRoute := types.Route{ Dst: route.Dst, @@ -709,25 +709,6 @@ func (c *Container) Routes() ([]types.Route, error) { // Misc Accessors // Most will require locking -// IPAddress returns the IP address of the container -// If the container does not have a network namespace, an error will be returned -func (c *Container) IPAddress() (net.IP, error) { - if !c.locked { - c.lock.Lock() - defer c.lock.Unlock() - - if err := c.syncContainer(); err != nil { - return nil, errors.Wrapf(err, "error updating container %s state", c.ID()) - } - } - - if !c.config.CreateNetNS || c.state.NetNS == nil { - return nil, errors.Wrapf(ErrInvalidArg, "container %s does not have a network namespace", c.ID()) - } - - return c.runtime.getContainerIP(c) -} - // NamespacePath returns the path of one of the container's namespaces // If the container is not running, an error will be returned func (c *Container) NamespacePath(ns LinuxNS) (string, error) { |