Addressed more comments.

Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
This commit is contained in:
Vishnu Kannan 2014-06-23 20:40:37 +00:00
parent 561534244a
commit ad5286acd9
5 changed files with 8 additions and 16 deletions

View File

@ -6,10 +6,9 @@ import (
"github.com/docker/libcontainer/mount"
)
// Reusing internal Mount struct since we don't expect the API and the internal representation to differ much in the future.
type Mount mount.Mount
type Mounts []Mount
type Mounts mount.Mounts
type Network struct {
// Type sets the networks type, commonly veth and loopback

View File

@ -157,7 +157,7 @@ func InitializeNetworking(container *libcontainer.Container, nspid int, pipe *Sy
if err != nil {
return err
}
if err := strategy.Create(libcontainer.GetInternalNetworkSpec(config), nspid, context); err != nil {
if err := strategy.Create(libcontainer.GetInternalNetworkConfig(config), nspid, context); err != nil {
return err
}
}

View File

@ -166,7 +166,7 @@ func setupNetwork(container *libcontainer.Container, context map[string]string)
return err
}
err1 := strategy.Initialize(libcontainer.GetInternalNetworkSpec(config), context)
err1 := strategy.Initialize(libcontainer.GetInternalNetworkConfig(config), context)
if err1 != nil {
return err1
}

View File

@ -9,13 +9,13 @@ type Network struct {
Type string `json:"type,omitempty"`
// Path to network namespace
NsPath string
NsPath string `json:"ns_path,omitempty"`
// The bridge to use.
Bridge string
Bridge string `json:"bridge,omitempty"`
// Prefix for the veth interfaces.
VethPrefix string
VethPrefix string `json:"type,omitempty"`
// Address contains the IP and mask to set on the network interface
Address string `json:"address,omitempty"`

View File

@ -12,19 +12,12 @@ func GetInternalMountConfig(container *Container) *mount.MountConfig {
ReadonlyFs: container.ReadonlyFs,
DeviceNodes: container.DeviceNodes,
MountLabel: container.Context["mount_label"],
}
for _, mountFromSpec := range container.Mounts {
out.Mounts = append(out.Mounts, mount.Mount{
Type: mountFromSpec.Type,
Source: mountFromSpec.Source,
Destination: mountFromSpec.Destination,
Writable: mountFromSpec.Writable,
Private: mountFromSpec.Private})
Mounts: (mount.Mounts)(container.Mounts),
}
return out
}
func GetInternalNetworkSpec(net *Network) *network.Network {
func GetInternalNetworkConfig(net *Network) *network.Network {
return &network.Network{
Type: net.Type,
NsPath: net.Context["nspath"],