Dan Kenigsberg has uploaded a new change for review.

Change subject: cleanup: move _updateTimestamp to API.py
......................................................................

cleanup: move _updateTimestamp to API.py

After Engine issues a setupNetworks or editNetwork API calls, it follows
by repeated ping() calls. If networking has been configured correctly,
the ping() is processed by Vdsm, and _updateTimestamp notifies helper
tools that the network configuration should not be rolled back.

This patch extends this behavior to all users of the API, not only XMLRPC.

Ancient Engines used to call getVdsCaps() instead of the lightweight
ping(). Even older Engines did nothing special and depended on its
periodic list() call. For backward compatibility, we add
_updateTimestamp on these specific verbs, too.

Change-Id: I4270df333ff5ff56e4375742cdc526ec76ed3bf1
Signed-off-by: Dan Kenigsberg <[email protected]>
---
M vdsm/API.py
M vdsm/BindingXMLRPC.py
2 files changed, 13 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/23050/1

diff --git a/vdsm/API.py b/vdsm/API.py
index 3cf3133..e4a3f7f 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1069,6 +1069,14 @@
     def __init__(self):
         APIBase.__init__(self)
 
+    @staticmethod
+    def _updateTimestamp():
+        # 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.
+        file(constants.P_VDSM_CLIENT_LOG, 'w')
+
     # General Host functions
     def fenceNode(self, addr, port, agent, username, password, action,
                   secure=False, options=''):
@@ -1154,12 +1162,14 @@
 
     def ping(self):
         "Ping the server. Useful for tests"
+        self._updateTimestamp()
         return {'status': doneCode}
 
     def getCapabilities(self):
         """
         Report host capabilities.
         """
+        self._updateTimestamp()
         c = caps.get()
         c['netConfigDirty'] = str(self._cif._netConfigDirty)
 
@@ -1256,6 +1266,9 @@
                 return d
             else:
                 return {'vmId': d['vmId'], 'status': d['status']}
+
+        self._updateTimestamp()
+
         # To improve complexity, convert 'vms' to set(vms)
         vmSet = set(vmList)
         return {'status': doneCode,
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index 56eefa6..43e84ce 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -80,16 +80,6 @@
         self._thread.join()
         return {'status': doneCode}
 
-    @staticmethod
-    def updateTimestamp():
-        # 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.
@@ -142,7 +132,6 @@
     def _registerFunctions(self):
         def wrapIrsMethod(f):
             def wrapper(*args, **kwargs):
-                BindingXMLRPC.updateTimestamp()
                 fmt = ""
                 logargs = []
 
@@ -939,7 +928,6 @@
 def wrapApiMethod(f):
     def wrapper(*args, **kwargs):
         try:
-            BindingXMLRPC.updateTimestamp()
             logLevel = logging.DEBUG
             if f.__name__ in ('getVMList', 'getAllVmStats', 'getStats',
                               'fenceNode'):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4270df333ff5ff56e4375742cdc526ec76ed3bf1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to