mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #998 from aboch/fx
Fix docker IT failures for 0.7.0-dev.4 vendoring
This commit is contained in:
commit
22a48cd84f
6 changed files with 43 additions and 31 deletions
|
@ -1,5 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
## 0.7.0-dev.5 (2016-03-08)
|
||||
- Fixes https://github.com/docker/docker/issues/20847
|
||||
- Fixes https://github.com/docker/docker/issues/20997
|
||||
- Fixes issues unveiled by docker integ test over 0.7.0-dev.4
|
||||
|
||||
## 0.7.0-dev.4 (2016-03-07)
|
||||
- Changed ownership of exposed ports and port-mapping options from Endpoint to Sandbox
|
||||
- Implement DNS RR in the Docker embedded DNS server
|
||||
|
|
|
@ -1362,26 +1362,22 @@ func parseContainerOptions(cOptions map[string]interface{}) (*containerConfigura
|
|||
if cOptions == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
cc := &containerConfiguration{}
|
||||
|
||||
if opt, ok := cOptions[ParentEndpoints]; ok {
|
||||
if pe, ok := opt.([]string); ok {
|
||||
cc.ParentEndpoints = pe
|
||||
} else {
|
||||
return nil, types.BadRequestErrorf("Invalid parent endpoints data in sandbox configuration: %v", opt)
|
||||
}
|
||||
genericData := cOptions[netlabel.GenericData]
|
||||
if genericData == nil {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if opt, ok := cOptions[ChildEndpoints]; ok {
|
||||
if ce, ok := opt.([]string); ok {
|
||||
cc.ChildEndpoints = ce
|
||||
} else {
|
||||
return nil, types.BadRequestErrorf("Invalid child endpoints data in sandbox configuration: %v", opt)
|
||||
switch opt := genericData.(type) {
|
||||
case options.Generic:
|
||||
opaqueConfig, err := options.GenerateFromModel(opt, &containerConfiguration{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return opaqueConfig.(*containerConfiguration), nil
|
||||
case *containerConfiguration:
|
||||
return opt, nil
|
||||
default:
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
return cc, nil
|
||||
}
|
||||
|
||||
func parseConnectivityOptions(cOptions map[string]interface{}) (*connectivityConfiguration, error) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import (
|
|||
"github.com/docker/libnetwork/ipamutils"
|
||||
"github.com/docker/libnetwork/iptables"
|
||||
"github.com/docker/libnetwork/netlabel"
|
||||
"github.com/docker/libnetwork/options"
|
||||
"github.com/docker/libnetwork/testutils"
|
||||
"github.com/docker/libnetwork/types"
|
||||
)
|
||||
|
@ -599,7 +600,9 @@ func TestLinkContainers(t *testing.T) {
|
|||
}
|
||||
|
||||
sbOptions = make(map[string]interface{})
|
||||
sbOptions[ChildEndpoints] = []string{"ep1"}
|
||||
sbOptions[netlabel.GenericData] = options.Generic{
|
||||
"ChildEndpoints": []string{"ep1"},
|
||||
}
|
||||
|
||||
err = d.Join("net1", "ep2", "", te2, sbOptions)
|
||||
if err != nil {
|
||||
|
@ -655,7 +658,9 @@ func TestLinkContainers(t *testing.T) {
|
|||
|
||||
// Error condition test with an invalid endpoint-id "ep4"
|
||||
sbOptions = make(map[string]interface{})
|
||||
sbOptions[ChildEndpoints] = []string{"ep1", "ep4"}
|
||||
sbOptions[netlabel.GenericData] = options.Generic{
|
||||
"ChildEndpoints": []string{"ep1", "ep4"},
|
||||
}
|
||||
|
||||
err = d.Join("net1", "ep2", "", te2, sbOptions)
|
||||
if err != nil {
|
||||
|
|
|
@ -15,10 +15,4 @@ const (
|
|||
|
||||
// DefaultBridge label
|
||||
DefaultBridge = "com.docker.network.bridge.default_bridge"
|
||||
|
||||
// ChildEndpoints for links
|
||||
ChildEndpoints = "com.docker.network.bridge.child_endpoints"
|
||||
|
||||
// ParentEndpoints for links
|
||||
ParentEndpoints = "com.docker.network.bridge.parent_endpoints"
|
||||
)
|
||||
|
|
|
@ -455,16 +455,26 @@ func (ep *endpoint) sbJoin(sb *sandbox, options ...EndpointOption) error {
|
|||
if moveExtConn {
|
||||
if extEp != nil {
|
||||
log.Debugf("Revoking external connectivity on endpoint %s (%s)", extEp.Name(), extEp.ID())
|
||||
if err := d.RevokeExternalConnectivity(extEp.network.ID(), extEp.ID()); err != nil {
|
||||
log.Warnf("driver failed revoking external connectivity on endpoint %s (%s): %v",
|
||||
if err = d.RevokeExternalConnectivity(extEp.network.ID(), extEp.ID()); err != nil {
|
||||
return types.InternalErrorf(
|
||||
"driver failed revoking external connectivity on endpoint %s (%s): %v",
|
||||
extEp.Name(), extEp.ID(), err)
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if e := d.ProgramExternalConnectivity(extEp.network.ID(), extEp.ID(), sb.Labels()); e != nil {
|
||||
log.Warnf("Failed to roll-back external connectivity on endpoint %s (%s): %v",
|
||||
extEp.Name(), extEp.ID(), e)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
if !n.internal {
|
||||
log.Debugf("Programming external connectivity on endpoint %s (%s)", ep.Name(), ep.ID())
|
||||
if err := d.ProgramExternalConnectivity(n.ID(), ep.ID(), sb.Labels()); err != nil {
|
||||
log.Warnf("driver failed programming external connectivity on endpoint %s (%s): %v",
|
||||
extEp.Name(), extEp.ID(), err)
|
||||
if err = d.ProgramExternalConnectivity(n.ID(), ep.ID(), sb.Labels()); err != nil {
|
||||
return types.InternalErrorf(
|
||||
"driver failed programming external connectivity on endpoint %s (%s): %v",
|
||||
ep.Name(), ep.ID(), err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -582,7 +592,7 @@ func (ep *endpoint) sbLeave(sb *sandbox, force bool, options ...EndpointOption)
|
|||
if moveExtConn {
|
||||
log.Debugf("Revoking external connectivity on endpoint %s (%s)", ep.Name(), ep.ID())
|
||||
if err := d.RevokeExternalConnectivity(n.id, ep.id); err != nil {
|
||||
log.Warnf("driver failed removing external connectivity on endpoint %s (%s): %v",
|
||||
log.Warnf("driver failed revoking external connectivity on endpoint %s (%s): %v",
|
||||
ep.Name(), ep.ID(), err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -306,6 +306,8 @@ func Exists(table Table, chain string, rule ...string) bool {
|
|||
table = Filter
|
||||
}
|
||||
|
||||
initCheck()
|
||||
|
||||
if supportsCOpt {
|
||||
// if exit status is 0 then return true, the rule exists
|
||||
_, err := Raw(append([]string{"-t", string(table), "-C", chain}, rule...)...)
|
||||
|
|
Loading…
Add table
Reference in a new issue