Addressed more comments.
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
This commit is contained in:
parent
561534244a
commit
ad5286acd9
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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"`
|
||||
|
|
11
utils.go
11
utils.go
|
@ -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"],
|
||||
|
|
Loading…
Reference in New Issue