__eq__ of Resource return True even if the two objects have different value

Bug #1499369 reported by Rui Chen on 2015-09-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance Client
Undecided
Rui Chen
oslo-incubator
Undecided
Rui Chen
python-ceilometerclient
Undecided
Rui Chen
python-cinderclient
Undecided
Rui Chen
python-heatclient
Undecided
Rui Chen
python-ironicclient
Low
Rui Chen
python-keystoneclient
Undecided
Rui Chen
python-muranoclient
Undecided
Rui Chen
python-novaclient
Undecided
Rui Chen

Bug Description

the __eq__ of apiclient.base.Resource will return True, if the two objects have same id, even if they have different other attributes value.

The behavior is weird and don't match the semantics of object equal. The objects that have different value should be different objects.

Think about the following case:

I have an application, it will query a nova instance in fixed interval by using novaclient, and check whether some changes occur on the instance, like: status, fixed-ip and so on. I can't use obj1 == obj2 to check, because even if the instance's status is changed from ACTIVE to PAUSED, the result still is True.

I found this issue when I'm working on a Congress BP.
Congress nova driver will query nova instances in fixed interval by using novaclient, and check whether some changes occur on the instance, like: status, fixed-ip and so on. I can't use obj1 == obj2 to check, because even if the instance's status is changed from ACTIVE to PAUSED, the result still is True.

Rui Chen (kiwik-chenrui) on 2015-09-24
Changed in oslo-incubator:
assignee: nobody → Rui Chen (kiwik-chenrui)
Rui Chen (kiwik-chenrui) wrote :
Changed in oslo-incubator:
status: New → Won't Fix
Rui Chen (kiwik-chenrui) wrote :

Hi @DIMS:

    I found apiclient had been removed from oslo-incubator, so you mark 'Won't Fix', that should be understandable. But the issue still exist in separate clients, like: python-novaclient, python-neutronclient, do you have some suggestions about how I can resolve the problem? Fix it in each python-client or other way?

@Rui, yes, we need to fix it in each client.

Rui Chen (kiwik-chenrui) on 2015-11-28
description: updated
Rui Chen (kiwik-chenrui) on 2015-11-28
Changed in python-novaclient:
assignee: nobody → Rui Chen (kiwik-chenrui)

Fix proposed to branch: master
Review: https://review.openstack.org/251020

Changed in python-novaclient:
status: New → In Progress
Rui Chen (kiwik-chenrui) on 2015-11-28
Changed in python-cinderclient:
assignee: nobody → Rui Chen (kiwik-chenrui)

Fix proposed to branch: master
Review: https://review.openstack.org/251021

Changed in python-cinderclient:
status: New → In Progress
Rui Chen (kiwik-chenrui) on 2015-11-28
Changed in python-ceilometerclient:
assignee: nobody → Rui Chen (kiwik-chenrui)

Fix proposed to branch: master
Review: https://review.openstack.org/251031

Changed in python-ceilometerclient:
status: New → In Progress
Rui Chen (kiwik-chenrui) wrote :

python-glanceclient patch:

    https://review.openstack.org/#/c/251032/

Changed in python-glanceclient:
assignee: nobody → Rui Chen (kiwik-chenrui)
Rui Chen (kiwik-chenrui) on 2015-12-01
Changed in python-heatclient:
assignee: nobody → Rui Chen (kiwik-chenrui)
Changed in python-glanceclient:
status: New → In Progress

Fix proposed to branch: master
Review: https://review.openstack.org/251830

Changed in python-heatclient:
status: New → In Progress
Rui Chen (kiwik-chenrui) on 2015-12-01
Changed in python-ironicclient:
assignee: nobody → Rui Chen (kiwik-chenrui)

Fix proposed to branch: master
Review: https://review.openstack.org/251836

Changed in python-ironicclient:
status: New → In Progress
Rui Chen (kiwik-chenrui) on 2015-12-01
Changed in python-keystoneclient:
assignee: nobody → Rui Chen (kiwik-chenrui)

Fix proposed to branch: master
Review: https://review.openstack.org/251841

Changed in python-keystoneclient:
status: New → In Progress
Rui Chen (kiwik-chenrui) on 2015-12-01
Changed in python-muranoclient:
assignee: nobody → Rui Chen (kiwik-chenrui)

Reviewed: https://review.openstack.org/251031
Committed: https://git.openstack.org/cgit/openstack/python-ceilometerclient/commit/?id=7c18662e748c51645497d2ecd6372e24eee1adf8
Submitter: Jenkins
Branch: master

commit 7c18662e748c51645497d2ecd6372e24eee1adf8
Author: Rui Chen <email address hidden>
Date: Sat Nov 28 18:07:16 2015 +0800

    Fix Resource.__eq__ mismatch semantics of object equal

    The __eq__ of apiclient.base.Resource will return True,
    if the two objects have same id, even if they have different
    other attributes value. The behavior is weird and don't
    match the semantics of object equal. The objects that have
    different value should be different objects.
    Fix this issue and add some test cases in this patch.

    Change-Id: Ieb28aa179bda945686e0d9c2f341c373ce2bab74
    Closes-Bug: #1499369

Changed in python-ceilometerclient:
status: In Progress → Fix Committed

Fix proposed to branch: master
Review: https://review.openstack.org/252220

Changed in python-muranoclient:
status: New → In Progress
Rui Chen (kiwik-chenrui) wrote :

python-neutronclient and python-swiftclient don't use oslo apiclient, don't exist this issue.

Dmitry Tantsur (divius) on 2015-12-02
Changed in python-ironicclient:
importance: Undecided → Low

Reviewed: https://review.openstack.org/251032
Committed: https://git.openstack.org/cgit/openstack/python-glanceclient/commit/?id=7651b596a3f4d254220ae7da447a07e748908ab3
Submitter: Jenkins
Branch: master

commit 7651b596a3f4d254220ae7da447a07e748908ab3
Author: Rui Chen <email address hidden>
Date: Sat Nov 28 18:15:52 2015 +0800

    Fix Resource.__eq__ mismatch semantics of object equal

    The __eq__ of apiclient.base.Resource will return True,
    if the two objects have same id, even if they have different
    other attributes value. The behavior is weird and don't
    match the semantics of object equal. The objects that have
    different value should be different objects.
    Fix this issue and add some test cases in this patch.

    Change-Id: I24ba39bf90d727116f256de46241746520efbfee
    Closes-Bug: #1499369

Changed in python-glanceclient:
status: In Progress → Fix Committed
Changed in python-muranoclient:
assignee: Rui Chen (kiwik-chenrui) → Ekaterina Chernova (efedorova)
Changed in python-muranoclient:
assignee: Ekaterina Chernova (efedorova) → Rui Chen (kiwik-chenrui)
Stan Lagun (slagun) on 2015-12-09
Changed in python-muranoclient:
milestone: none → 0.8.1

Reviewed: https://review.openstack.org/252220
Committed: https://git.openstack.org/cgit/openstack/python-muranoclient/commit/?id=6fc085e78dcf20fc647f7b66ae47cfe2f9d613a9
Submitter: Jenkins
Branch: master

commit 6fc085e78dcf20fc647f7b66ae47cfe2f9d613a9
Author: Rui Chen <email address hidden>
Date: Wed Dec 2 15:02:22 2015 +0800

    Fix Resource.__eq__ mismatch semantics of object equal

    The __eq__ of apiclient.base.Resource will return True,
    if the two objects have same id, even if they have different
    other attributes value. The behavior is weird and don't
    match the semantics of object equal. The objects that have
    different value should be different objects.
    Fix this issue and add some test cases in this patch.

    Change-Id: If31659c503007e08baa0a23485a49a5e5dde8e8b
    Closes-Bug: #1499369

Changed in python-muranoclient:
status: In Progress → Fix Released

Reviewed: https://review.openstack.org/251830
Committed: https://git.openstack.org/cgit/openstack/python-heatclient/commit/?id=aeea4ec943caddac3fc74f4b1d3dce603f0b251f
Submitter: Jenkins
Branch: master

commit aeea4ec943caddac3fc74f4b1d3dce603f0b251f
Author: Rui Chen <email address hidden>
Date: Tue Dec 1 20:16:34 2015 +0800

    Fix Resource.__eq__ mismatch semantics of object equal

    The __eq__ of apiclient.base.Resource will return True,
    if the two objects have same id, even if they have different
    other attributes value. The behavior is weird and don't
    match the semantics of object equal. The objects that have
    different value should be different objects.
    Fix this issue and add some test cases in this patch.

    Change-Id: I5904b82d80d6011c1c3f220c357cc14e8d98da61
    Closes-Bug: #1499369

Changed in python-heatclient:
status: In Progress → Fix Released

Reviewed: https://review.openstack.org/251841
Committed: https://git.openstack.org/cgit/openstack/python-keystoneclient/commit/?id=fcbb2d724899e265e168100718399f7886f3f1f5
Submitter: Jenkins
Branch: master

commit fcbb2d724899e265e168100718399f7886f3f1f5
Author: Rui Chen <email address hidden>
Date: Tue Dec 1 20:32:51 2015 +0800

    Fix Resource.__eq__ mismatch semantics of object equal

    The __eq__ of apiclient.base.Resource will return True,
    if the two objects have same id, even if they have different
    other attributes value. The behavior is weird and don't
    match the semantics of object equal. The objects that have
    different value should be different objects.
    Fix this issue and add some test cases in this patch.

    Change-Id: I1565c6e66d6dd6cf7bd2b7e8526157190deb45de
    Closes-Bug: #1499369

Changed in python-keystoneclient:
status: In Progress → Fix Released

This issue was fixed in the openstack/python-ceilometerclient 2.2.0 release.

This issue was fixed in the openstack/python-keystoneclient 2.1.0 release.

gordon chung (chungg) on 2016-01-13
Changed in python-ceilometerclient:
status: Fix Committed → Fix Released

Reviewed: https://review.openstack.org/266653
Committed: https://git.openstack.org/cgit/openstack/python-heatclient/commit/?id=f0877c532e3dc7b1a774ca89a874c6ba7be2d925
Submitter: Jenkins
Branch: stable/liberty

commit f0877c532e3dc7b1a774ca89a874c6ba7be2d925
Author: Rui Chen <email address hidden>
Date: Tue Dec 1 20:16:34 2015 +0800

    Fix Resource.__eq__ mismatch semantics of object equal

    The __eq__ of apiclient.base.Resource will return True,
    if the two objects have same id, even if they have different
    other attributes value. The behavior is weird and don't
    match the semantics of object equal. The objects that have
    different value should be different objects.
    Fix this issue and add some test cases in this patch.

    Change-Id: I5904b82d80d6011c1c3f220c357cc14e8d98da61
    Closes-Bug: #1499369
    (cherry picked from commit aeea4ec943caddac3fc74f4b1d3dce603f0b251f)

tags: added: in-stable-liberty

This issue was fixed in the openstack/python-heatclient 0.8.1 release.

This issue was fixed in the openstack/python-heatclient 0.9.0 release.

Reviewed: https://review.openstack.org/251021
Committed: https://git.openstack.org/cgit/openstack/python-cinderclient/commit/?id=eb1cddbc28f507b117fe3b1808aea78724151e88
Submitter: Jenkins
Branch: master

commit eb1cddbc28f507b117fe3b1808aea78724151e88
Author: Rui Chen <email address hidden>
Date: Sat Nov 28 16:04:40 2015 +0800

    Fix Resource.__eq__ mismatch semantics of object equal

    The __eq__ of apiclient.base.Resource will return True,
    if the two objects have same id, even if they have different
    other attributes value. The behavior is weird and don't
    match the semantics of object equal. The objects that have
    different value should be different objects.
    Fix this issue and add some test cases in this patch.

    Change-Id: I187032e5630ac47a4f54db5058dbf9b6e15eba6d
    Closes-Bug: #1499369

Changed in python-cinderclient:
status: In Progress → Fix Released

Reviewed: https://review.openstack.org/251836
Committed: https://git.openstack.org/cgit/openstack/python-ironicclient/commit/?id=932ac60dcbdc70c9f1ddf0968945cd43028081cc
Submitter: Jenkins
Branch: master

commit 932ac60dcbdc70c9f1ddf0968945cd43028081cc
Author: Rui Chen <email address hidden>
Date: Tue Dec 1 20:25:18 2015 +0800

    Fix Resource.__eq__ mismatch semantics of object equal

    The __eq__ of apiclient.base.Resource will return True,
    if the two objects have same id, even if they have different
    other attributes value. The behavior is weird and don't
    match the semantics of object equal. The objects that have
    different value should be different objects.
    Fix this issue and add some test cases in this patch.

    Change-Id: I1d072a900d07449b744f4e743e04a57e42109730
    Closes-Bug: #1499369

Changed in python-ironicclient:
status: In Progress → Fix Released

This issue was fixed in the openstack/python-glanceclient 2.0.0 release.

This issue was fixed in the openstack/python-ironicclient 1.2.0 release.

This issue was fixed in the openstack/python-cinderclient 1.7.0 release.

This issue was fixed in the openstack/python-heatclient 0.8.1 release.

Change abandoned by Michael Still (<email address hidden>) on branch: master
Review: https://review.openstack.org/251020
Reason: This patch has been sitting unchanged for more than 12 weeks. I am therefore going to abandon it to keep the review queue sane. Please feel free to restore the change if you're still working on it.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers