Change in vdsm[master]: net: When IPv6 is not enabled, fallback to IPv4
edwardh at redhat.com
edwardh at redhat.com
Mon Jan 18 14:57:37 UTC 2016
Edward Haas has uploaded a new change for review.
Change subject: net: When IPv6 is not enabled, fallback to IPv4
......................................................................
net: When IPv6 is not enabled, fallback to IPv4
There are setups where IPv6 is disabled, causing a conflict with the
default configuration (which is set to listen on address '::').
In such a case, VDSM fails to listen on '::'.
In order to support IPv4 only setups without requiring a change in the
configuration, VDSM will fallback to listen on an IPv4 only address.
Note that '::' is used to listen on both IPv4 & IPv6 stacks, a fallback to
IPv4 seems reasonable.
Change-Id: If95914dd9dfc88b40887345ac9e244ee2b1e09e9
Signed-off-by: Edward Haas <edwardh at redhat.com>
---
M vdsm/clientIF.py
M vdsm/protocoldetector.py
2 files changed, 11 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/66/52366/1
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 8faf5bc..0d1e235 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -18,6 +18,7 @@
# Refer to the README and COPYING files for full details of the license
#
+import errno
import os
import os.path
import socket
@@ -116,7 +117,16 @@
host = config.get('addresses', 'management_ip')
port = config.getint('addresses', 'management_port')
- self._createAcceptor(host, port)
+ # When IPv6 is not enabled, fallback to listen on IPv4 address
+ try:
+ self._createAcceptor(host, port)
+ except socket.error as e:
+ if e.errno == errno.EAFNOSUPPORT and host in ('::', '::1'):
+ fallback_host = '0.0.0.0'
+ self._createAcceptor(fallback_host, port)
+ else:
+ raise
+
self._prepareXMLRPCBinding()
self._prepareJSONRPCBinding()
self._connectToBroker()
diff --git a/vdsm/protocoldetector.py b/vdsm/protocoldetector.py
index a4aabae..882d671 100644
--- a/vdsm/protocoldetector.py
+++ b/vdsm/protocoldetector.py
@@ -30,10 +30,6 @@
def _create_socket(host, port):
addrinfo = socket.getaddrinfo(host, port,
socket.AF_UNSPEC, socket.SOCK_STREAM)
- if not addrinfo:
- raise socket.error("Could not translate address '%s:%s'"
- % (host, str(port)))
-
family, socktype, proto, _, sockaddr = addrinfo[0]
server_socket = socket.socket(family, socktype, proto)
filecontrol.set_close_on_exec(server_socket.fileno())
--
To view, visit https://gerrit.ovirt.org/52366
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If95914dd9dfc88b40887345ac9e244ee2b1e09e9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Edward Haas <edwardh at redhat.com>
More information about the vdsm-patches
mailing list