From 547c342c1b96f66f74533fdd648127098a922faa Mon Sep 17 00:00:00 2001 From: Jana Radhakrishnan Date: Mon, 22 Aug 2016 18:36:12 -0700 Subject: [PATCH] Add network attachment methods to cluster provider Signed-off-by: Jana Radhakrishnan --- libnetwork/cluster/provider.go | 9 +++++++++ libnetwork/cmd/dnet/dnet.go | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/libnetwork/cluster/provider.go b/libnetwork/cluster/provider.go index f8dc6f09b8..e2c34dce6a 100644 --- a/libnetwork/cluster/provider.go +++ b/libnetwork/cluster/provider.go @@ -1,5 +1,10 @@ package cluster +import ( + "github.com/docker/engine-api/types/network" + "golang.org/x/net/context" +) + // Provider provides clustering config details type Provider interface { IsManager() bool @@ -8,4 +13,8 @@ type Provider interface { GetAdvertiseAddress() string GetRemoteAddress() string ListenClusterEvents() <-chan struct{} + AttachNetwork(string, string, []string) (*network.NetworkingConfig, error) + DetachNetwork(string, string) error + UpdateAttachment(string, string, *network.NetworkingConfig) error + WaitForDetachment(context.Context, string, string, string) error } diff --git a/libnetwork/cmd/dnet/dnet.go b/libnetwork/cmd/dnet/dnet.go index a38d128886..044e066317 100644 --- a/libnetwork/cmd/dnet/dnet.go +++ b/libnetwork/cmd/dnet/dnet.go @@ -24,6 +24,7 @@ import ( "github.com/Sirupsen/logrus" "github.com/docker/docker/pkg/term" + "github.com/docker/engine-api/types/network" "github.com/docker/libnetwork" "github.com/docker/libnetwork/api" "github.com/docker/libnetwork/config" @@ -34,6 +35,7 @@ import ( "github.com/docker/libnetwork/options" "github.com/docker/libnetwork/types" "github.com/gorilla/mux" + "golang.org/x/net/context" ) const ( @@ -329,6 +331,22 @@ func (d *dnetConnection) ListenClusterEvents() <-chan struct{} { return d.configEvent } +func (d *dnetConnection) AttachNetwork(string, string, []string) (*network.NetworkingConfig, error) { + return nil, nil +} + +func (d *dnetConnection) DetachNetwork(string, string) error { + return nil +} + +func (d *dnetConnection) UpdateAttachment(string, string, *network.NetworkingConfig) error { + return nil +} + +func (d *dnetConnection) WaitForDetachment(context.Context, string, string, string) error { + return nil +} + func handleSignals(controller libnetwork.NetworkController) { c := make(chan os.Signal, 1) signals := []os.Signal{os.Interrupt, syscall.SIGTERM, syscall.SIGQUIT}