summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-09-29 13:42:23 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-09-29 14:24:11 +0200
commitccff77025c4ef6907c91c42cf84e1c92b65716ba (patch)
tree0aa4e39b2fe46a23d02edc4b0fb461bf6e4d9f95 /libpod
parent5ea369adef6115702eb2d2e483d7c552d15a7c04 (diff)
downloadpodman-ccff77025c4ef6907c91c42cf84e1c92b65716ba.tar.gz
podman-ccff77025c4ef6907c91c42cf84e1c92b65716ba.tar.bz2
podman-ccff77025c4ef6907c91c42cf84e1c92b65716ba.zip
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>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/runtime_ctr.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 93bfdd54b..7cda9aa8b 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -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)