[NEW PATCH] BZ#727537 - Actually invalidate lvmCache when asked (via gerrit-bot)

Saggi Mizrahi smizrahi at redhat.com
Tue Aug 2 13:33:29 UTC 2011


New patch submitted by Saggi Mizrahi (smizrahi at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/777

commit cb6986f6ecd91fc9a2c5b1a04db4098315ddda24
Author: Saggi Mizrahi <smizrahi at redhat.com>
Date:   Tue Aug 2 15:31:12 2011 +0300

    BZ#727537 - Actually invalidate lvmCache when asked
    
    Change-Id: Ibc2456f2900852de32c66753c58b92b1c298c45b

diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index e4ee9f4..51e1dcf 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -227,14 +227,12 @@ def _updateLvmConf(conf):
             os.mkdir(VDSM_LVM_SYSTEM_DIR)
 
         with open(VDSM_LVM_CONF, "w") as lvmconf:
-            lvmconf.write(VDSM_LVM_CONF)
+            lvmconf.write(conf)
 
     except IOError, e:
         # We are not interested in exceptions here, note it and
         log.warning("Cannot create %s file %s", VDSM_LVM_CONF, str(e))
 
-
-
 def _setupLVMEnv():
     lvmenvfname = os.path.join(VAR_RUN_VDSM, "lvm.env")
     with file(lvmenvfname, "w") as lvmenv:
@@ -329,11 +327,11 @@ class LVMCache(object):
                 return self._extraCfg
 
             self._extraCfg = _buildConfig(multipath.getMPDevNamesIter())
+            _updateLvmConf(self._extraCfg)
             self._filterStale = False
 
             return self._extraCfg
 
-
     def _addExtraCfg(self, cmd, devList=None):
         newcmd = [constants.EXT_LVM, cmd[0]]
         if devList is not None:
@@ -353,6 +351,10 @@ class LVMCache(object):
     def invalidateFilter(self):
         self._filterStale = True
 
+    def invalidateCache(self):
+        self.invalidateFilter()
+        self.flush()
+
     def __init__(self):
         self._filterStale = True
         self._extraCfg = None
@@ -674,8 +676,8 @@ class LVMCache(object):
 
 _lvminfo = LVMCache()
 
-def invalidateFilter():
-    _lvminfo.invalidateFilter()
+def invalidateCache():
+    _lvminfo.invalidateCache()
 
 def _vgmknodes(vg):
     cmd = ["vgmknodes", vg]
diff --git a/vdsm/storage/sdc.py b/vdsm/storage/sdc.py
index 67c9302..f284e9b 100644
--- a/vdsm/storage/sdc.py
+++ b/vdsm/storage/sdc.py
@@ -39,12 +39,12 @@ class StorageDomainCache:
 
     def invalidateStorage(self):
         self.storageStale = True
-        lvm.invalidateFilter()
+        lvm.invalidateCache()
 
     @misc.samplingmethod
     def refreshStorage(self):
         multipath.rescan()
-        lvm.getAllVGs()
+        lvm.invalidateCache()
         self.storageStale = False
 
     def _getDomainFromCache(self, sdUUID):




More information about the vdsm-patches mailing list