mirror of
https://github.com/containers/podman.git
synced 2025-05-28 21:46:51 +08:00
Avoid unnecessary calls to Container.Spec()
This call does a deep copy, which is only needed if you want to modify the return value. Instead we use ctr.ConfigNoCopy().Spec which is just a pointer dereference. [NO NEW TESTS NEEDED] Just minor performance effects Signed-off-by: Alexander Larsson <alexl@redhat.com>
This commit is contained in:
@ -474,7 +474,7 @@ func ConfigToSpec(rt *libpod.Runtime, specg *specgen.SpecGenerator, contaierID s
|
||||
}
|
||||
}
|
||||
specg.OverlayVolumes = overlay
|
||||
_, mounts := c.SortUserVolumes(c.Spec())
|
||||
_, mounts := c.SortUserVolumes(c.ConfigNoCopy().Spec)
|
||||
specg.Mounts = mounts
|
||||
specg.HostDeviceList = conf.DeviceHostSrc
|
||||
specg.Networks = conf.Networks
|
||||
|
@ -288,7 +288,7 @@ func getVolumesFrom(volumesFrom []string, runtime *libpod.Runtime) (map[string]s
|
||||
|
||||
// Now we get the container's spec and loop through its volumes
|
||||
// and append them in if we can find them.
|
||||
spec := ctr.Spec()
|
||||
spec := ctr.ConfigNoCopy().Spec
|
||||
if spec == nil {
|
||||
return nil, nil, fmt.Errorf("retrieving container %s spec for volumes-from", ctr.ID())
|
||||
}
|
||||
|
Reference in New Issue
Block a user