[NEW PATCH] BZ#721356 - Use delay to actually check the delay (via gerrit-bot)

Saggi Mizrahi smizrahi at redhat.com
Wed Jul 20 15:58:30 UTC 2011


New patch submitted by Saggi Mizrahi (smizrahi at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/727

commit bd4c21363d5d5c5c4939593783f78ad0d6687ed2
Author: Saggi Mizrahi <smizrahi at redhat.com>
Date:   Tue Jul 19 15:35:28 2011 +0300

    BZ#721356 - Use delay to actually check the delay
    
    Change-Id: I81a737d1ce11de94a488a02b9ab3c6afdd35254d

diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py
index 0c00dd3..2b9f455 100644
--- a/vdsm/storage/blockSD.py
+++ b/vdsm/storage/blockSD.py
@@ -354,6 +354,12 @@ class BlockStorageDomain(sd.StorageDomain):
 
         return bsd
 
+    def getReadDelay(self):
+        with fileUtils.open_ex(lvm.lvPath(self.sdUUID, sd.METADATA), "dr") as f:
+            t = time.time()
+            f.read(4096)
+            return time.time() - t
+
 
     def produceVolume(self, imgUUID, volUUID):
         """
diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py
index 8b40a59..39a9ae7 100644
--- a/vdsm/storage/fileSD.py
+++ b/vdsm/storage/fileSD.py
@@ -23,6 +23,7 @@ import outOfProcess as oop
 from processPool import Timeout
 from persistentDict import PersistentDict, DictValidator
 import constants
+import time
 
 REMOTE_PATH = "REMOTE_PATH"
 
@@ -127,6 +128,11 @@ class FileStorageDomain(sd.StorageDomain):
                 REMOTE_PATH : remotePath
                 })
 
+    def getReadDelay(self):
+        t = time.time()
+        processPoolDict[self.sdUUID].directReadLines(self.metafile)
+        return time.time() - t
+
     def produceVolume(self, imgUUID, volUUID):
         """
         Produce a type specific volume object
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 8aed3e6..1ddc3db 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -91,10 +91,11 @@ class StatsThread(threading.Thread):
     def run(self):
         while self._statsletrun:
             try:
-                start = time.time()
+                delay = 0
                 if self._domain is None:
                     self._domain = SDF.produce(self._sdUUID)
                 stats, code = self._statsfunc(self._domain)
+                delay = self._domain.getReadDelay()
             except se.StorageException, e:
                 self.log.error("Unexpected error", exc_info=True)
                 code = e.code
@@ -109,7 +110,7 @@ class StatsThread(threading.Thread):
 
             stats['finish'] = finish
             stats['result'] = dict(code=code, lastCheck=finish,
-                delay=str(finish - start), valid=(code == 0))
+                delay=str(delay), valid=(code == 0))
 
             try:
                 if self._statscache["result"]["valid"] != stats["result"]["valid"]:




More information about the vdsm-patches mailing list