Nir Soffer has uploaded a new change for review.

Change subject: resourceManager: Inline LockType.validate
......................................................................

resourceManager: Inline LockType.validate

Inline the function in the single call site, allowing replacing LockType
with flat constants.

Change-Id: I8205fb724d52eeedcc86c0f53656b2502721e1d0
Signed-off-by: Nir Soffer <nsof...@redhat.com>
---
M vdsm/storage/resourceManager.py
1 file changed, 2 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/63627/1

diff --git a/vdsm/storage/resourceManager.py b/vdsm/storage/resourceManager.py
index 82db9cb..b766082 100644
--- a/vdsm/storage/resourceManager.py
+++ b/vdsm/storage/resourceManager.py
@@ -56,12 +56,6 @@
     shared = "shared"
     exclusive = "exclusive"
 
-    @classmethod
-    def validate(cls, ltype):
-        validValues = ["shared", "exclusive"]
-        if ltype not in validValues:
-            raise ValueError("invalid lock type '%s'" % ltype)
-
 
 class LockState:
     free = "free"
@@ -530,7 +524,8 @@
         if not self._resourceNameValidator.match(name):
             raise ValueError("Invalid resource name '%s'" % name)
 
-        LockType.validate(lockType)
+        if lockType not in (LockType.shared, LockType.exclusive):
+            raise ValueError("invalid lock type %r" % lockType)
 
         request = Request(namespace, name, lockType, callback)
         self._log.debug("Trying to register resource '%s' for lock type '%s'",


-- 
To view, visit https://gerrit.ovirt.org/63627
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8205fb724d52eeedcc86c0f53656b2502721e1d0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsof...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org

Reply via email to