> On March 20, 2016, 7:06 p.m., Jie Yu wrote: > > src/slave/containerizer/mesos/isolators/network/cni/cni.hpp, line 82 > > <https://reviews.apache.org/r/44514/diff/5/?file=1304896#file1304896line82> > > > > s/NetworkResultInfo/Info/ > > > > We typically use 'Info' to store information about each container in > > isolators. > > > > We can then have a hashmap from network name to a another data > > structure in Info to represent the networks the container has joined. > > > > ``` > > // Information about a network that a container has joined. > > struct NetworkInfo > > { > > string ifname; > > cni::NetworkResult result; > > }; > > > > struct Info > > { > > hashmap<string, NetworkInfo> networkInfos; > > }; > > ``` > > Qian Zhang wrote: > Are we going to support the use case that one container joins one CNI > network multiple times? If yes, then I think we may need to use `vector` > rather than `hashmap` in `struct Info`, like this: > > struct NetworkResultInfo > { > // CNI network name. > std::string name; > > // Interface name. > const std::string ifname; > > // Protobuf of CNI network result returned by CNI plugin > Option<cni::NetworkResult> result; > }; > > struct Info > { > std::vector<NetworkResultInfo> networkInfos; > }; > > Jie Yu wrote: > > Are we going to support the use case that one container joins one CNI > network multiple times? > > Let's not consider this for now. I don't see a use case at this moment. > > Also, I think the name 'NetworkResult' is weird (what result? what's > network result?!). Can we rename it to NetworkInfo? > > ``` > struct NetworkInfo > { > string name; > string ifname; > Option<spec::NetworkInfo> network; > } > > struct Info > { > hashmap<string, NetworkInfo> networkInfos; > } > ``` > > Qian Zhang wrote: > Do we need to support NIC bonding (e.g., both eth0 and eth1 of a > container are in one CNI network)? If we do not need to support it, then I > agree we should use hashmap rather than vector, and I will add a check in > `prepare()` to make sure one container only joins a CNI network once, > otherwise return Failure.
Let's not consider NIC bonding for now. We can easily s/hashmap/multihashmap/ if we want to support it in the future. - Jie ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/44514/#review124451 ----------------------------------------------------------- On March 18, 2016, 6:31 a.m., Qian Zhang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/44514/ > ----------------------------------------------------------- > > (Updated March 18, 2016, 6:31 a.m.) > > > Review request for mesos, Avinash sridharan, Gilbert Song, and Jie Yu. > > > Bugs: MESOS-4759 > https://issues.apache.org/jira/browse/MESOS-4759 > > > Repository: mesos > > > Description > ------- > > Implemented prepare() method of "network/cni" isolator. > > > Diffs > ----- > > src/slave/containerizer/mesos/isolators/network/cni/cni.hpp PRE-CREATION > src/slave/containerizer/mesos/isolators/network/cni/cni.cpp PRE-CREATION > > Diff: https://reviews.apache.org/r/44514/diff/ > > > Testing > ------- > > make check > > > Thanks, > > Qian Zhang > >