Separate API router from server.

Implement basic interfaces to write custom routers that can be plugged
to the server. Remove server coupling with the daemon.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: da982cf5511814b6897244ecaa9c016f8800340a
Component: engine
This commit is contained in:
David Calavera
2015-09-29 19:43:03 -04:00
parent e5db2c0e2f
commit 1fb74bb17c
32 changed files with 809 additions and 591 deletions
+5
View File
@@ -1131,6 +1131,11 @@ func (daemon *Daemon) verifyContainerSettings(hostConfig *runconfig.HostConfig,
return verifyPlatformContainerSettings(daemon, hostConfig, config)
}
// NetworkController exposes the libnetwork interface to manage networks.
func (daemon *Daemon) NetworkController() libnetwork.NetworkController {
return daemon.netController
}
func configureVolumes(config *Config) (*store.VolumeStore, error) {
volumesDriver, err := local.New(config.Root)
if err != nil {
-8
View File
@@ -5,7 +5,6 @@ package daemon
import (
"fmt"
"net"
"net/http"
"os"
"path/filepath"
"strings"
@@ -22,7 +21,6 @@ import (
"github.com/docker/docker/runconfig"
"github.com/docker/docker/utils"
"github.com/docker/libnetwork"
nwapi "github.com/docker/libnetwork/api"
nwconfig "github.com/docker/libnetwork/config"
"github.com/docker/libnetwork/netlabel"
"github.com/docker/libnetwork/options"
@@ -489,12 +487,6 @@ func setupInitLayer(initLayer string) error {
return nil
}
// NetworkAPIRouter implements a feature for server-experimental,
// directly calling into libnetwork.
func (daemon *Daemon) NetworkAPIRouter() func(w http.ResponseWriter, req *http.Request) {
return nwapi.NewHTTPHandler(daemon.netController)
}
// registerLinks writes the links to a file.
func (daemon *Daemon) registerLinks(container *Container, hostConfig *runconfig.HostConfig) error {
if hostConfig == nil || hostConfig.Links == nil {