Serialize dynamic network creation
Serialize dynamic network creation

When dynamic networks are created and there is a race in creation of the
same network from two different tasks then one of them will fail while
the other will succeed. For service tasks this is not a big problem
because they will be rescheduled again. But for attachment tasks this
can be a problem since they won't get recreated and making the whole
connection fail. Fixed it by serializing network creation for the
network with the same id and trying to see if the id is present after
coming out of wait.

Signed-off-by: Jana Radhakrishnan <045898bda7d4800fe4909a9831e702ab79e266be@docker.com>

vdemeester/libnetwork,msabansal/libnetwork,mahak/libnetwork,mYmNeo/libnetwork,curtiszimmerman/libnetwork,curtiszimmerman/libnetwork,medallia/libnetwork,ityangchen/libnetwork,cpuguy83/libnetwork,cpuguy83/libnetwork,abhi/libnetwork,mbanikazemi/libnetwork,fcrisciani/libnetwork,docker/libnetwork,mYmNeo/libnetwork,vdemeester/libnetwork,kolyshkin/libnetwork,kolyshkin/libnetwork,medallia/libnetwork,WeiZhang555/libnetwork,sainath14/libnetwork,msabansal/libnetwork,WeiZhang555/libnetwork,mahak/libnetwork,medallia/libnetwork,mbanikazemi/libnetwork,tmakita/libnetwork,kolyshkin/libnetwork,tmakita/libnetwork,fcrisciani/libnetwork,allencloud/libnetwork,mahak/libnetwork,abhi/libnetwork,docker/libnetwork,vdemeester/libnetwork,abhi/libnetwork,allencloud/libnetwork,sainath14/libnetwork,ityangchen/libnetwork,docker/libnetwork