diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-05-03 16:37:54 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-03 16:37:54 -0400 |
commit | 3210a3f4257d19744abd4ae2302018b16edb2507 (patch) | |
tree | 97f6f9e2c4bfd41191971c5658484012ce1b4826 /libpod/boltdb_state_internal.go | |
parent | 3af1396f269463aa7640e9cf1dcc84a413d99ee0 (diff) | |
parent | 3ab8fa679c57a653f7ea012f79fa453ae8133108 (diff) | |
download | podman-3210a3f4257d19744abd4ae2302018b16edb2507.tar.gz podman-3210a3f4257d19744abd4ae2302018b16edb2507.tar.bz2 podman-3210a3f4257d19744abd4ae2302018b16edb2507.zip |
Merge pull request #14100 from mheon/incremental_backports
[v4.1] Incremental backports
Diffstat (limited to 'libpod/boltdb_state_internal.go')
-rw-r--r-- | libpod/boltdb_state_internal.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libpod/boltdb_state_internal.go b/libpod/boltdb_state_internal.go index e43226490..d6f035af9 100644 --- a/libpod/boltdb_state_internal.go +++ b/libpod/boltdb_state_internal.go @@ -542,8 +542,12 @@ func (s *BoltState) addContainer(ctr *Container, pod *Pod) error { ctr.ID(), s.namespace, ctr.config.Namespace) } + // Set the original networks to nil. We can save some space by not storing it in the config + // since we store it in a different mutable bucket anyway. + configNetworks := ctr.config.Networks + ctr.config.Networks = nil + // JSON container structs to insert into DB - // TODO use a higher-performance struct encoding than JSON configJSON, err := json.Marshal(ctr.config) if err != nil { return errors.Wrapf(err, "error marshalling container %s config to JSON", ctr.ID()) @@ -564,8 +568,8 @@ func (s *BoltState) addContainer(ctr *Container, pod *Pod) error { } // make sure to marshal the network options before we get the db lock - networks := make(map[string][]byte, len(ctr.config.Networks)) - for net, opts := range ctr.config.Networks { + networks := make(map[string][]byte, len(configNetworks)) + for net, opts := range configNetworks { // Check that we don't have any empty network names if net == "" { return errors.Wrapf(define.ErrInvalidArg, "network names cannot be an empty string") @@ -581,9 +585,6 @@ func (s *BoltState) addContainer(ctr *Container, pod *Pod) error { } networks[net] = optBytes } - // Set the original value to nil. We can safe some space by not storing it in the config - // since we store it in a different mutable bucket anyway. - ctr.config.Networks = nil db, err := s.getDBCon() if err != nil { |