mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
- Changed ContainerConfiguration to simply use strings
- Made ContainerConfiguration fields to be exported so options package can access them. Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
This commit is contained in:
parent
716a41551e
commit
3b8b2ffee8
2 changed files with 12 additions and 13 deletions
|
@ -54,8 +54,8 @@ type EndpointConfiguration struct {
|
||||||
|
|
||||||
// ContainerConfiguration represents the user specified configuration for a container
|
// ContainerConfiguration represents the user specified configuration for a container
|
||||||
type ContainerConfiguration struct {
|
type ContainerConfiguration struct {
|
||||||
parentEndpoints []types.UUID
|
ParentEndpoints []string
|
||||||
childEndpoints []types.UUID
|
ChildEndpoints []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type bridgeEndpoint struct {
|
type bridgeEndpoint struct {
|
||||||
|
@ -664,14 +664,14 @@ func (d *driver) link(nid, eid types.UUID, options map[string]interface{}, enabl
|
||||||
}
|
}
|
||||||
|
|
||||||
if endpoint.config != nil && endpoint.config.PortBindings != nil {
|
if endpoint.config != nil && endpoint.config.PortBindings != nil {
|
||||||
for _, p := range cc.parentEndpoints {
|
for _, p := range cc.ParentEndpoints {
|
||||||
var parentEndpoint *bridgeEndpoint
|
var parentEndpoint *bridgeEndpoint
|
||||||
parentEndpoint, err = network.getEndpoint(p)
|
parentEndpoint, err = network.getEndpoint(types.UUID(p))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if parentEndpoint == nil {
|
if parentEndpoint == nil {
|
||||||
err = InvalidEndpointIDError(string(p))
|
err = InvalidEndpointIDError(p)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,14 +694,14 @@ func (d *driver) link(nid, eid types.UUID, options map[string]interface{}, enabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, c := range cc.childEndpoints {
|
for _, c := range cc.ChildEndpoints {
|
||||||
var childEndpoint *bridgeEndpoint
|
var childEndpoint *bridgeEndpoint
|
||||||
childEndpoint, err = network.getEndpoint(c)
|
childEndpoint, err = network.getEndpoint(types.UUID(c))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if childEndpoint == nil {
|
if childEndpoint == nil {
|
||||||
err = InvalidEndpointIDError(string(c))
|
err = InvalidEndpointIDError(c)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if childEndpoint.config == nil || childEndpoint.config.PortBindings == nil {
|
if childEndpoint.config == nil || childEndpoint.config.PortBindings == nil {
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"github.com/docker/docker/pkg/iptables"
|
"github.com/docker/docker/pkg/iptables"
|
||||||
"github.com/docker/libnetwork/netutils"
|
"github.com/docker/libnetwork/netutils"
|
||||||
"github.com/docker/libnetwork/pkg/options"
|
"github.com/docker/libnetwork/pkg/options"
|
||||||
"github.com/docker/libnetwork/types"
|
|
||||||
"github.com/vishvananda/netlink"
|
"github.com/vishvananda/netlink"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -226,8 +225,8 @@ func TestLinkContainers(t *testing.T) {
|
||||||
t.Fatalf("No Ipv4 address assigned to the endpoint: ep2")
|
t.Fatalf("No Ipv4 address assigned to the endpoint: ep2")
|
||||||
}
|
}
|
||||||
|
|
||||||
ce := []types.UUID{"ep1"}
|
ce := []string{"ep1"}
|
||||||
cConfig := &ContainerConfiguration{childEndpoints: ce}
|
cConfig := &ContainerConfiguration{ChildEndpoints: ce}
|
||||||
genericOption = make(map[string]interface{})
|
genericOption = make(map[string]interface{})
|
||||||
genericOption[options.GenericData] = cConfig
|
genericOption[options.GenericData] = cConfig
|
||||||
|
|
||||||
|
@ -276,8 +275,8 @@ func TestLinkContainers(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error condition test with an invalid endpoint-id "ep4"
|
// Error condition test with an invalid endpoint-id "ep4"
|
||||||
ce = []types.UUID{"ep1", "ep4"}
|
ce = []string{"ep1", "ep4"}
|
||||||
cConfig = &ContainerConfiguration{childEndpoints: ce}
|
cConfig = &ContainerConfiguration{ChildEndpoints: ce}
|
||||||
genericOption = make(map[string]interface{})
|
genericOption = make(map[string]interface{})
|
||||||
genericOption[options.GenericData] = cConfig
|
genericOption[options.GenericData] = cConfig
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue