Nir Soffer has uploaded a new change for review.

Change subject: sslutils: Document M2Crypto threading initialization
......................................................................

sslutils: Document M2Crypto threading initialization

As documented and painfully recognized long ago in, using M2Crypto in a
multi-threaded server such as Vdsm requires explicit initialization.

M2Crypto was initialized but the code was not docuemnted properly. This
lead to the initialization being removed in this patch:
http://gerrit.ovirt.org/28858/4/lib/vdsm/verifyingtransport.py

Hopefully, improved documentation and moving it to the sslutils module
will prevent such attempts in the future.

Change-Id: I8e5f8dc4662e16ba7e39f60336819750e1366124
Relates-to: 
http://www.heikkitoivonen.net/m2crypto/api/M2Crypto.threading-module.html
Relates-to: https://bugzilla.redhat.com/482420
Signed-off-by: Nir Soffer <nsof...@redhat.com>
---
M lib/vdsm/SecureXMLRPCServer.py
M lib/vdsm/sslutils.py
2 files changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/04/29104/1

diff --git a/lib/vdsm/SecureXMLRPCServer.py b/lib/vdsm/SecureXMLRPCServer.py
index a29dc03..bbff2b9 100644
--- a/lib/vdsm/SecureXMLRPCServer.py
+++ b/lib/vdsm/SecureXMLRPCServer.py
@@ -35,12 +35,10 @@
 import SocketServer
 import logging
 
-import M2Crypto
 from sslutils import SSLServerSocket
 
 from .utils import IPXMLRPCRequestHandler, IPXMLRPCServer
 
-M2Crypto.threading.init()
 
 SecureXMLRPCRequestHandler = IPXMLRPCRequestHandler
 
diff --git a/lib/vdsm/sslutils.py b/lib/vdsm/sslutils.py
index f388f32..7ac59c7 100644
--- a/lib/vdsm/sslutils.py
+++ b/lib/vdsm/sslutils.py
@@ -18,8 +18,13 @@
 # Refer to the README and COPYING files for full details of the license
 #
 
+from M2Crypto import SSL, X509, threading
+
+# M2Crypto.threading needs initialization.
+# See https://bugzilla.redhat.com/482420
+threading.init()
+
 import socket
-from M2Crypto import SSL, X509
 
 
 class SSLSocket(object):


-- 
To view, visit http://gerrit.ovirt.org/29104
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e5f8dc4662e16ba7e39f60336819750e1366124
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsof...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to