Merge pull request #2098 from weaveworks/2097-fail-on-attach-errors

fail plugin operation on bridge attachment error
This commit is contained in:
Bryan Boreham committed 2016-03-24 17:16:55 +00:00
commit 88d115aab1
1 file changed
+6 -2
+6 -2
View File
@@ -135,11 +135,15 @@ func (driver *driver) JoinEndpoint(j *api.JoinRequest) (*api.JoinResponse, error
Log.Errorf("device %s is %+v", WeaveBridge, maybeBridge)
return nil, errorf(`device "%s" is of type "%s"`, WeaveBridge, maybeBridge.Type())
}
odp.AddDatapathInterface(WeaveBridge, local.Name)
if err := odp.AddDatapathInterface(WeaveBridge, local.Name); err != nil {
return nil, errorf(`failed to attach "%s" to device "%s": %s`, local.Name, WeaveBridge, err)
}
case *netlink.Device:
Log.Warnf("kernel does not report what kind of device %s is, just %+v", WeaveBridge, maybeBridge)
// Assume it's our openvswitch device, and the kernel has not been updated to report the kind.
odp.AddDatapathInterface(WeaveBridge, local.Name)
if err := odp.AddDatapathInterface(WeaveBridge, local.Name); err != nil {
return nil, errorf(`failed to attach "%s" to device "%s": %s`, local.Name, WeaveBridge, err)
}
default:
Log.Errorf("device %s is %+v", WeaveBridge, maybeBridge)
return nil, errorf(`device "%s" not a bridge`, WeaveBridge)