diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-11-06 10:39:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-06 10:39:16 +0100 |
commit | abbd6c167e8163a711680db80137a0731e06e564 (patch) | |
tree | c11c98dc0eeac187c62b74443ba98c5dcb0961f0 /libpod/boltdb_state_internal.go | |
parent | 6805befec2ca9b9a816b1efda0bf43a67cee09a7 (diff) | |
parent | 0136a66a83d027049da6338f8ce6dfa8052c8ca3 (diff) | |
download | podman-abbd6c167e8163a711680db80137a0731e06e564.tar.gz podman-abbd6c167e8163a711680db80137a0731e06e564.tar.bz2 podman-abbd6c167e8163a711680db80137a0731e06e564.zip |
Merge pull request #11890 from Luap99/ports
libpod: deduplicate ports in db
Diffstat (limited to 'libpod/boltdb_state_internal.go')
-rw-r--r-- | libpod/boltdb_state_internal.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libpod/boltdb_state_internal.go b/libpod/boltdb_state_internal.go index 3e3c17a9e..e71d82736 100644 --- a/libpod/boltdb_state_internal.go +++ b/libpod/boltdb_state_internal.go @@ -384,6 +384,15 @@ func (s *BoltState) getContainerConfigFromDB(id []byte, config *ContainerConfig, return errors.Wrapf(err, "error unmarshalling container %s config", string(id)) } + // convert ports to the new format if needed + if len(config.ContainerNetworkConfig.OldPortMappings) > 0 && len(config.ContainerNetworkConfig.PortMappings) == 0 { + config.ContainerNetworkConfig.PortMappings = ocicniPortsToNetTypesPorts(config.ContainerNetworkConfig.OldPortMappings) + // keep the OldPortMappings in case an user has to downgrade podman + + // indicate the the config was modified and should be written back to the db when possible + config.rewrite = true + } + return nil } |