Assaf Muller has uploaded a new change for review.
Change subject: [3/x] Bugfix: Return lastClientIface for *current* connection
......................................................................
[3/x] Bugfix: Return lastClientIface for *current* connection
Change-Id: I36e48cc07a27f44a2b413f0e9159110404f1b0ca
Signed-off-by: Assaf Muller <amuller(a)redhat.com>
---
M vdsm/BindingXMLRPC.py
1 file changed, 15 insertions(+), 19 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/22837/1
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index 1ffed25..2364684 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -80,6 +80,15 @@
self._thread.join()
return {'status': doneCode}
+ def updateTimestamp(self):
+ # FIXME: The setup+editNetwork API uses this log file to
+ # determine if this host is still accessible. We use a
+ # file (rather than an event) because setup+editNetwork is
+ # performed by a separate, root process. To clean this
+ # up we need to move this to an API wrapper that is only
+ # run for real clients (not vdsm internal API calls).
+ file(constants.P_VDSM_CLIENT_LOG, 'w')
+
def _getKeyCertFilenames(self):
"""
Get the locations of key and certificate files.
@@ -97,26 +106,13 @@
threadLocal = self.cif.threadLocal
- class LoggingMixIn:
-
- def log_request(self, code='-', size='-'):
- """Track from where client connections are
coming."""
- self.server.lastClient = self.client_address[0]
- # FIXME: The editNetwork API uses this log file to
- # determine if this host is still accessible. We use a
- # file (rather than an event) because editNetwork is
- # performed by a separate, root process. To clean this
- # up we need to move this to an API wrapper that is only
- # run for real clients (not vdsm internal API calls).
- file(constants.P_VDSM_CLIENT_LOG, 'w')
-
server_address = (self.serverIP, int(self.serverPort))
if self.enableSSL:
basehandler = SecureXMLRPCServer.SecureXMLRPCRequestHandler
else:
basehandler = SimpleXMLRPCServer.SimpleXMLRPCRequestHandler
- class LoggingHandler(LoggingMixIn, basehandler):
+ class LoggingHandler(basehandler):
def setup(self):
threadLocal.client = self.client_address[0]
return basehandler.setup(self)
@@ -140,13 +136,12 @@
requestHandler=LoggingHandler, logRequests=True)
utils.closeOnExec(server.socket.fileno())
- server.lastClient = '0.0.0.0'
-
return server
def _registerFunctions(self):
def wrapIrsMethod(f):
def wrapper(*args, **kwargs):
+ self.updateTimestamp()
fmt = ""
logargs = []
@@ -298,10 +293,10 @@
def getCapabilities(self):
api = API.Global()
ret = api.getCapabilities()
- last = self.server.lastClient
ret['info']['management_ip'] = self.serverIP
- ret['info']['lastClient'] = last
- ret['info']['lastClientIface'] =
getRouteDeviceTo(destinationIP=last)
+ ret['info']['lastClient'] = self.cif.threadLocal.client
+ ret['info']['lastClientIface'] = getRouteDeviceTo(
+ destinationIP=self.cif.threadLocal.client)
return ret
def getHardwareInfo(self):
@@ -943,6 +938,7 @@
def wrapApiMethod(f):
def wrapper(*args, **kwargs):
try:
+ f.im_self.updateTimestamp()
logLevel = logging.DEBUG
if f.__name__ in ('getVMList', 'getAllVmStats',
'getStats',
'fenceNode'):
--
To view, visit
http://gerrit.ovirt.org/22837
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I36e48cc07a27f44a2b413f0e9159110404f1b0ca
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Assaf Muller <amuller(a)redhat.com>