Commit graph

1378 commits

Author SHA1 Message Date
Alessandro Boch
cf65861f59 Overlay driver to check for chain presence
- When creating and programming the global overlay chain,
  gracefully handle the case where the chain already exists.
  Today the driver logs an Error and does not attempt to insert
  the return rule if the chain is already present.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-04-13 10:47:42 -07:00
Alessandro Boch
089c5ab18a Merge pull request #1106 from chenchun/fix_ci
Fix broken CI because of newly introduced NetworkAllocate/NetworkFree…
2016-04-13 07:05:43 -07:00
Chun Chen
83d8a3527a Fix broken CI because of newly introduced NetworkAllocate/NetworkFree api
Signed-off-by: Chun Chen <ramichen@tencent.com>
2016-04-13 16:04:58 +08:00
Alessandro Boch
21312b85ba Merge pull request #1103 from mrjana/manager
Add NetworkAllocate/Free to driver api
2016-04-12 15:52:09 -07:00
Alessandro Boch
7efc9e9a20 Merge pull request #1060 from LK4D4/fix_bitseq_races
bitseq: fix races
2016-04-12 15:30:07 -07:00
Alessandro Boch
bda53a31f4 Merge pull request #1093 from mrjana/drvreg
Create driver registry package
2016-04-12 15:26:37 -07:00
Madhu Venugopal
292ea3fe43 Merge pull request #1061 from darrenstahlmsft/WindowsNetworkQos
Added maximum egress bandwidth qos for Windows
2016-04-12 04:02:53 -07:00
Jana Radhakrishnan
b6d5c12ea2 Add NetworkAllocate/Free to driver api
Added NetworkAllocate and NetworkFree apis to the list of
driver apis. The intention of the api is to provide a
centralized way of allocating and freeing network resources
for a network which is cross-host.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-04-11 16:38:22 -07:00
Alessandro Boch
0251123411 Merge pull request #1097 from mrjana/resolver
Resolver sockets not flushed on default gw change
2016-04-10 11:00:17 -07:00
Jana Radhakrishnan
d81a91ebad Resolver sockets not flushed on default gw change
Currently when the default gw changes because of
other network connections happening in the container
the resolver sockets are not flushed. This results
in a subsequent DNS failure for external queries

A sequence of connecting the container to an overlay
network and subsequently to a bridge network without
disconnecting from any network will result in this
behaviour. This was revealed by one of the libnetwork
IT tests.

This is now fixed as part of the commit by flushing
the external query sockets when a default gw change
is detected.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-04-10 10:40:06 -07:00
Jana Radhakrishnan
f539be8a63 Create driver registry package
Currently driver management logic is tightly coupled with
libnetwork package and that makes it very difficult to
modularize it and use it separately. This PR modularizes
the driver management logic by creating a driver registry
package.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-04-09 09:43:43 -07:00
Jana Radhakrishnan
77c66f968b Merge pull request #1094 from aboch/rd
Use newly introduce plugins method to validate plugin response
2016-04-08 23:27:15 -07:00
Alessandro Boch
8e6d52fa80 Use newly introduce plugins method to validate plugin response
- for endpoints which are not expected to be implemented
  by all remote drivers.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-04-08 23:10:25 -07:00
Santhosh Manohar
440d2b1c54 Merge pull request #1091 from mrjana/networkdb
Add network scoped gossip database
2016-04-08 22:44:25 -07:00
Jana Radhakrishnan
28f4561e3f Add network scoped gossip database
Network DB is a network scoped gossip database built
on top of hashicorp/memberlist providing an eventually
consistent state store.

It limits the scope of the gossip and periodic bulk syncing
for table entries to only the nodes which participate in the
network to which the gossip belongs. This designs make the
gossip layer scale better and only consumes resources for the
network state that the node participates in.

Since the complete state for a network is maintained by all nodes
participating in the network, all nodes will eventually converge
to the same state.

NetworkDB also provides facilities for the users of the package to
watch on any table (or all tables) and get notified if there are
state changes of interest that happened anywhere in the cluster when
that state change eventually finds it's way to the watcher's node.

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-04-08 12:58:09 -07:00
Jana Radhakrishnan
01c9083626 Update Godeps
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
2016-04-08 12:58:08 -07:00
Madhu Venugopal
dfdee91fb3 Merge pull request #1088 from sanimej/udp
Fix the panic when a query response comes after the read() timesout
2016-04-08 11:30:11 -07:00
Madhu Venugopal
75ac73d03e Merge pull request #1086 from aboch/io
Persist ipam driver options
2016-04-08 08:40:51 -07:00
Alessandro Boch
865951c6e8 Persist ipam driver options
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-04-08 08:18:09 -07:00
Madhu Venugopal
a50e0482e6 Merge pull request #1089 from chenchun/fix_vet
tools/cmd/vet has been deleted and go tool vet works natively on 1.5+
2016-04-08 04:21:42 -07:00
Chun Chen
d0c34749d9 tools/cmd/vet has been deleted and go tool vet works natively on 1.5+
Signed-off-by: Chun Chen <ramichen@tencent.com>
2016-04-08 16:33:39 +08:00
Santhosh Manohar
5e4fa21005 Fix the panic when a query response comes after the read() timesout
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2016-04-07 19:36:06 -07:00
Santhosh Manohar
42113ead88 Merge pull request #1080 from aboch/epgw
Fix when connecting/disconnecting to/from default gw network
2016-04-06 11:45:54 -07:00
Alessandro Boch
a5aeffcb59 Fix when connecting/disconnecting to/from default gw network
- Restoring original behavior where on disconnect
  from overlay network (only connected network), it also
  disconnects from default gw network.
- On sandbox delete, the leave and delete of each
  endpoint is performed, regardless of whether the endpoint
  is the gw network endpoint. This endpoint is already
  automatically removed in endpoint.sbLeave()
- Also do not let internal network dictate container does
  not need external connectivity. Before this fix, if a container
  was connected to an overlay and an internal network, it may not
  get attached to the default gw network.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-04-06 09:29:41 -07:00
Alessandro Boch
ba5f3a039b Merge pull request #1078 from mavenugo/revert
Revert "Do not leave/delete gw endpoint twice"
2016-04-05 20:19:50 -07:00
Madhu Venugopal
12f04e292f Revert "Do not leave/delete gw endpoint twice"
This reverts commit c957564753 introduced
via #1064.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-04-05 18:55:16 -07:00
Santhosh Manohar
c13d22db78 Merge pull request #1076 from aboch/int
Bridge driver needs to store the network config internal flag
2016-04-05 17:25:49 -07:00
Alessandro Boch
3ad5bd6d88 Bridge driver needs to store the network config internal flag
- otherwise after daemon reload, the network is no longer internal

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-04-05 17:07:49 -07:00
Santhosh Manohar
7bf06e0551 Merge pull request #1064 from aboch/epgw
Fix when connecting/disconnecting to/from default gw network
2016-04-05 14:35:50 -07:00
Alessandro Boch
c957564753 Do not leave/delete gw endpoint twice
- On sandbox delete, the leave and delete of each
  endpoint is performed, regardless of whether the endpoint
  is the gw network endpoint. This endpoint is already
  automatically removed in endpoint.sbLeave() by
  sb.clearDefaultGW() when the sandbox is marked for
  deletion.
- Also restoring otiginal behavior where on disconnect
  from overlay network (only connected network), it also
  disconnects from default gw network.
- Also do not let internal network dictate container does
  not need external connectivity. Before this fix, if a container
  was connected to an overlay and an internal network, it may not
  get attached to the default gw network.
- needDefaultGw() takes now into account whether the sandbox
  is marked for deletion

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-04-05 11:32:49 -07:00
Alessandro Boch
90a1eb68e4 Merge pull request #1073 from sanimej/udp
Fix the handling for concurrent queries over UDP
2016-04-04 16:35:23 -07:00
Jana Radhakrishnan
7ac34d3d95 Merge pull request #1071 from aboch/obl
Have resources initialized before deleting overlay network
2016-04-04 14:55:22 -07:00
Alessandro Boch
0e7a19521c Have resources initialized before deleting overlay network
- Otherwise a overlay network delete after daemon restart
  will hit a nil pointer dereference while releasing the
  vxlan id

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-04-04 14:38:14 -07:00
Madhu Venugopal
bb14f0afb0 Merge pull request #1072 from cpuguy83/reduce_init_cost
Remove pre-defined networks from package init
2016-04-04 14:15:05 -07:00
Brian Goff
22801e071f Remove pre-defined networks from package init
This moves the initialization of the pre-defined networks to where it's
used instead of in package init.
This reason for this change is having this be populated in `init()`
causes it to always consume cpu, and memory (4.3MB of memory), to
populate even if the package is unused (like for instnace, in a re-exec).

Here is a memory profile of docker/docker just after starting the daemon of the
top 10 largest memory consumers:

Before:
```
      flat  flat%   sum%        cum   cum%
         0     0%     0%    11.89MB 95.96%  runtime.goexit
         0     0%     0%     6.79MB 54.82%  runtime.main
         0     0%     0%     5.79MB 46.74%  main.init
         0     0%     0%     4.79MB 38.67%  github.com/docker/docker/api/server/router/network.init
         0     0%     0%     4.79MB 38.67%  github.com/docker/libnetwork.init
         0     0%     0%     4.29MB 34.63%  github.com/docker/libnetwork/ipam.init
         0     0%     0%     4.29MB 34.63%  github.com/docker/libnetwork/ipams/builtin.init
         0     0%     0%     4.29MB 34.63%  github.com/docker/libnetwork/ipamutils.init
         0     0%     0%     4.29MB 34.63%  github.com/docker/libnetwork/ipamutils.init.1
    4.29MB 34.63% 34.63%     4.29MB 34.63%  github.com/docker/libnetwork/ipamutils.initGranularPredefinedNetworks
```

After:
```
      flat  flat%   sum%        cum   cum%
         0     0%     0%  4439.37kB 89.66%  runtime.goexit
         0     0%     0%  4439.37kB 89.66%  runtime.main
         0     0%     0%  3882.11kB 78.40%  github.com/docker/docker/cli.(*Cli).Run
         0     0%     0%  3882.11kB 78.40%  main.main
 3882.11kB 78.40% 78.40%  3882.11kB 78.40%  reflect.callMethod
         0     0% 78.40%  3882.11kB 78.40%  reflect.methodValueCall
         0     0% 78.40%   557.26kB 11.25%  github.com/docker/docker/api/server.init
  557.26kB 11.25% 89.66%   557.26kB 11.25%  html.init
         0     0% 89.66%   557.26kB 11.25%  html/template.init
         0     0% 89.66%   557.26kB 11.25%  main.init
```

Now, of course the docker daemon will still need to consume this memory, but
at least now re-execs and such won't have to re-init these variables.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-04-04 15:25:29 -04:00
Santhosh Manohar
30d649c3e8 Fix the handling for concurrent queries over UDP
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2016-04-01 10:45:24 -07:00
Madhu Venugopal
d0cfd9b3dd Merge pull request #1065 from aboch/ov
Do not allow overlay destroySandbox() to be interrupted
2016-03-30 17:35:08 -07:00
Alessandro Boch
cea4dd457c Do not allow overlay destroySandbox() to be interrupted
- Concurrent leave/join of one member overlay network can end with the error:
  "subnet sandbox join failed for "A.B.C.D/MM": error creating vxlan interface: file exists"
  This happens when the join is processed while the leave has already started.
  Having the network one member only, the leave resets the once variable for this network subnets
  and triggers the sandbox destroy for each subnet's vxlan interface, when the n.joinCnt goes to 0.
  But given the destroySandbox() is not atomic, the join thread can trigger the creation of the
  vxlan interface in between (given subnet.once was re-initialized) before the leave thread
  removes the vxlan interface for this subnet.
- The fix is to not allow interruptions between the re-initialization of the subnet.once var and
  consequent vxlan interface removal.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-03-30 16:53:34 -07:00
Alessandro Boch
8be202014d Merge pull request #1062 from sanimej/fixes
Limit number of concurrent DNS queries
2016-03-30 14:20:30 -07:00
Alessandro Boch
45eee51bc3 Merge pull request #1059 from mavenugo/ovNotify
Handle endpoint & network object in notifyEvent avoiding id lookup
2016-03-29 15:35:58 -07:00
Alexander Morozov
a9c3a9821b bitseq: fix races
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-03-29 11:56:39 -07:00
Madhu Venugopal
7cbc3e76f6 Handle endpoint & network object in notifyEvent avoiding id lookup
Join & Leave Serf processing happens in a separate goroutine and there
are cases as in https://github.com/docker/libnetwork/issues/985, it can
cause lookup failures when endpoint delete processing happens before
Serf gets a chance to handle the leave processing.

The fix is to avoid such lookups in this goroutine, but handle the
endpoint and network objects directly.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-03-29 11:19:23 -07:00
Santhosh Manohar
bd0d8222aa Limit number of concurrent DNS queries
Signed-off-by: Santhosh Manohar <santhosh@docker.com>
2016-03-29 06:23:01 -07:00
Jana Radhakrishnan
9ca3964233 Merge pull request #1058 from aboch/hdbg
Log time taken to set sandbox key
2016-03-28 21:55:21 -07:00
Alessandro Boch
df975778fc Log time taken to set sandbox key
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-03-28 20:40:51 -07:00
Darren Stahl
5b3524af9f Added maximum egress bandwidth qos for Windows
Signed-off-by: Darren Stahl <darst@microsoft.com>
2016-03-28 14:50:55 -07:00
Alessandro Boch
80f7a91360 Merge pull request #1048 from sanimej/fixes
On network disconnect clear the cached connections to external nameservers
2016-03-25 13:48:49 -07:00
Alessandro Boch
68c68ca831 Merge pull request #1049 from mavenugo/rc
Reload config should initialize only the appropriate datastore
2016-03-25 12:05:58 -07:00
Madhu Venugopal
c92b196d2e Reload config should initialize only the appropriate datastore
With the current implementation, a config relaod event causes all the
datastores to reinitialize and that impacts objects with Persist=false
such as none and host network.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-03-25 01:10:03 -07:00
Chun Chen
d60830037a Merge pull request #1040 from aboch/mp
modprobe when needed
2016-03-22 16:36:25 +08:00