From f7951c8776cea5eeddd8838ac6a4f41f518032fd Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Fri, 12 Apr 2019 10:21:45 -0400 Subject: Use GetContainer instead of LookupContainer for full ID All IDs in libpod are stored as a full container ID. We can get a container by full ID faster with GetContainer (which directly retrieves) than LookupContainer (which finds a match, then retrieves). No reason to use Lookup when we have full IDs present and available. Signed-off-by: Matthew Heon --- libpod/container.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libpod/container.go') diff --git a/libpod/container.go b/libpod/container.go index de4674222..4bf9a1ba9 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -614,7 +614,7 @@ func (c *Container) NewNetNS() bool { func (c *Container) PortMappings() ([]ocicni.PortMapping, error) { // First check if the container belongs to a network namespace (like a pod) if len(c.config.NetNsCtr) > 0 { - netNsCtr, err := c.runtime.LookupContainer(c.config.NetNsCtr) + netNsCtr, err := c.runtime.GetContainer(c.config.NetNsCtr) if err != nil { return nil, errors.Wrapf(err, "unable to lookup network namespace for container %s", c.ID()) } -- cgit v1.2.3-54-g00ecf