Change in vdsm[master]: ssl: runtime config to choose implementation

piotr.kliczewski at gmail.com piotr.kliczewski at gmail.com
Tue Aug 11 12:35:25 UTC 2015


Piotr Kliczewski has uploaded a new change for review.

Change subject: ssl: runtime config to choose implementation
......................................................................

ssl: runtime config to choose implementation

During build process we can choose to use standard ssl module or both
m2crypto and ssl module. First option is dedicated enable debian support
whereas second options make it possible to choose an implementation by
setting ssl_impl config value to m2c or ssl.


Change-Id: I9881d11e30ced9c34bfe602bba3d968f57e0fe15
Signed-off-by: pkliczewski <piotr.kliczewski at gmail.com>
---
M lib/vdsm/config.py.in
M lib/vdsm/jsonrpcvdscli.py
M lib/vdsm/vdscli.py
M lib/yajsonrpc/stompreactor.py
M vdsm.spec.in
M vdsm/clientIF.py
M vdsm/kaxmlrpclib.py
M vdsm/protocoldetector.py
M vdsm/virt/migration.py
9 files changed, 37 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/89/44689/1

diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index 8f2e519..6f5a719 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -203,6 +203,9 @@
 
         ('connection_stats_timeout', '3600',
             'Time in seconds defining how frequently we log transport stats'),
+
+        ('ssl_impl', 'm2c',
+            'Specifies which ssl impl should be used. m2c by default'),
     ]),
 
     # Section: [mom]
diff --git a/lib/vdsm/jsonrpcvdscli.py b/lib/vdsm/jsonrpcvdscli.py
index 8d8aa0a..ae8965a 100644
--- a/lib/vdsm/jsonrpcvdscli.py
+++ b/lib/vdsm/jsonrpcvdscli.py
@@ -30,7 +30,10 @@
 from vdsm import response
 from .config import config
 try:
-    from . import m2cutils as sslutils
+    if config.get('vars', 'ssl_impl') == 'm2c':
+        from . import m2cutils as sslutils
+    else:
+        from . import sslutils
 except ImportError:
     from . import sslutils
 
diff --git a/lib/vdsm/vdscli.py b/lib/vdsm/vdscli.py
index cf083e3..e655c0d 100644
--- a/lib/vdsm/vdscli.py
+++ b/lib/vdsm/vdscli.py
@@ -26,8 +26,12 @@
 import re
 import sys
 from xml.parsers.expat import ExpatError
+from .config import config
 try:
-    from . import m2cutils as sslutils
+    if config.get('vars', 'ssl_impl') == 'm2c':
+        from . import m2cutils as sslutils
+    else:
+        from . import sslutils
 except ImportError:
     from . import sslutils
 
diff --git a/lib/yajsonrpc/stompreactor.py b/lib/yajsonrpc/stompreactor.py
index b1eda30..4cab4aa 100644
--- a/lib/yajsonrpc/stompreactor.py
+++ b/lib/yajsonrpc/stompreactor.py
@@ -27,7 +27,10 @@
 from . import stomp
 from .betterAsyncore import Dispatcher, Reactor
 try:
-    from vdsm.m2cutils import SSLSocket
+    if config.get('vars', 'ssl_impl') == 'm2c':
+        from vdsm.m2cutils import SSLSocket
+    else:
+        from ssl import SSLSocket
 except ImportError:
     from ssl import SSLSocket
 
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 33e89e1..851c0d3 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -42,7 +42,8 @@
 %global _polkitdir %{_localstatedir}/lib/polkit-1/localauthority/10-vendor.d
 %endif
 
-# enable m2crypto by default
+# 0 - enabled ssl
+# 1 - enabled both implementations by default
 %global with_m2c 1
 
 # Gluster should not be shipped with RHEV
@@ -1071,7 +1072,7 @@
 %{python_sitelib}/%{vdsm_name}/schedule.py*
 %if %{with_m2c}
 %{python_sitelib}/%{vdsm_name}/m2cutils.py*
-%exclude %{python_sitelib}/%{vdsm_name}/sslutils.py*
+%{python_sitelib}/%{vdsm_name}/sslutils.py*
 %else
 %exclude %{python_sitelib}/%{vdsm_name}/m2cutils.py*
 %{python_sitelib}/%{vdsm_name}/sslutils.py*
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index 043383a..0020a1c 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -55,7 +55,10 @@
 from virt.vmdevices import hwclass
 from virt.utils import isVdsmImage
 try:
-    from vdsm import m2cutils as sslutils
+    if config.get('vars', 'ssl_impl') == 'm2c':
+        from vdsm import m2cutils as sslutils
+    else:
+        from vdsm import sslutils
 except ImportError:
     from vdsm import sslutils
 try:
diff --git a/vdsm/kaxmlrpclib.py b/vdsm/kaxmlrpclib.py
index b0640e8..d43230f 100644
--- a/vdsm/kaxmlrpclib.py
+++ b/vdsm/kaxmlrpclib.py
@@ -109,9 +109,13 @@
     _connection_class = TcpkeepHTTPConnection
 
 ###################
+from vdsm.config import config
 # the same, for ssl
 try:
-    from vdsm import m2cutils as sslutils
+    if config.get('vars', 'ssl_impl') == 'm2c':
+        from vdsm import m2cutils as sslutils
+    else:
+        from vdsm import sslutils
 except ImportError:
     from vdsm import sslutils
 import ssl
diff --git a/vdsm/protocoldetector.py b/vdsm/protocoldetector.py
index dbdc730..d06fb3d 100644
--- a/vdsm/protocoldetector.py
+++ b/vdsm/protocoldetector.py
@@ -23,9 +23,13 @@
 
 import vdsm.infra.filecontrol as filecontrol
 
+from vdsm.config import config
 from vdsm.utils import monotonic_time
 try:
-    from vdsm.m2cutils import SSLHandshakeDispatcher
+    if config.get('vars', 'ssl_impl') == 'm2c':
+        from vdsm.m2cutils import SSLHandshakeDispatcher
+    else:
+        from vdsm.sslutils import SSLHandshakeDispatcher
 except ImportError:
     from vdsm.sslutils import SSLHandshakeDispatcher
 
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index 797002c..2de8fd5 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -40,7 +40,10 @@
 from . import vmstatus
 
 try:
-    from vdsm import m2cutils as sslutils
+    if config.get('vars', 'ssl_impl') == 'm2c':
+        from vdsm import m2cutils as sslutils
+    else:
+        from vdsm import sslutils
 except ImportError:
     from vdsm import sslutils
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9881d11e30ced9c34bfe602bba3d968f57e0fe15
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski at gmail.com>


More information about the vdsm-patches mailing list