libpod: container create: init variable: do not deep copy spec

Do not create an expensive deep copy for the provided spec.Spec
when creating a container.  No API should be expected to create
deep copies of arguments unless explicitly documented.

This removes the last call to JSONDeepCopy in a simple
`podman run --rm -d busybox true`.

[NO TESTS NEEDED]

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
Valentin Rothberg 2021-09-29 13:42:23 +02:00
parent 5ea369adef
commit ccff77025c

View file

@ -193,10 +193,7 @@ func (r *Runtime) initContainerVariables(rSpec *spec.Spec, config *ContainerConf
ctr.config.LogPath = ""
}
ctr.config.Spec = new(spec.Spec)
if err := JSONDeepCopy(rSpec, ctr.config.Spec); err != nil {
return nil, errors.Wrapf(err, "error copying runtime spec while creating container")
}
ctr.config.Spec = rSpec
ctr.config.CreatedTime = time.Now()
ctr.state.BindMounts = make(map[string]string)