diff options
author | baude <bbaude@redhat.com> | 2020-11-11 09:45:07 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2020-11-19 08:16:19 -0600 |
commit | a3e0b7d117251944375fd32449f6b26d65edf367 (patch) | |
tree | 824e4acb1529fb72276630fdd4d57127c07aadc8 /pkg/domain/infra | |
parent | 286d356db03a2511722155022c19855f8aee73cf (diff) | |
download | podman-a3e0b7d117251944375fd32449f6b26d65edf367.tar.gz podman-a3e0b7d117251944375fd32449f6b26d65edf367.tar.bz2 podman-a3e0b7d117251944375fd32449f6b26d65edf367.zip |
add network connect|disconnect compat endpoints
this enables the ability to connect and disconnect a container from a
given network. it is only for the compatibility layer. some code had to
be refactored to avoid circular imports.
additionally, tests are being deferred temporarily due to some
incompatibility/bug in either docker-py or our stack.
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/domain/infra')
-rw-r--r-- | pkg/domain/infra/abi/network.go | 9 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/network.go | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/network.go b/pkg/domain/infra/abi/network.go index 06941f8d0..25ea151e7 100644 --- a/pkg/domain/infra/abi/network.go +++ b/pkg/domain/infra/abi/network.go @@ -138,3 +138,12 @@ func ifPassesFilterTest(netconf *libcni.NetworkConfigList, filter []string) bool } return result } + +// NetworkDisconnect removes a container from a given network +func (ic *ContainerEngine) NetworkDisconnect(ctx context.Context, networkname string, options entities.NetworkDisconnectOptions) error { + return ic.Libpod.DisconnectContainerFromNetwork(options.Container, networkname, options.Force) +} + +func (ic *ContainerEngine) NetworkConnect(ctx context.Context, networkname string, options entities.NetworkConnectOptions) error { + return ic.Libpod.ConnectContainerToNetwork(options.Container, networkname, options.Aliases) +} diff --git a/pkg/domain/infra/tunnel/network.go b/pkg/domain/infra/tunnel/network.go index 15527e02c..10ae03045 100644 --- a/pkg/domain/infra/tunnel/network.go +++ b/pkg/domain/infra/tunnel/network.go @@ -55,3 +55,13 @@ func (ic *ContainerEngine) NetworkRm(ctx context.Context, namesOrIds []string, o func (ic *ContainerEngine) NetworkCreate(ctx context.Context, name string, options entities.NetworkCreateOptions) (*entities.NetworkCreateReport, error) { return network.Create(ic.ClientCxt, options, &name) } + +// NetworkDisconnect removes a container from a given network +func (ic *ContainerEngine) NetworkDisconnect(ctx context.Context, networkname string, options entities.NetworkDisconnectOptions) error { + return network.Disconnect(ic.ClientCxt, networkname, options) +} + +// NetworkConnect removes a container from a given network +func (ic *ContainerEngine) NetworkConnect(ctx context.Context, networkname string, options entities.NetworkConnectOptions) error { + return network.Connect(ic.ClientCxt, networkname, options) +} |