You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@omid.apache.org by yo...@apache.org on 2019/01/04 10:33:24 UTC
incubator-omid git commit: [OMID-123] Allow starting Omid on machines
without en or eth interfaces.
Repository: incubator-omid
Updated Branches:
refs/heads/1.0.1 6344cb59a -> cac65753b
[OMID-123] Allow starting Omid on machines without en or eth interfaces.
Project: http://git-wip-us.apache.org/repos/asf/incubator-omid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-omid/commit/cac65753
Tree: http://git-wip-us.apache.org/repos/asf/incubator-omid/tree/cac65753
Diff: http://git-wip-us.apache.org/repos/asf/incubator-omid/diff/cac65753
Branch: refs/heads/1.0.1
Commit: cac65753b65d388ffbf1e8adfdcb1b78cc0d5192
Parents: 6344cb5
Author: Yonatan Gottesman <yo...@gmail.com>
Authored: Fri Jan 4 12:33:13 2019 +0200
Committer: Yonatan Gottesman <yo...@gmail.com>
Committed: Fri Jan 4 12:33:13 2019 +0200
----------------------------------------------------------------------
common/src/main/java/org/apache/omid/NetworkUtils.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/cac65753/common/src/main/java/org/apache/omid/NetworkUtils.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/omid/NetworkUtils.java b/common/src/main/java/org/apache/omid/NetworkUtils.java
index 751a733..5d7bce2 100644
--- a/common/src/main/java/org/apache/omid/NetworkUtils.java
+++ b/common/src/main/java/org/apache/omid/NetworkUtils.java
@@ -36,15 +36,22 @@ public class NetworkUtils {
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
+ String fallBackName = null;
while (networkInterfaces.hasMoreElements()) {
NetworkInterface nextElement = networkInterfaces.nextElement();
String name = nextElement.getDisplayName();
LOG.info("Iterating over network interfaces, found '{}'", name);
boolean hasInet = Collections.list(nextElement.getInetAddresses()).size() > 1; // Checking that inet exists, to avoid taking iBridge
+ if (hasInet && fallBackName == null) {
+ fallBackName = name;
+ }
if ((name.startsWith(MAC_TSO_NET_IFACE_PREFIX) && hasInet ) ||
name.startsWith(LINUX_TSO_NET_IFACE_PREFIX)) {
return name;
- }
+ }
+ }
+ if (fallBackName != null) {
+ return fallBackName;
}
} catch (SocketException ignored) {
throw new RuntimeException("Failed to find any network interfaces", ignored);