1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Docker: Network manager integration

This commit is contained in:
Andrea Luzzardi 2013-02-28 11:52:07 -08:00
parent 09eacdfade
commit bd2f51290f

View file

@ -11,10 +11,10 @@ import (
)
type Docker struct {
root string
repository string
containers *list.List
networkAllocator *NetworkAllocator
root string
repository string
containers *list.List
networkManager *NetworkManager
}
func (docker *Docker) List() []*Container {
@ -52,7 +52,7 @@ func (docker *Docker) Create(id string, command string, args []string, layers []
return nil, fmt.Errorf("Container %v already exists", id)
}
root := path.Join(docker.repository, id)
container, err := createContainer(id, root, command, args, layers, config, docker.networkAllocator)
container, err := createContainer(id, root, command, args, layers, config, docker.networkManager)
if err != nil {
return nil, err
}
@ -87,7 +87,7 @@ func (docker *Docker) restore() error {
return err
}
for _, v := range dir {
container, err := loadContainer(path.Join(docker.repository, v.Name()), docker.networkAllocator)
container, err := loadContainer(path.Join(docker.repository, v.Name()), docker.networkManager)
if err != nil {
log.Printf("Failed to load container %v: %v", v.Name(), err)
continue
@ -102,15 +102,15 @@ func New() (*Docker, error) {
}
func NewFromDirectory(root string) (*Docker, error) {
alloc, err := newNetworkAllocator(networkBridgeIface)
netManager, err := newNetworkManager(networkBridgeIface)
if err != nil {
return nil, err
}
docker := &Docker{
root: root,
repository: path.Join(root, "containers"),
containers: list.New(),
networkAllocator: alloc,
root: root,
repository: path.Join(root, "containers"),
containers: list.New(),
networkManager: netManager,
}
if err := os.MkdirAll(docker.repository, 0700); err != nil && !os.IsExist(err) {