Bug 1276044 - Regression: CFSNode no longer comparable to None in 2.1.fb57
Regression: CFSNode no longer comparable to None in 2.1.fb57
Status: VERIFIED
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: python-rtslib (Show other bugs)
7.2
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Andy Grover
Bruno Goncalves
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-28 09:42 EDT by Matthew Booth
Modified: 2017-04-13 11:45 EDT (History)
4 users (show)

See Also:
Fixed In Version: python-rtslib-2.1.fb57-3.el7.noarch
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Matthew Booth 2015-10-28 09:42:33 EDT
The update from rtslib-fb-2.1.fb50 to rtslib-fb-2.1.fb57 includes the following hunk:

diff -ruN rtslib-fb-2.1.fb50/rtslib/node.py rtslib-fb-2.1.fb57/rtslib/node.py
--- rtslib-fb-2.1.fb50/rtslib/node.py   2014-09-24 18:49:44.000000000 +0100
+++ rtslib-fb-2.1.fb57/rtslib/node.py   2015-06-23 17:21:11.000000000 +0100
@@ -33,6 +33,12 @@
     def __init__(self):
         self._path = self.configfs_dir
 
+    def __eq__(self, other):
+        return self._path == other._path
+
+    def __ne__(self, other):
+        return self._path != other._path
+
     def _get_path(self):
         return self._path
 
This breaks code which does:

node == None

which then fails because NoneType doesn't have _path. Unfortunately cinder from RHOS 5 does this. This is obviously bad practice, and I will separately be submitting a patch to cinder, but this remains a regression in rtslib.

Suggest something like:

return isinstance(other, self.__class__) and self._path == other._path

which would also cover comparisons with other objects of an incorrect type.
Comment 3 Matthew Booth 2015-10-28 10:37:13 EDT
cinder bug is bug 276057
Comment 4 Matthew Booth 2015-10-28 10:37:57 EDT
Should be bug 1276057
Comment 5 Matthew Booth 2015-10-28 10:38:44 EDT
I can confirm that current cinder gets past this issue if CFSNode is updated as:

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self._path == other._path

    def __ne__(self, other):
        return not self.__eq__(other)
Comment 6 Matthew Booth 2015-10-30 06:27:28 EDT
Thanks for moving so quickly on this! I just pulled the updated package from brew and updated by rhos 5 setup here. I can confirm that I can now create a instance using an iscsi volume with this updated package and without the cinder fix in place.

I have also pushed the cinder fix, so this will show up in the next build of cinder.
Comment 7 Bruno Goncalves 2015-11-03 03:58:20 EST
python-rtslib-2.1.fb57-3.el7.noarch passed successfully in our regression test.

Note You need to log in before you can comment on or make changes to this bug.