Federico Simoncelli has uploaded a new change for review.

Change subject: stats: report the domain version
......................................................................

stats: report the domain version

VDSM should provide to the engine a way to determine if a domain (other
than the master) has been upgraded or not.

Change-Id: I88884356eefcd5040deccbf34eab271be8dbc522
Signed-off-by: Federico Simoncelli <[email protected]>
---
M lib/vdsm/utils.py
M vdsm/storage/domainMonitor.py
M vdsm/storage/sp.py
M vdsm_api/vdsmapi-schema.json
4 files changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/13620/1

diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index f34f7cb..b116c37 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -607,7 +607,8 @@
             stats['storageDomains'][sd] = {'code': d['code'],
                                            'delay': d['delay'],
                                            'lastCheck': d['lastCheck'],
-                                           'valid': d['valid']}
+                                           'valid': d['valid'],
+                                           'version': d['version']}
         stats['elapsedTime'] = int(now - self.startTime)
         if len(self._samples) < 2:
             return stats
diff --git a/vdsm/storage/domainMonitor.py b/vdsm/storage/domainMonitor.py
index 9c4302b..a6a736f 100644
--- a/vdsm/storage/domainMonitor.py
+++ b/vdsm/storage/domainMonitor.py
@@ -33,7 +33,7 @@
         "error", "lastCheck", "valid", "readDelay", "masterMounted",
         "masterValid", "diskUtilization", "vgMdUtilization",
         "vgMdHasEnoughFreeSpace", "vgMdFreeBelowThreashold", "hasHostId",
-        "isoPrefix",
+        "isoPrefix", "version",
     )
 
     def __init__(self):
@@ -59,6 +59,7 @@
         # we cannot risk to stop and wait for the iso domain to
         # report its prefix (it might be unreachable).
         self.isoPrefix = None
+        self.version = 0
 
     def update(self, st):
         for attr in self.__slots__:
@@ -217,6 +218,7 @@
 
             self.nextStatus.hasHostId = self.domain.hasHostId(self.hostId)
             self.nextStatus.isoPrefix = self.isoPrefix
+            self.nextStatus.version = self.domain.getVersion()
 
         except Exception as e:
             self.log.error("Error while collecting domain %s monitoring "
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index 516d3fe..42afe66 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -1436,7 +1436,8 @@
                     'code': code,
                     'lastCheck': lastcheck,
                     'delay': str(domStatus.readDelay),
-                    'valid': (domStatus.error is None)
+                    'valid': (domStatus.error is None),
+                    'version': domStatus.version,
                 },
 
                 'disktotal': disktotal,
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 4ff8c7a..b531950 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -1412,7 +1412,7 @@
 ##
 {'type': 'StorageDomainVitals',
  'data': {'code': 'int', 'delay': 'float', 'lastCheck': 'float',
-          'valid': 'bool'}}
+          'valid': 'bool', 'version': 'int'}}
 
 ##
 # @PathStats:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I88884356eefcd5040deccbf34eab271be8dbc522
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