Change in vdsm[master]: storage.monitor: Streamline names

nsoffer at redhat.com nsoffer at redhat.com
Thu Sep 4 22:49:47 UTC 2014


Nir Soffer has uploaded a new change for review.

Change subject: storage.monitor: Streamline names
......................................................................

storage.monitor: Streamline names

Rename internal classes using shorter names, considering the package
namespace. For example:

    storage.monitor.DomainMonitorStatus -> storage.monitor.Status

In this case the name is more correct, as this is not the status of the
single DomainMonitor object but status of one of the monitor threads.

Since DomainMonitorThread was renamed, the logger was renamed too. We do
not need muliple loggers for the DomainMonitor and the MonitorThread, so
both of them use now the Storage.Monitor logger.

Change-Id: I8eae2f8548ebd1b336df10aea7dde47a4aeabf70
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M tests/storageMonitorTests.py
M vdsm/storage/monitor.py
2 files changed, 10 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/07/32507/1

diff --git a/tests/storageMonitorTests.py b/tests/storageMonitorTests.py
index 112d739..bbd152f 100644
--- a/tests/storageMonitorTests.py
+++ b/tests/storageMonitorTests.py
@@ -25,7 +25,7 @@
 class FrozenStatusTests(VdsmTestCase):
 
     def setUp(self):
-        self.status = monitor.DomainMonitorStatus()
+        self.status = monitor.Status()
         self.frozen = monitor.FrozenStatus(self.status)
 
     def test_copy_attributes(self):
diff --git a/vdsm/storage/monitor.py b/vdsm/storage/monitor.py
index c4f5419..09f8084 100644
--- a/vdsm/storage/monitor.py
+++ b/vdsm/storage/monitor.py
@@ -31,7 +31,7 @@
 from .sdc import sdCache
 
 
-class DomainMonitorStatus(object):
+class Status(object):
     __slots__ = (
         "error", "checkTime", "valid", "readDelay", "masterMounted",
         "masterValid", "diskUtilization", "vgMdUtilization",
@@ -62,7 +62,7 @@
         self.version = -1
 
 
-class FrozenStatus(DomainMonitorStatus):
+class FrozenStatus(Status):
 
     def __init__(self, other):
         for name in other.__slots__:
@@ -76,7 +76,7 @@
 
 
 class DomainMonitor(object):
-    log = logging.getLogger('Storage.DomainMonitor')
+    log = logging.getLogger('Storage.Monitor')
 
     def __init__(self, interval):
         self._monitors = {}
@@ -101,8 +101,8 @@
             return
 
         self.log.info("Start monitoring %s", sdUUID)
-        monitor = DomainMonitorThread(weakref.proxy(self),
-                                      sdUUID, hostId, self._interval)
+        monitor = MonitorThread(weakref.proxy(self), sdUUID, hostId,
+                                self._interval)
         monitor.poolDomain = poolDomain
         monitor.start()
         # The domain should be added only after it succesfully started
@@ -158,8 +158,8 @@
                                  monitor.sdUUID)
 
 
-class DomainMonitorThread(object):
-    log = logging.getLogger('Storage.DomainMonitorThread')
+class MonitorThread(object):
+    log = logging.getLogger('Storage.Monitor')
 
     def __init__(self, domainMonitor, sdUUID, hostId, interval):
         self.thread = threading.Thread(target=self._run)
@@ -171,7 +171,7 @@
         self.hostId = hostId
         self.interval = interval
         self.firstChange = True
-        self.nextStatus = DomainMonitorStatus()
+        self.nextStatus = Status()
         self.status = FrozenStatus(self.nextStatus)
         self.isIsoDomain = None
         self.isoPrefix = None
@@ -223,7 +223,7 @@
             self.stopEvent.wait(self.interval)
 
     def _monitorDomain(self):
-        self.nextStatus = DomainMonitorStatus()
+        self.nextStatus = Status()
 
         # Pick up changes in the domain, for example, domain upgrade.
         if self._shouldRefreshDomain():


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8eae2f8548ebd1b336df10aea7dde47a4aeabf70
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list