diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-12-15 15:25:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 15:25:14 +0100 |
commit | 7dabcbd7bcf78f3b5d310ed547801106da382618 (patch) | |
tree | 7b92c3ca37025a833a0d9651afeb19ba7c903cc8 /libpod/container_internal.go | |
parent | b01a421f3413ba01b2c189b82c8153bdbd2a05fb (diff) | |
parent | ef325bc8c4824537e4bfb21aa7e6114a6e5a8c09 (diff) | |
download | podman-7dabcbd7bcf78f3b5d310ed547801106da382618.tar.gz podman-7dabcbd7bcf78f3b5d310ed547801106da382618.tar.bz2 podman-7dabcbd7bcf78f3b5d310ed547801106da382618.zip |
Merge pull request #12534 from Luap99/network-db
network db rewrite
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r-- | libpod/container_internal.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index d8187c609..a68de3173 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -2206,6 +2206,24 @@ func (c *Container) canWithPrevious() error { // prepareCheckpointExport writes the config and spec to // JSON files for later export func (c *Container) prepareCheckpointExport() error { + networks, err := c.networks() + if err != nil { + return err + } + // make sure to exclude the short ID alias since the container gets a new ID on restore + for net, opts := range networks { + newAliases := make([]string, 0, len(opts.Aliases)) + for _, alias := range opts.Aliases { + if alias != c.config.ID[:12] { + newAliases = append(newAliases, alias) + } + } + opts.Aliases = newAliases + networks[net] = opts + } + + // add the networks from the db to the config so that the exported checkpoint still stores all current networks + c.config.Networks = networks // save live config if _, err := metadata.WriteJSONFile(c.config, c.bundlePath(), metadata.ConfigDumpFile); err != nil { return err |