Change in vdsm[ovirt-3.3]: domainMonitor: Separate change detection from lastCheck value

nsoffer at redhat.com nsoffer at redhat.com
Mon Dec 9 16:33:04 UTC 2013


Hello Ayal Baron, Federico Simoncelli, Allon Mureinik, Liron Ar,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/22209

to review the following change.

Change subject: domainMonitor: Separate change detection from lastCheck value
......................................................................

domainMonitor: Separate change detection from lastCheck value

Since commit 45f3037ca1e, lastCheck value is initialized to special
NOT_CHECKED_YET value, and used for detecting the first monitor status change.
This change caused repoStats to return high lastCheck value until the first
monitor check is done, causing host activation to fail, and host becoming
non-operational.

Previously, lastCheck value was initialized to monitor thread creation time,
and repoStats was returning valid lastCheck value even before the first domain
check was finished. While somewhat incorrect, this behavior is required for
engine monitoring logic.

This patch restore the previous lastCheck semantics and use a new
firstChange flag for detecting the first status change.

Change-Id: I8e0df2ee0333354146b5d9429fd83a4f914ff751
Relates-To: https://bugzilla.redhat.com/1003588
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/21878
Reviewed-by: Allon Mureinik <amureini at redhat.com>
Reviewed-by: Liron Ar <laravot at redhat.com>
Reviewed-by: Ayal Baron <abaron at redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce at redhat.com>
---
M vdsm/storage/domainMonitor.py
1 file changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/09/22209/1

diff --git a/vdsm/storage/domainMonitor.py b/vdsm/storage/domainMonitor.py
index ac01e8b..d95f133 100644
--- a/vdsm/storage/domainMonitor.py
+++ b/vdsm/storage/domainMonitor.py
@@ -27,8 +27,6 @@
 from vdsm.config import config
 from sdc import sdCache
 
-NOT_CHECKED_YET = -1
-
 
 class DomainMonitorStatus(object):
     __slots__ = (
@@ -43,7 +41,7 @@
 
     def clear(self):
         self.error = None
-        self.lastCheck = NOT_CHECKED_YET
+        self.lastCheck = time()
         self.valid = True
         self.readDelay = 0
         self.diskUtilization = (None, None)
@@ -133,6 +131,7 @@
         self.sdUUID = sdUUID
         self.hostId = hostId
         self.interval = interval
+        self.firstChange = True
         self.status = DomainMonitorStatus()
         self.nextStatus = DomainMonitorStatus()
         self.isIsoDomain = None
@@ -244,6 +243,8 @@
                 self.log.warn("Could not emit domain state change event",
                               exc_info=True)
 
+        self.firstChange = False
+
         # An ISO domain can be shared by multiple pools
         if (not self.isIsoDomain and self.nextStatus.valid
                 and self.nextStatus.hasHostId is False):
@@ -257,5 +258,4 @@
         self.status.update(self.nextStatus)
 
     def _statusDidChange(self):
-        return (self.status.lastCheck == NOT_CHECKED_YET or
-                self.status.valid != self.nextStatus.valid)
+        return self.firstChange or self.status.valid != self.nextStatus.valid


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8e0df2ee0333354146b5d9429fd83a4f914ff751
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Liron Ar <laravot at redhat.com>


More information about the vdsm-patches mailing list