You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2016/07/11 18:27:48 UTC
[1/4] mesos git commit: Reorganized the routing tests into basic and
advanced groups.
Repository: mesos
Updated Branches:
refs/heads/master b41963396 -> 1ddc86846
Reorganized the routing tests into basic and advanced groups.
Advanced tests need some higher version of libnl.
Review: https://reviews.apache.org/r/49841
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/1ddc8684
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/1ddc8684
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/1ddc8684
Branch: refs/heads/master
Commit: 1ddc868465ebfa5b4ce2d2a419d97034da9af91b
Parents: f5597db
Author: Jie Yu <yu...@gmail.com>
Authored: Fri Jul 8 16:55:49 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Jul 11 11:27:37 2016 -0700
----------------------------------------------------------------------
src/tests/containerizer/routing_tests.cpp | 106 +++++++++++++------------
1 file changed, 54 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/1ddc8684/src/tests/containerizer/routing_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/routing_tests.cpp b/src/tests/containerizer/routing_tests.cpp
index 1570a7a..ee21d6c 100644
--- a/src/tests/containerizer/routing_tests.cpp
+++ b/src/tests/containerizer/routing_tests.cpp
@@ -69,47 +69,7 @@ namespace mesos {
namespace internal {
namespace tests {
-
-static const string TEST_VETH_LINK = "veth-test";
-static const string TEST_PEER_LINK = "veth-peer";
-
-
-class RoutingTest : public ::testing::Test
-{
-protected:
- virtual void SetUp()
- {
- ASSERT_SOME(routing::check())
- << "-------------------------------------------------------------\n"
- << "We cannot run any routing tests because either your libnl\n"
- << "library or kernel is not new enough. You can either upgrade,\n"
- << "or disable this test case\n"
- << "-------------------------------------------------------------";
- }
-};
-
-
-// Tests that require setting up virtual ethernet on host.
-class RoutingVethTest : public RoutingTest
-{
-protected:
- virtual void SetUp()
- {
- RoutingTest::SetUp();
-
- // Clean up the test links, in case it wasn't cleaned up properly
- // from previous tests.
- link::remove(TEST_VETH_LINK);
-
- ASSERT_SOME_FALSE(link::exists(TEST_VETH_LINK));
- ASSERT_SOME_FALSE(link::exists(TEST_PEER_LINK));
- }
-
- virtual void TearDown()
- {
- link::remove(TEST_VETH_LINK);
- }
-};
+class RoutingTest : public ::testing::Test {};
TEST_F(RoutingTest, PortRange)
@@ -150,16 +110,6 @@ TEST_F(RoutingTest, PortRange)
}
-TEST_F(RoutingTest, RouteTable)
-{
- Try<vector<route::Rule>> table = route::table();
- EXPECT_SOME(table);
-
- Result<net::IP> gateway = route::defaultGateway();
- EXPECT_FALSE(gateway.isError());
-}
-
-
TEST_F(RoutingTest, LinkIndex)
{
Try<set<string>> links = net::links();
@@ -239,7 +189,32 @@ TEST_F(RoutingTest, Lo)
}
-TEST_F(RoutingTest, INETSockets)
+TEST_F(RoutingTest, RouteTable)
+{
+ Try<vector<route::Rule>> table = route::table();
+ EXPECT_SOME(table);
+
+ Result<net::IP> gateway = route::defaultGateway();
+ EXPECT_FALSE(gateway.isError());
+}
+
+
+class RoutingAdvancedTest : public RoutingTest
+{
+protected:
+ virtual void SetUp()
+ {
+ ASSERT_SOME(routing::check())
+ << "-------------------------------------------------------------\n"
+ << "We cannot run any routing advanced tests because either your\n"
+ << "libnl library or kernel is not new enough. You can either\n"
+ << "upgrade, or disable this test case\n"
+ << "-------------------------------------------------------------";
+ }
+};
+
+
+TEST_F(RoutingAdvancedTest, INETSockets)
{
Try<vector<diagnosis::socket::Info>> infos =
diagnosis::socket::infos(AF_INET, diagnosis::socket::state::ALL);
@@ -255,6 +230,33 @@ TEST_F(RoutingTest, INETSockets)
}
+constexpr char TEST_VETH_LINK[] = "veth-test";
+constexpr char TEST_PEER_LINK[] = "veth-peer";
+
+
+// Tests that require setting up virtual ethernet on host.
+class RoutingVethTest : public RoutingAdvancedTest
+{
+protected:
+ virtual void SetUp()
+ {
+ RoutingAdvancedTest::SetUp();
+
+ // Clean up the test links, in case it wasn't cleaned up properly
+ // from previous tests.
+ link::remove(TEST_VETH_LINK);
+
+ ASSERT_SOME_FALSE(link::exists(TEST_VETH_LINK));
+ ASSERT_SOME_FALSE(link::exists(TEST_PEER_LINK));
+ }
+
+ virtual void TearDown()
+ {
+ link::remove(TEST_VETH_LINK);
+ }
+};
+
+
TEST_F(RoutingVethTest, ROOT_LinkCreate)
{
ASSERT_SOME(link::veth::create(TEST_VETH_LINK, TEST_PEER_LINK, None()));
[3/4] mesos git commit: Fixed the right angle brackets in routing
tests.
Posted by ji...@apache.org.
Fixed the right angle brackets in routing tests.
Review: https://reviews.apache.org/r/49840
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f5597dbc
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f5597dbc
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f5597dbc
Branch: refs/heads/master
Commit: f5597dbc3817ce0394328c30ba3684c9052b7588
Parents: ac417f5
Author: Jie Yu <yu...@gmail.com>
Authored: Fri Jul 8 16:35:29 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Jul 11 11:27:37 2016 -0700
----------------------------------------------------------------------
src/tests/containerizer/routing_tests.cpp | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/f5597dbc/src/tests/containerizer/routing_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/containerizer/routing_tests.cpp b/src/tests/containerizer/routing_tests.cpp
index 452a56d..1570a7a 100644
--- a/src/tests/containerizer/routing_tests.cpp
+++ b/src/tests/containerizer/routing_tests.cpp
@@ -152,7 +152,7 @@ TEST_F(RoutingTest, PortRange)
TEST_F(RoutingTest, RouteTable)
{
- Try<vector<route::Rule> > table = route::table();
+ Try<vector<route::Rule>> table = route::table();
EXPECT_SOME(table);
Result<net::IP> gateway = route::defaultGateway();
@@ -162,7 +162,7 @@ TEST_F(RoutingTest, RouteTable)
TEST_F(RoutingTest, LinkIndex)
{
- Try<set<string> > links = net::links();
+ Try<set<string>> links = net::links();
ASSERT_SOME(links);
foreach (const string& link, links.get()) {
@@ -175,7 +175,7 @@ TEST_F(RoutingTest, LinkIndex)
TEST_F(RoutingTest, LinkName)
{
- Try<set<string> > links = net::links();
+ Try<set<string>> links = net::links();
ASSERT_SOME(links);
foreach (const string& link, links.get()) {
@@ -187,11 +187,11 @@ TEST_F(RoutingTest, LinkName)
TEST_F(RoutingTest, LinkStatistics)
{
- Try<set<string> > links = net::links();
+ Try<set<string>> links = net::links();
ASSERT_SOME(links);
foreach (const string& link, links.get()) {
- Result<hashmap<string, uint64_t> > statistics = link::statistics(link);
+ Result<hashmap<string, uint64_t>> statistics = link::statistics(link);
ASSERT_SOME(statistics);
EXPECT_TRUE(statistics.get().contains("rx_packets"));
@@ -206,7 +206,7 @@ TEST_F(RoutingTest, LinkStatistics)
TEST_F(RoutingTest, LinkExists)
{
- Try<set<string> > links = net::links();
+ Try<set<string>> links = net::links();
ASSERT_SOME(links);
foreach (const string& link, links.get()) {
@@ -241,7 +241,7 @@ TEST_F(RoutingTest, Lo)
TEST_F(RoutingTest, INETSockets)
{
- Try<vector<diagnosis::socket::Info> > infos =
+ Try<vector<diagnosis::socket::Info>> infos =
diagnosis::socket::infos(AF_INET, diagnosis::socket::state::ALL);
EXPECT_SOME(infos);
@@ -859,7 +859,7 @@ TEST_F(RoutingVethTest, ROOT_ICMPFilterCreate)
ingress::HANDLE,
icmp::Classifier(ip)));
- Result<vector<icmp::Classifier> > classifiers =
+ Result<vector<icmp::Classifier>> classifiers =
icmp::classifiers(TEST_VETH_LINK, ingress::HANDLE);
ASSERT_SOME(classifiers);
@@ -927,7 +927,7 @@ TEST_F(RoutingVethTest, ROOT_ICMPFilterCreateMultiple)
Priority(1, 2),
action::Redirect(TEST_PEER_LINK)));
- Result<vector<icmp::Classifier> > classifiers =
+ Result<vector<icmp::Classifier>> classifiers =
icmp::classifiers(TEST_VETH_LINK, ingress::HANDLE);
ASSERT_SOME(classifiers);
@@ -1067,7 +1067,7 @@ TEST_F(RoutingVethTest, ROOT_IPFilterCreate)
EXPECT_SOME_TRUE(ip::exists(TEST_VETH_LINK, ingress::HANDLE, classifier));
- Result<vector<ip::Classifier> > classifiers =
+ Result<vector<ip::Classifier>> classifiers =
ip::classifiers(TEST_VETH_LINK, ingress::HANDLE);
ASSERT_SOME(classifiers);
@@ -1108,7 +1108,7 @@ TEST_F(RoutingVethTest, ROOT_IPFilterCreate2)
ingress::HANDLE,
ip::Classifier(None(), ip, None(), None())));
- Result<vector<ip::Classifier> > classifiers =
+ Result<vector<ip::Classifier>> classifiers =
ip::classifiers(TEST_VETH_LINK, ingress::HANDLE);
ASSERT_SOME(classifiers);
@@ -1231,7 +1231,7 @@ TEST_F(RoutingVethTest, ROOT_IPFilterCreateMultiple)
Priority(2, 2),
action::Redirect(TEST_PEER_LINK)));
- Result<vector<ip::Classifier> > classifiers =
+ Result<vector<ip::Classifier>> classifiers =
ip::classifiers(TEST_VETH_LINK, ingress::HANDLE);
ASSERT_SOME(classifiers);
@@ -1329,7 +1329,7 @@ TEST_F(RoutingVethTest, ROOT_IPFilterRemove)
EXPECT_SOME_TRUE(ip::remove(TEST_VETH_LINK, ingress::HANDLE, classifier2));
EXPECT_SOME_FALSE(ip::exists(TEST_VETH_LINK, ingress::HANDLE, classifier2));
- Result<vector<ip::Classifier> > classifiers =
+ Result<vector<ip::Classifier>> classifiers =
ip::classifiers(TEST_VETH_LINK, ingress::HANDLE);
ASSERT_SOME(classifiers);
[4/4] mesos git commit: Moved netlink cleanup functions to separate
files.
Posted by ji...@apache.org.
Moved netlink cleanup functions to separate files.
This is another effort to allow linking with a lower version of libnl.
This patch moved cleanup functions into their specific files.
Review: https://reviews.apache.org/r/49835
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c1bd3a54
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c1bd3a54
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c1bd3a54
Branch: refs/heads/master
Commit: c1bd3a54175204a5218e03224031ee933fe8974d
Parents: b419633
Author: Jie Yu <yu...@gmail.com>
Authored: Fri Jul 8 15:31:32 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Jul 11 11:27:37 2016 -0700
----------------------------------------------------------------------
src/linux/routing/diagnosis/diagnosis.cpp | 9 +++++++--
src/linux/routing/diagnosis/diagnosis.hpp | 3 ---
src/linux/routing/filter/internal.hpp | 7 +++++++
src/linux/routing/internal.hpp | 28 +++++++++++++++-----------
src/linux/routing/link/internal.hpp | 7 +++++++
src/linux/routing/queueing/internal.hpp | 7 +++++++
6 files changed, 44 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1bd3a54/src/linux/routing/diagnosis/diagnosis.cpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/diagnosis/diagnosis.cpp b/src/linux/routing/diagnosis/diagnosis.cpp
index ce54697..aa2d020 100644
--- a/src/linux/routing/diagnosis/diagnosis.cpp
+++ b/src/linux/routing/diagnosis/diagnosis.cpp
@@ -29,8 +29,14 @@
using namespace std;
namespace routing {
-namespace diagnosis {
+template <>
+inline void cleanup(struct idiagnl_msg* msg)
+{
+ idiagnl_msg_put(msg);
+}
+
+namespace diagnosis {
namespace socket {
static Option<net::IP> IP(nl_addr* _ip)
@@ -82,6 +88,5 @@ Try<vector<Info>> infos(int family, int states)
}
} // namespace socket {
-
} // namespace diagnosis {
} // namespace routing {
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1bd3a54/src/linux/routing/diagnosis/diagnosis.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/diagnosis/diagnosis.hpp b/src/linux/routing/diagnosis/diagnosis.hpp
index 447f342..7722fd2 100644
--- a/src/linux/routing/diagnosis/diagnosis.hpp
+++ b/src/linux/routing/diagnosis/diagnosis.hpp
@@ -29,9 +29,7 @@
namespace routing {
namespace diagnosis {
-
namespace socket {
-
namespace state {
// The different connection states of a socket.
@@ -103,7 +101,6 @@ struct Info
Try<std::vector<Info>> infos(int familiy, int states);
} // namespace socket {
-
} // namespace diagnosis {
} // namespace routing {
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1bd3a54/src/linux/routing/filter/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/filter/internal.hpp b/src/linux/routing/filter/internal.hpp
index 6c174e1..dc4b8f9 100644
--- a/src/linux/routing/filter/internal.hpp
+++ b/src/linux/routing/filter/internal.hpp
@@ -59,6 +59,13 @@
#include "linux/routing/link/internal.hpp"
namespace routing {
+
+template <>
+inline void cleanup(struct rtnl_cls* cls)
+{
+ rtnl_cls_put(cls);
+}
+
namespace filter {
namespace internal {
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1bd3a54/src/linux/routing/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/internal.hpp b/src/linux/routing/internal.hpp
index 9396346..132f62e 100644
--- a/src/linux/routing/internal.hpp
+++ b/src/linux/routing/internal.hpp
@@ -22,12 +22,6 @@
#include <netlink/netlink.h>
#include <netlink/socket.h>
-#include <netlink/idiag/msg.h>
-
-#include <netlink/route/classifier.h>
-#include <netlink/route/link.h>
-#include <netlink/route/qdisc.h>
-
#include <memory>
#include <string>
@@ -39,12 +33,22 @@
namespace routing {
// Customized deallocation functions for netlink objects.
-inline void cleanup(struct nl_cache* cache) { nl_cache_free(cache); }
-inline void cleanup(struct nl_sock* sock) { nl_socket_free(sock); }
-inline void cleanup(struct rtnl_cls* cls) { rtnl_cls_put(cls); }
-inline void cleanup(struct rtnl_link* link) { rtnl_link_put(link); }
-inline void cleanup(struct rtnl_qdisc* qdisc) { rtnl_qdisc_put(qdisc); }
-inline void cleanup(struct idiagnl_msg* msg) { idiagnl_msg_put(msg); }
+template <typename T>
+void cleanup(T* t);
+
+
+template <>
+inline void cleanup(struct nl_cache* cache)
+{
+ nl_cache_free(cache);
+}
+
+
+template <>
+inline void cleanup(struct nl_sock* sock)
+{
+ nl_socket_free(sock);
+}
// A helper class for managing netlink objects (e.g., rtnl_link,
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1bd3a54/src/linux/routing/link/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/link/internal.hpp b/src/linux/routing/link/internal.hpp
index eb89b9a..551ffda 100644
--- a/src/linux/routing/link/internal.hpp
+++ b/src/linux/routing/link/internal.hpp
@@ -42,6 +42,13 @@
#include "linux/routing/internal.hpp"
namespace routing {
+
+template <>
+inline void cleanup(struct rtnl_link* link)
+{
+ rtnl_link_put(link);
+}
+
namespace link {
namespace internal {
http://git-wip-us.apache.org/repos/asf/mesos/blob/c1bd3a54/src/linux/routing/queueing/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/queueing/internal.hpp b/src/linux/routing/queueing/internal.hpp
index 151d1b1..9fe522e 100644
--- a/src/linux/routing/queueing/internal.hpp
+++ b/src/linux/routing/queueing/internal.hpp
@@ -45,6 +45,13 @@
#include "linux/routing/queueing/statistics.hpp"
namespace routing {
+
+template <>
+inline void cleanup(struct rtnl_qdisc* qdisc)
+{
+ rtnl_qdisc_put(qdisc);
+}
+
namespace queueing {
namespace internal {
[2/4] mesos git commit: Removed the network isolator specific check
in netlink socket method.
Posted by ji...@apache.org.
Removed the network isolator specific check in netlink socket method.
This check has been performed in the port mapping isolator as well in
the corresponding tests.
Review: https://reviews.apache.org/r/49839
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ac417f5b
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ac417f5b
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ac417f5b
Branch: refs/heads/master
Commit: ac417f5b62bf91b75a1417c53c52d09dac8f618f
Parents: c1bd3a5
Author: Jie Yu <yu...@gmail.com>
Authored: Fri Jul 8 16:19:02 2016 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Mon Jul 11 11:27:37 2016 -0700
----------------------------------------------------------------------
src/linux/routing/internal.hpp | 7 -------
1 file changed, 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/ac417f5b/src/linux/routing/internal.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/internal.hpp b/src/linux/routing/internal.hpp
index 132f62e..1b75727 100644
--- a/src/linux/routing/internal.hpp
+++ b/src/linux/routing/internal.hpp
@@ -28,8 +28,6 @@
#include <stout/error.hpp>
#include <stout/try.hpp>
-#include "linux/routing/utils.hpp"
-
namespace routing {
// Customized deallocation functions for netlink objects.
@@ -92,11 +90,6 @@ private:
// TODO(chzhcn): Consider renaming 'routing' to 'netlink'.
inline Try<Netlink<struct nl_sock>> socket(int protocol = NETLINK_ROUTE)
{
- Try<Nothing> checking = check();
- if (checking.isError()) {
- return Error(checking.error());
- }
-
struct nl_sock* s = nl_socket_alloc();
if (s == nullptr) {
return Error("Failed to allocate netlink socket");