mirror of
https://github.com/moby/moby.git
synced 2026-08-08 09:01:44 +00:00
Fix some macvlan error types for the API
Signed-off-by: Rob Murray <rob.murray@docker.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/containerd/log"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/docker/libnetwork/driverapi"
|
||||
"github.com/docker/docker/libnetwork/netlabel"
|
||||
"github.com/docker/docker/libnetwork/netutils"
|
||||
@@ -21,7 +22,7 @@ func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo dri
|
||||
}
|
||||
n, err := d.getNetwork(nid)
|
||||
if err != nil {
|
||||
return fmt.Errorf("network id %q not found", nid)
|
||||
return errdefs.System(fmt.Errorf("network id %q not found", nid))
|
||||
}
|
||||
ep := &endpoint{
|
||||
id: eid,
|
||||
@@ -31,7 +32,7 @@ func (d *driver) CreateEndpoint(ctx context.Context, nid, eid string, ifInfo dri
|
||||
mac: ifInfo.MacAddress(),
|
||||
}
|
||||
if ep.addr == nil && ep.addrv6 == nil {
|
||||
return fmt.Errorf("create endpoint was not passed an IP address")
|
||||
return errdefs.InvalidParameter(fmt.Errorf("create endpoint was not passed an IP address"))
|
||||
}
|
||||
if ep.mac == nil {
|
||||
if ep.addr != nil {
|
||||
|
||||
@@ -20,7 +20,7 @@ func (d *driver) CreateNetwork(nid string, option map[string]interface{}, nInfo
|
||||
// reject a null v4 network if ipv4 is required
|
||||
if v, ok := option[netlabel.EnableIPv4]; ok && v.(bool) {
|
||||
if len(ipV4Data) == 0 || ipV4Data[0].Pool.String() == "0.0.0.0/0" {
|
||||
return fmt.Errorf("ipv4 pool is empty")
|
||||
return errdefs.InvalidParameter(fmt.Errorf("ipv4 pool is empty"))
|
||||
}
|
||||
}
|
||||
// reject a null v6 network if ipv6 is required
|
||||
|
||||
Reference in New Issue
Block a user