> On July 28, 2018, 12:29 a.m., Jie Yu wrote: > > src/slave/containerizer/mesos/isolators/network/cni/cni.cpp > > Lines 1506-1507 (patched) > > <https://reviews.apache.org/r/68054/diff/2/?file=2064856#file2064856line1506> > > > > No need for this temp variable > > Sergey Urbanovich wrote: > I got the following error without the temp variable. What would be the > best way to use `lambda::bind()` in that case? > > ``` > ../src/slave/containerizer/mesos/isolators/network/cni/cni.cpp:1513:26: > error: no matching member function for call to 'run' > return namespaceRunner.run(netns, "net", > lambda::bind(&NetworkCniIsolatorProcess::_usage, ifNames)); > ~~~~~~~~~~~~~~~~^~~ > ../src/linux/ns.hpp:210:22: note: candidate template ignored: could not > match 'function' against '_Bind' > process::Future<T> run( > ^ > ```
The temp variable adds explicit type conversion. I've been trying to use `std::function<>` in ns.hpp, but got the same error for `lambda::bind()` and `std::bind()`: ``` ../src/slave/containerizer/mesos/isolators/network/cni/cni.cpp:1514:26: error: no matching member function for call to 'run' return namespaceRunner.run( ~~~~~~~~~~~~~~~~^~~ ../src/linux/ns.hpp:211:22: note: candidate template ignored: could not match 'function' against '_Bind' process::Future<T> run( ^ ``` For `std::function<>` and lambda expressions I got another error: ``` ../src/slave/containerizer/mesos/isolators/network/cni/cni.cpp:1513:26: error: no matching member function for call to 'run' return namespaceRunner.run(netns, "net", ~~~~~~~~~~~~~~~~^~~ ../src/linux/ns.hpp:211:22: note: candidate template ignored: could not match 'function<Try<type-parameter-0-0, Error> ()>' against '(lambda at ../src/slave/containerizer/mesos/isolators/network/cni/cni.cpp:1514:7)' process::Future<T> run( ^ ``` - Sergey ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/68054/#review206564 ----------------------------------------------------------- On July 27, 2018, 11:36 p.m., Sergey Urbanovich wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/68054/ > ----------------------------------------------------------- > > (Updated July 27, 2018, 11:36 p.m.) > > > Review request for mesos, Jie Yu and Qian Zhang. > > > Bugs: MESOS-5647 > https://issues.apache.org/jira/browse/MESOS-5647 > > > Repository: mesos > > > Description > ------- > > On receiving a request for getting `usage` for a given container > the `network/cni` isolator uses getifaddrs(3) glibc function. The > function returns basic networking metrics for each networking > interface in the container networking namespace. It should work > right out of the box on all modern Linux-based systems. > > To get more networking metrics please use Netlink Protocol Library. > However, you will have to open NETLINK sockets in each networking > namespace and manage them from the `network/cni` isolator. > > JIRA: https://issues.apache.org/jira/browse/MESOS-5647 > > > Diffs > ----- > > src/slave/containerizer/mesos/isolators/network/cni/cni.hpp > 31ec4ddb1049b7259b0784e5e40b002e29f6a8da > src/slave/containerizer/mesos/isolators/network/cni/cni.cpp > f46c962d8f044092aaa113fafc536c6b25bab45c > src/tests/containerizer/cni_isolator_tests.cpp > 90d2d4103c8136d2dd883318acc135f7efca80d8 > > > Diff: https://reviews.apache.org/r/68054/diff/3/ > > > Testing > ------- > > bin/mesos-tests.sh --verbose > --gtest_filter="CniIsolatorTest.ROOT_VerifyResourceStatistics" > --gtest_break_on_failure --gtest_repeat=100 > > > Thanks, > > Sergey Urbanovich > >