Change in vdsm[master]: net: Enable VDSM to perform migration over IPv6

edwardh at redhat.com edwardh at redhat.com
Sun Jan 17 15:30:14 UTC 2016


Edward Haas has uploaded a new change for review.

Change subject: net: Enable VDSM to perform migration over IPv6
......................................................................

net: Enable VDSM to perform migration over IPv6

As part of adding support for IPv6, this patch adds the ability
to perform a VM migration process over IPv6 addresses.

Change-Id: Id12e6df9004737ea6eec450d2e07cbb10aaa104a
Signed-off-by: Edward Haas <edwardh at redhat.com>
---
M tests/vdsClientTests.py
M vdsm/virt/migration.py
2 files changed, 13 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/33/51933/2

diff --git a/tests/vdsClientTests.py b/tests/vdsClientTests.py
index 1ad9673..30aec8e 100644
--- a/tests/vdsClientTests.py
+++ b/tests/vdsClientTests.py
@@ -493,6 +493,10 @@
         self._assertIsIpAddressWithPort(
             vdscli.cannonizeHostPort('127.0.0.1'))
 
+    def test_ipv6_address_no_port(self):
+        self._assertIsIpAddressWithPort(
+            vdscli.cannonizeHostPort('[fe80::fc54:ff:fea2:a80]'))
+
     def testAddressWithPort(self):
         address = "127.0.0.1:65432"
         self.assertEqual(address, vdscli.cannonizeHostPort(address))
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index 948bb02..9ed4a9e 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -126,8 +126,15 @@
 
     def _createClient(self, port):
         sslctx = sslutils.create_ssl_context()
-        client_socket = utils.create_connected_socket(
-            self.remoteHost, int(port), sslctx)
+
+        # TODO: In future patch, move to an ipv6 tool module.
+        def is_ipv6_address(a):
+            return a.count(':') and a.startswith('[') and a.endswith(']')
+
+        host = self.remoteHost[1:-1] \
+            if is_ipv6_address(self.remoteHost) else self.remoteHost
+
+        client_socket = utils.create_connected_socket(host, int(port), sslctx)
         return self._vm.cif.createStompClient(client_socket)
 
     def _setupVdsConnection(self):


-- 
To view, visit https://gerrit.ovirt.org/51933
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id12e6df9004737ea6eec450d2e07cbb10aaa104a
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Edward Haas <edwardh at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>


More information about the vdsm-patches mailing list