summaryrefslogtreecommitdiff
path: root/libpod/state.go
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-12-07 19:04:13 +0100
committerPaul Holzinger <pholzing@redhat.com>2021-12-14 15:23:20 +0100
commit5490be67b3620c7a13319f4a18519ab691c20bef (patch)
tree071a9092015e247ba8fe230946e4aebb16f3abf2 /libpod/state.go
parent4a060caeabc7061b85a290ba31f87af7d4dbf508 (diff)
downloadpodman-5490be67b3620c7a13319f4a18519ab691c20bef.tar.gz
podman-5490be67b3620c7a13319f4a18519ab691c20bef.tar.bz2
podman-5490be67b3620c7a13319f4a18519ab691c20bef.zip
network db rewrite: migrate existing settings
The new network db structure stores everything in the networks bucket. Previously some network settings were not written the the network bucket and only stored in the container config. Instead of the old format which used the container ID as value in the networks buckets we now use the PerNetworkoptions struct there. To migrate existing users we use the state.GetNetworks() function. If it fails to read the new format it will automatically migrate the old config format to the new one. This is allows a flawless migration path. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'libpod/state.go')
-rw-r--r--libpod/state.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/libpod/state.go b/libpod/state.go
index 4b711bae9..fe7b86fdb 100644
--- a/libpod/state.go
+++ b/libpod/state.go
@@ -1,5 +1,7 @@
package libpod
+import "github.com/containers/podman/v3/libpod/network/types"
+
// State is a storage backend for libpod's current state.
// A State is only initialized once per instance of libpod.
// As such, initialization methods for State implementations may safely assume
@@ -99,14 +101,14 @@ type State interface {
AllContainers() ([]*Container, error)
// Get networks the container is currently connected to.
- GetNetworks(ctr *Container) ([]string, error)
+ GetNetworks(ctr *Container) (map[string]types.PerNetworkOptions, error)
// Get network aliases for the given container in the given network.
GetNetworkAliases(ctr *Container, network string) ([]string, error)
// Get all network aliases for the given container.
GetAllNetworkAliases(ctr *Container) (map[string][]string, error)
// Add the container to the given network, adding the given aliases
// (if present).
- NetworkConnect(ctr *Container, network string, aliases []string) error
+ NetworkConnect(ctr *Container, network string, opts types.PerNetworkOptions) error
// Remove the container from the given network, removing all aliases for
// the container in that network in the process.
NetworkDisconnect(ctr *Container, network string) error