Federico Simoncelli has uploaded a new change for review.

Change subject: stats: compute the iso prefix asynchronously
......................................................................

stats: compute the iso prefix asynchronously

The iso prefix must be computed asynchronously because in any other
synchronous operation (e.g.: connectStoragePool, getInfo) vdsm cannot
risk to stop and wait for the iso domain to report its prefix (since
it might be unreachable).

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=880098
Change-Id: I09b7be78da544547a6ed9d5b440bdb0037004c16
Signed-off-by: Federico Simoncelli <[email protected]>
---
M vdsm/storage/domainMonitor.py
M vdsm/storage/sp.py
2 files changed, 18 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/05/10305/1

diff --git a/vdsm/storage/domainMonitor.py b/vdsm/storage/domainMonitor.py
index 6f333ee..a99bb2a 100644
--- a/vdsm/storage/domainMonitor.py
+++ b/vdsm/storage/domainMonitor.py
@@ -33,6 +33,7 @@
         "error", "lastCheck", "valid", "readDelay", "masterMounted",
         "masterValid", "diskUtilization", "vgMdUtilization",
         "vgMdHasEnoughFreeSpace", "vgMdFreeBelowThreashold", "hasHostId",
+        "isoPrefix",
     )
 
     def __init__(self):
@@ -53,6 +54,11 @@
         self.vgMdUtilization = (0, 0)
         self.vgMdHasEnoughFreeSpace = True
         self.vgMdFreeBelowThreashold = True
+        # The iso prefix is computed asynchronously because in any
+        # synchronous operation (e.g.: connectStoragePool, getInfo)
+        # we cannot risk to stop and wait for the iso domain to
+        # report its prefix (it might be unreachable).
+        self.isoPrefix = None
 
     def update(self, st):
         for attr in self.__slots__:
@@ -124,6 +130,7 @@
         self.status = DomainMonitorStatus()
         self.nextStatus = DomainMonitorStatus()
         self.isIsoDomain = None
+        self.isoPrefix = None
         self.lastRefresh = time()
         self.refreshTime = \
                     config.getint("irs", "repo_stats_cache_refresh_timeout")
@@ -180,8 +187,12 @@
             # the domain is deactivated.
             if self.domain is None:
                 self.domain = sdCache.produce(self.sdUUID)
+
             if self.isIsoDomain is None:
-                self.isIsoDomain = self.domain.isISO()
+                isIsoDomain = self.domain.isISO()
+                if isIsoDomain:
+                    self.isoPrefix = self.domain.getIsoDomainImagesDir()
+                self.isIsoDomain = isIsoDomain
 
             self.domain.selftest()
 
@@ -202,6 +213,7 @@
             self.nextStatus.masterMounted = masterStats['mount']
 
             self.nextStatus.hasHostId = self.domain.hasHostId(self.hostId)
+            self.nextStatus.isoPrefix = self.isoPrefix
 
         except Exception, e:
             self.log.error("Error while collecting domain %s monitoring "
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 4c9d253..f02af7b 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1384,6 +1384,8 @@
                     'mount': domStatus.masterMounted,
                     'valid': domStatus.masterValid
                 },
+
+                'isoprefix': domStatus.isoPrefix,
             }
 
         return repoStats
@@ -1425,19 +1427,11 @@
             # Return statistics for active domains only
             domInfo[sdUUID] = {'status': sdStatus, 'alerts': []}
 
-            if sdStatus != sd.DOM_ACTIVE_STATUS:
+            if sdStatus != sd.DOM_ACTIVE_STATUS or sdUUID not in repoStats:
                 continue
 
-            try:
-                dom = sdCache.produce(sdUUID)
-                if dom.isISO():
-                    poolInfo['isoprefix'] = dom.getIsoDomainImagesDir()
-            except:
-                self.log.warn("Could not get full domain information, "
-                              "it is probably unavailable", exc_info=True)
-
-            if sdUUID not in repoStats:
-                continue
+            if repoStats[sdUUID]['isoprefix']:
+                poolInfo['isoprefix'] = repoStats[sdUUID]['isoprefix']
 
             # For unreachable domains repoStats will return disktotal and
             # diskfree as None.


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

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

Reply via email to