Change in vdsm[ovirt-3.6]: issci: Fix equality and hash when username or password are None

ybronhei at redhat.com ybronhei at redhat.com
Sun Jan 3 19:28:24 UTC 2016


Yaniv Bronhaim has submitted this change and it was merged.

Change subject: issci: Fix equality and hash when username or password are None
......................................................................


issci: Fix equality and hash when username or password are None

When fetching iscsi session info, username of password can be None, but
iscsi.ChapCredentials was not handling these values correctly in __eq__
and __hash__.  In particular, we used to compare password.value and
include it in the hash. This would raise AttributeError when password is
None.

Now all combinations are handled properly; we compare password objects,
using ProtectedPassword.__eq__, and include hash(password), using
ProtectedPassword.__hash__.

This issue was hidden because practically username is None when password
is None, and the equality test fail before we try to compare None.value.
The hash issue is hidden because we never use __hash__ for
ChapCredentials. So this is mainly a correctness fix that should not
effect current code, but it may be needed for fixing the related bug.

Change-Id: I95bda5d07506ecbfb76ec5397717fe05b53f97ec
Bug-Url: https://bugzilla.redhat.com/1279485
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/48480
Reviewed-by: Allon Mureinik <amureini at redhat.com>
Reviewed-by: Ala Hino <ahino at redhat.com>
Continuous-Integration: Jenkins CI
Reviewed-by: Freddy Rolland <frolland at redhat.com>
Reviewed-by: Adam Litke <alitke at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/50939
Reviewed-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M lib/vdsm/password.py
M tests/iscsiTests.py
M vdsm/storage/iscsi.py
3 files changed, 46 insertions(+), 19 deletions(-)

Approvals:
  Nir Soffer: Verified
  Yaniv Bronhaim: Looks good to me, approved
  Jenkins CI: Passed CI tests
  Allon Mureinik: Looks good to me, but someone else must approve
  Freddy Rolland: Looks good to me, but someone else must approve
  Ala Hino: Looks good to me, but someone else must approve



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I95bda5d07506ecbfb76ec5397717fe05b53f97ec
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Ala Hino <ahino at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Freddy Rolland <frolland at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>


More information about the vdsm-patches mailing list