Change in vdsm[master]: sampling.ImagePathStatus: drop dead thread

danken at redhat.com danken at redhat.com
Sat Nov 2 22:31:56 UTC 2013


Dan Kenigsberg has uploaded a new change for review.

Change subject: sampling.ImagePathStatus: drop dead thread
......................................................................

sampling.ImagePathStatus: drop dead thread

In pre-historic rhev-2.1 days, ImagePathStatus thread was used to
collect and cache information about the image repository accessibility.
However, this code was never used by ovirt-3.y.

By default, images_check_times is set to 0, meaning that the
sampling.ImagePathStatus thread is never started. It is highly unlikely
that there's a secret vdsm client out there that explicitly turns on
this monitoring thread and read the 'storageDomains' element out of
getVdsStats.

Change-Id: I682d9730ac087e0a24ba5c72dbac912c87a6452f
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
---
M lib/vdsm/config.py.in
M vdsm/sampling.py
M vdsm_api/vdsmapi-schema.json
3 files changed, 0 insertions(+), 52 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/20812/1

diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in
index c0bdd53..c8ce7e6 100644
--- a/lib/vdsm/config.py.in
+++ b/lib/vdsm/config.py.in
@@ -194,9 +194,6 @@
 
         ('irsd', '%(images)s/irsd', None),
 
-        ('images_check_times', '0',
-            'Image repository check period (seconds).'),
-
         ('volume_utilization_percent', '50', None),
 
         ('volume_utilization_chunk_mb', '1024', None),
diff --git a/vdsm/sampling.py b/vdsm/sampling.py
index 851034d..aafb942 100644
--- a/vdsm/sampling.py
+++ b/vdsm/sampling.py
@@ -36,7 +36,6 @@
 from vdsm import utils
 from vdsm import netinfo
 from vdsm.constants import P_VDSM_RUN
-from vdsm.config import config
 
 _THP_STATE_PATH = '/sys/kernel/mm/transparent_hugepage/enabled'
 if not os.path.exists(_THP_STATE_PATH):
@@ -478,12 +477,10 @@
     def __init__(self, cif, log, ifids, ifrates):
         self.startTime = time.time()
         StatsThread.__init__(self, log, ifids, ifrates)
-        self._imagesStatus = ImagePathStatus(cif)
         self._pid = os.getpid()
         self._ncpus = max(os.sysconf('SC_NPROCESSORS_ONLN'), 1)
 
     def stop(self):
-        self._imagesStatus.stop()
         StatsThread.stop(self)
 
     def _updateIfRates(self, hs0, hs1):
@@ -504,18 +501,7 @@
         stats = StatsThread.get(self)
         stats['cpuSysVdsmd'] = stats['cpuUserVdsmd'] = 0.0
         stats['storageDomains'] = {}
-        if self._imagesStatus._cif.irs:
-            self._imagesStatus._refreshStorageDomains()
         now = time.time()
-        for sd, d in self._imagesStatus.storageDomains.iteritems():
-            stats['storageDomains'][sd] = {
-                'code': d['code'],
-                'delay': d['delay'],
-                'lastCheck': d['lastCheck'],
-                'valid': d['valid'],
-                'version': d['version'],
-                'acquired': d['acquired'],
-            }
         stats['elapsedTime'] = int(now - self.startTime)
         if len(self._samples) < 2:
             return stats
@@ -539,35 +525,3 @@
         stats['diskStats'] = hs1.diskStats
         stats['thpState'] = hs1.thpState
         return stats
-
-
-class ImagePathStatus(threading.Thread):
-    def __init__(self, cif, interval=None):
-        if interval is None:
-            interval = config.getint('irs', 'images_check_times')
-        self._interval = interval
-        self._cif = cif
-        self.storageDomains = {}
-        self._stopEvent = threading.Event()
-        threading.Thread.__init__(self, name='ImagePathStatus')
-        if self._interval > 0:
-            self.start()
-
-    def stop(self):
-        self._stopEvent.set()
-
-    def _refreshStorageDomains(self):
-        self.storageDomains = self._cif.irs.repoStats()
-        del self.storageDomains["status"]
-        if "args" in self.storageDomains:
-            del self.storageDomains["args"]
-
-    def run(self):
-        try:
-            while not self._stopEvent.isSet():
-                if self._cif.irs:
-                    self._refreshStorageDomains()
-                self._stopEvent.wait(self._interval)
-        except:
-            logging.error("Error while refreshing storage domains",
-                          exc_info=True)
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index 0281c4d..72848f8 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -1569,8 +1569,6 @@
 #
 # @cpuUserVdsmd:    Ratio of CPU time spent in userspace by vdsm
 #
-# @storageDomains:  Storage Domain vital statistics
-#
 # @elapsedTime:     The number of seconds that vdsm has been running
 #
 # @memUsed:         The percentage of memory used (not including caches)
@@ -1628,7 +1626,6 @@
            'network': 'HostNetworkInterfaceStatsMap',
            'rxDropped': 'uint', 'txDropped': 'uint',
            'cpuSysVdsmd': 'float', 'cpuUserVdsmd': 'float',
-           'storageDomains': 'StorageDomainVitalsMap',
            'elapsedTime': 'uint', 'memUsed': 'uint',
            'anonHugePages': 'uint', 'cpuLoad': 'float',
            'diskStats': 'PathStatsMap', 'thpState': 'THPStates',


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I682d9730ac087e0a24ba5c72dbac912c87a6452f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>


More information about the vdsm-patches mailing list