diff options
author | Grant Millar <rid@cylo.io> | 2019-08-29 08:56:37 +0100 |
---|---|---|
committer | Grant Millar <rid@cylo.io> | 2019-10-15 11:40:24 +0100 |
commit | df7b8f458aec29400c76b8dc87b3ce087d3fa76c (patch) | |
tree | d36783a2ec30340adc8ab6ee3b71409297be8a71 /vendor/github.com | |
parent | 7521bd1bc9f4713748c9d48c8bb282f7bf4c2352 (diff) | |
download | docker-df7b8f458aec29400c76b8dc87b3ce087d3fa76c.tar.gz |
daemon: Use short libnetwork ID in exec-root & update libnetwork
Signed-off-by: Grant Millar <rid@cylo.io>
Diffstat (limited to 'vendor/github.com')
4 files changed, 28 insertions, 30 deletions
diff --git a/vendor/github.com/docker/libnetwork/drivers/bridge/setup_ipv6.go b/vendor/github.com/docker/libnetwork/drivers/bridge/setup_ipv6.go index b944be081e..28fa824944 100644 --- a/vendor/github.com/docker/libnetwork/drivers/bridge/setup_ipv6.go +++ b/vendor/github.com/docker/libnetwork/drivers/bridge/setup_ipv6.go @@ -70,7 +70,7 @@ func setupBridgeIPv6(config *networkConfiguration, i *bridgeInterface) error { Dst: config.AddressIPv6, }) if err != nil && !os.IsExist(err) { - logrus.Errorf("Could not add route to IPv6 network %s via device %s", config.AddressIPv6.String(), config.BridgeName) + logrus.Errorf("Could not add route to IPv6 network %s via device %s: %s", config.AddressIPv6.String(), config.BridgeName, err) } return nil diff --git a/vendor/github.com/docker/libnetwork/ipvs/constants.go b/vendor/github.com/docker/libnetwork/ipvs/constants.go index b6b7f2bb5e..efac4e367c 100644 --- a/vendor/github.com/docker/libnetwork/ipvs/constants.go +++ b/vendor/github.com/docker/libnetwork/ipvs/constants.go @@ -144,6 +144,17 @@ const ( // a statically assigned hash table by their source IP // addresses. SourceHashing = "sh" + + // WeightedRoundRobin assigns jobs to real servers proportionally + // to there real servers' weight. Servers with higher weights + // receive new jobs first and get more jobs than servers + // with lower weights. Servers with equal weights get + // an equal distribution of new jobs + WeightedRoundRobin = "wrr" + + // WeightedLeastConnection assigns more jobs to servers + // with fewer jobs and relative to the real servers' weight + WeightedLeastConnection = "wlc" ) const ( diff --git a/vendor/github.com/docker/libnetwork/sandbox_externalkey_unix.go b/vendor/github.com/docker/libnetwork/sandbox_externalkey_unix.go index 5006583c5b..d0f60deda7 100644 --- a/vendor/github.com/docker/libnetwork/sandbox_externalkey_unix.go +++ b/vendor/github.com/docker/libnetwork/sandbox_externalkey_unix.go @@ -12,6 +12,7 @@ import ( "os" "path/filepath" + "github.com/docker/docker/pkg/stringid" "github.com/docker/libnetwork/types" "github.com/opencontainers/runtime-spec/specs-go" "github.com/sirupsen/logrus" @@ -24,7 +25,7 @@ const ( ) // processSetKeyReexec is a private function that must be called only on an reexec path -// It expects 3 args { [0] = "libnetwork-setkey", [1] = <container-id>, [2] = <controller-id> } +// It expects 3 args { [0] = "libnetwork-setkey", [1] = <container-id>, [2] = <short-controller-id> } // It also expects specs.State as a json string in <stdin> // Refer to https://github.com/opencontainers/runc/pull/160/ for more information // The docker exec-root can be specified as "-exec-root" flag. The default value is "/run/docker". @@ -41,14 +42,14 @@ func processSetKeyReexec() { execRoot := flag.String("exec-root", defaultExecRoot, "docker exec root") flag.Parse() - // expecting 3 os.Args {[0]="libnetwork-setkey", [1]=<container-id>, [2]=<controller-id> } + // expecting 3 os.Args {[0]="libnetwork-setkey", [1]=<container-id>, [2]=<short-controller-id> } // (i.e. expecting 2 flag.Args()) args := flag.Args() if len(args) < 2 { err = fmt.Errorf("Re-exec expects 2 args (after parsing flags), received : %d", len(args)) return } - containerID, controllerID := args[0], args[1] + containerID, shortCtlrID := args[0], args[1] // We expect specs.State as a json string in <stdin> stateBuf, err := ioutil.ReadAll(os.Stdin) @@ -60,16 +61,16 @@ func processSetKeyReexec() { return } - err = SetExternalKey(controllerID, containerID, fmt.Sprintf("/proc/%d/ns/net", state.Pid), *execRoot) + err = SetExternalKey(shortCtlrID, containerID, fmt.Sprintf("/proc/%d/ns/net", state.Pid), *execRoot) } // SetExternalKey provides a convenient way to set an External key to a sandbox -func SetExternalKey(controllerID string, containerID string, key string, execRoot string) error { +func SetExternalKey(shortCtlrID string, containerID string, key string, execRoot string) error { keyData := setKeyData{ ContainerID: containerID, Key: key} - uds := filepath.Join(execRoot, execSubdir, controllerID+".sock") + uds := filepath.Join(execRoot, execSubdir, shortCtlrID+".sock") c, err := net.Dial("unix", uds) if err != nil { return err @@ -120,7 +121,8 @@ func (c *controller) startExternalKeyListener() error { if err := os.MkdirAll(udsBase, 0600); err != nil { return err } - uds := filepath.Join(udsBase, c.id+".sock") + shortCtlrID := stringid.TruncateID(c.id) + uds := filepath.Join(udsBase, shortCtlrID+".sock") l, err := net.Listen("unix", uds) if err != nil { return err diff --git a/vendor/github.com/docker/libnetwork/store.go b/vendor/github.com/docker/libnetwork/store.go index 0a7c5754d3..621bf507b9 100644 --- a/vendor/github.com/docker/libnetwork/store.go +++ b/vendor/github.com/docker/libnetwork/store.go @@ -80,30 +80,15 @@ func (c *controller) getStores() []datastore.DataStore { } func (c *controller) getNetworkFromStore(nid string) (*network, error) { - for _, store := range c.getStores() { - n := &network{id: nid, ctrlr: c} - err := store.GetObject(datastore.Key(n.Key()...), n) - // Continue searching in the next store if the key is not found in this store - if err != nil { - if err != datastore.ErrKeyNotFound { - logrus.Debugf("could not find network %s: %v", nid, err) - } - continue - } - - ec := &endpointCnt{n: n} - err = store.GetObject(datastore.Key(ec.Key()...), ec) - if err != nil && !n.inDelete { - return nil, fmt.Errorf("could not find endpoint count for network %s: %v", n.Name(), err) - } - - n.epCnt = ec - if n.scope == "" { - n.scope = store.Scope() + ns, err := c.getNetworksFromStore() + if err != nil { + return nil, err + } + for _, n := range ns { + if n.id == nid { + return n, nil } - return n, nil } - return nil, fmt.Errorf("network %s not found", nid) } |