Change in vdsm[master]: iscsi: Improve ChapCredentials.__hash__

nsoffer at redhat.com nsoffer at redhat.com
Mon Aug 3 00:05:20 UTC 2015


Nir Soffer has uploaded a new change for review.

Change subject: iscsi: Improve ChapCredentials.__hash__
......................................................................

iscsi: Improve ChapCredentials.__hash__

The hash was mixed in a poor way, use instead built-in tuple hash which
does a better work with less code.

Change-Id: I7c05a07098fa75fe292e67cf5e62b996f20d9751
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
M vdsm/storage/iscsi.py
1 file changed, 1 insertion(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/44298/1

diff --git a/vdsm/storage/iscsi.py b/vdsm/storage/iscsi.py
index 27adc39..1c38c6b 100644
--- a/vdsm/storage/iscsi.py
+++ b/vdsm/storage/iscsi.py
@@ -308,9 +308,7 @@
         return not self == other
 
     def __hash__(self):
-        return (hash(self.__class__) ^
-                hash(self.username) ^
-                hash(self.password.value))
+        return hash((self.__class__, self.username, self.password.value))
 
 
 # Technically there are a lot more interface properties but VDSM doesn't


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c05a07098fa75fe292e67cf5e62b996f20d9751
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