[NEW PATCH] BZ#733373 - Remove the pool level vsm and tasks links. (via gerrit-bot)

Eduardo Warszawski ewarszaw at redhat.com
Tue Aug 30 12:52:55 UTC 2011


New patch submitted by Eduardo Warszawski (ewarszaw at redhat.com)

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

commit d910b3633ca4e16ff47edb3d6a88c13709a923aa
Author: Eduardo Warszawski <ewarszaw at redhat.com>
Date:   Sun Aug 28 17:49:32 2011 +0300

    BZ#733373 - Remove the pool level vsm and tasks links.
    
    As verified by the previous version of this patch, the pool level
    links to the tasks and vms are superflous, dangerous and can
    prevent spm restart.
    Since they are unused, best if they are not created at all.
    cleanupSpmLinks() removed so it can't fail.
    _createSpmLinks() removed too.
    
    Change-Id: Id16baf5c23a7b71f25030c0443710f9412252367

diff --git a/vdsm/storage/spm.py b/vdsm/storage/spm.py
index ae55e44..a42e726 100644
--- a/vdsm/storage/spm.py
+++ b/vdsm/storage/spm.py
@@ -152,8 +152,7 @@ class SPM:
     # spm object when it is not started (not acting as an SPM for a pool)
     whitelist = ['start', 'public_getSpmStatus', 'isActive', '__cleanupSPM',
                 'public_fenceSpmStorage',  '__releaseLocks', 'public_spmStop',
-                '__cleanupMasterMount', '__cleanupSPMLinks',
-                '_createSpmLinks', 'prepareForShutdown']
+                '__cleanupMasterMount', 'prepareForShutdown']
 
     log = logging.getLogger("Storage.SPM")
     lock = threading.Lock()
@@ -169,7 +168,6 @@ class SPM:
         """
         Secure.setUnsafe()
         self.__overrideMethods()
-        self.__cleanupSPMLinks()
         self.__cleanupMasterMount()
         self.__releaseLocks()
 
@@ -178,7 +176,7 @@ class SPM:
         self.pools = hsm.HSM.pools
         self.lver = 0
         self.spmRole = SPM_FREE
-        self.tasksDir = None
+        self.tasksDir = os.path.join(sp.POOL_MASTER_DOMAIN, sd.MASTER_FS_DIR, sd.TASKS_DIR)
         self._goingDown = False
 
         self._domainsToUpgrade = []
@@ -191,7 +189,6 @@ class SPM:
         # TBD: what about running tasks? persist and die?
         self.__cleanupMasterMount()
         self.__releaseLocks()
-        self.__cleanupSPMLinks()
 
         # Stop spmMailer thread
         for spUUID in self.pools:
@@ -217,19 +214,6 @@ class SPM:
             else:
                 cls.log.debug("master `%s` is not mounted, skipping", master)
 
-    @classmethod
-    def __cleanupSPMLinks(cls):
-        """
-        Cleanup All SPM related links.
-        """
-        vms = glob.glob(os.path.join(cls.storage_repository, constants.UUID_GLOB_PATTERN, sd.VMS_DIR))
-        tasks = glob.glob(os.path.join(cls.storage_repository, constants.UUID_GLOB_PATTERN, sd.TASKS_DIR))
-        cls.log.debug("cleaning links; %s %s", vms, tasks)
-        for d in vms:
-            os.unlink(d)
-        for d in tasks:
-            os.unlink(d)
-
 
     def __overrideMethods(self):
         """
@@ -316,13 +300,6 @@ class SPM:
         :type pool: :class:`sd.StoragePool`
         """
         self.log.debug("cleaning up SPM: %s" % pool.spUUID)
-        vmslink = os.path.join(pool.poolPath, sd.VMS_DIR)
-        if os.path.lexists(vmslink):
-            os.remove(vmslink)
-        taskslink = os.path.join(pool.poolPath, sd.TASKS_DIR)
-        if os.path.lexists(taskslink):
-            os.remove(taskslink)
-        self.tasksDir = None
         if  self.pools.has_key(pool.spUUID):
             if self.pools[pool.spUUID].spmMailer:
                 self.pools[pool.spUUID].spmMailer.stop()
@@ -520,7 +497,6 @@ class SPM:
 
                 masterDom.mountMaster()
                 masterDom.createMasterTree(log=True)
-                self._createSpmLinks(pool.poolPath)
 
                 try:
                     # Make sure backup domain is active
@@ -565,24 +541,6 @@ class SPM:
             self.lock.release()
 
 
-    def _createSpmLinks(self, poolPath):
-        """
-        Create links on SPM host
-        """
-        vmslink = os.path.join(poolPath, sd.VMS_DIR)
-        if os.path.lexists(vmslink):
-            os.remove(vmslink)
-        vms = os.path.join(sp.POOL_MASTER_DOMAIN, sd.MASTER_FS_DIR, sd.VMS_DIR)
-        os.symlink(vms, vmslink)
-
-        taskslink = os.path.join(poolPath, sd.TASKS_DIR)
-        if os.path.lexists(taskslink):
-            os.remove(taskslink)
-        tasks = os.path.join(sp.POOL_MASTER_DOMAIN, sd.MASTER_FS_DIR, sd.TASKS_DIR)
-        os.symlink(tasks, taskslink)
-        self.tasksDir = taskslink
-
-
     def public_spmStop(self, spUUID, options = None):
         """
         Stops the SPM functionality.




More information about the vdsm-patches mailing list