Change in vdsm[master]: xmlrpc: retry when flushing socket

piotr.kliczewski at gmail.com piotr.kliczewski at gmail.com
Fri Oct 23 08:40:21 UTC 2015


Piotr Kliczewski has uploaded a new change for review.

Change subject: xmlrpc: retry when flushing socket
......................................................................

xmlrpc: retry when flushing socket

m2crypto requires retry of write and we need to make sure that we do it once
flushing data before closing a socket. In order to do so we need to move
original implementation to our code base.


Bug-Url: https://bugzilla.redhat.com/1261255
Change-Id: I52dd6ad304a82ff6c8d3dff12a38269684abf055
Signed-off-by: pkliczewski <piotr.kliczewski at gmail.com>
---
M vdsm/rpc/bindingxmlrpc.py
1 file changed, 19 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/47637/2

diff --git a/vdsm/rpc/bindingxmlrpc.py b/vdsm/rpc/bindingxmlrpc.py
index c521cd8..9f77457 100644
--- a/vdsm/rpc/bindingxmlrpc.py
+++ b/vdsm/rpc/bindingxmlrpc.py
@@ -25,6 +25,7 @@
 import libvirt
 import threading
 import re
+import socket
 import sys
 
 from vdsm.password import (ProtectedPassword,
@@ -33,6 +34,7 @@
 from vdsm import utils
 from vdsm import xmlrpc
 from vdsm.define import doneCode, errCode
+from vdsm.m2cutils import SSL
 from vdsm.netinfo import getDeviceByIP
 import API
 from vdsm.exception import VdsmException
@@ -288,7 +290,23 @@
                 return r
 
             def finish(self):
-                xmlrpc.IPXMLRPCRequestHandler.finish(self)
+                if not self.wfile.closed:
+                    while True:
+                        try:
+                            self.wfile.flush()
+                            break
+                        except socket.error:
+                            # An final socket error may have occurred here,
+                            # such as the local error ECONNABORTED.
+                            break
+                        except SSL.SSLError as e:
+                            if e.message == 'bad write retry':
+                                continue
+                            else:
+                                break
+
+                self.wfile.close()
+                self.rfile.close()
                 threadLocal.client = None
                 threadLocal.server = None
                 threadLocal.flowID = None


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I52dd6ad304a82ff6c8d3dff12a38269684abf055
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: automation at ovirt.org


More information about the vdsm-patches mailing list