[NEW PATCH] BZ#717658 - Simplify SDF.produce() (via gerrit-bot)

Eduardo Warszawski ewarszaw at redhat.com
Sun Sep 18 07:22:19 UTC 2011


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

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

commit 5650f38d078ce85f105fc5c9a8742de5938c6a85
Author: Eduardo Warszawski <ewarszaw at redhat.com>
Date:   Fri Jul 1 08:04:43 2011 +0300

    BZ#717658 - Simplify SDF.produce()
    
    produce() calls lookup(),
    lookup() calls (blockSD, localFsSD, nfsSD).findDomain(),
    findDomain() calls __init__(),
    __init__() calls findDomainPath(),
    findDomainPath() will return or raise StorageDomainDoesNotExist!
    
    Never None, never a false value, no need for this check.
    
    Change-Id: I442c368a1266855b324eab96e4a7b02634984834

diff --git a/vdsm/storage/sdc.py b/vdsm/storage/sdc.py
index c44b58e..bf9c8df 100644
--- a/vdsm/storage/sdc.py
+++ b/vdsm/storage/sdc.py
@@ -86,6 +86,7 @@ class StorageDomainCache:
 
             self._cleanStaleWeakrefs()
 
+            #_findDomain will raise StorageDomainDoesNotExist if sdUUID is not found in storage.
             dom = self._findDomain(sdUUID)
             self.__cache[sdUUID] = dom
             self.__weakCache[sdUUID] = weakref.ref(dom)
diff --git a/vdsm/storage/sdf.py b/vdsm/storage/sdf.py
index 6fa56f8..bd49edf 100644
--- a/vdsm/storage/sdf.py
+++ b/vdsm/storage/sdf.py
@@ -22,7 +22,6 @@ from config import config
 import logging
 
 import sdc
-import storage_exception as se
 
 
 class StorageDomainFactory:
@@ -45,10 +44,7 @@ class StorageDomainFactory:
         Produce a new Storage domain
         """
 
-        newSD = cls.__sdc.lookup(sdUUID)
-        if not newSD:
-            raise se.StorageDomainDoesNotExist(sdUUID)
-        return newSD
+        return cls.__sdc.lookup(sdUUID)
 
 
     @classmethod




More information about the vdsm-patches mailing list