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

Bug #1499369 reported by Rui Chen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance Client
Fix Released
Undecided
Rui Chen
oslo-incubator
Won't Fix
Undecided
Rui Chen
python-ceilometerclient
Fix Released
Undecided
Rui Chen
python-cinderclient
Fix Released
Undecided
Rui Chen
python-heatclient
Fix Released
Undecided
Rui Chen
python-ironicclient
Fix Released
Low
Rui Chen
python-keystoneclient
Fix Released
Undecided
Rui Chen
python-muranoclient
Fix Released
Undecided
Rui Chen
python-novaclient
In Progress
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)
Changed in oslo-incubator:
assignee: nobody → Rui Chen (kiwik-chenrui)
Revision history for this message
Rui Chen (kiwik-chenrui) wrote :
Changed in oslo-incubator:
status: New → Won't Fix
Revision history for this message
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?

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

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

Rui Chen (kiwik-chenrui)
description: updated
Rui Chen (kiwik-chenrui)
Changed in python-novaclient:
assignee: nobody → Rui Chen (kiwik-chenrui)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (master)

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

Changed in python-novaclient:
status: New → In Progress
Rui Chen (kiwik-chenrui)
Changed in python-cinderclient:
assignee: nobody → Rui Chen (kiwik-chenrui)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-cinderclient (master)

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

Changed in python-cinderclient:
status: New → In Progress
Rui Chen (kiwik-chenrui)
Changed in python-ceilometerclient:
assignee: nobody → Rui Chen (kiwik-chenrui)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-ceilometerclient (master)

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

Changed in python-ceilometerclient:
status: New → In Progress
Revision history for this message
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)
Changed in python-heatclient:
assignee: nobody → Rui Chen (kiwik-chenrui)
Changed in python-glanceclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-heatclient (master)

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

Changed in python-heatclient:
status: New → In Progress
Rui Chen (kiwik-chenrui)
Changed in python-ironicclient:
assignee: nobody → Rui Chen (kiwik-chenrui)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-ironicclient (master)

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

Changed in python-ironicclient:
status: New → In Progress
Rui Chen (kiwik-chenrui)
Changed in python-keystoneclient:
assignee: nobody → Rui Chen (kiwik-chenrui)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-keystoneclient (master)

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

Changed in python-keystoneclient:
status: New → In Progress
Rui Chen (kiwik-chenrui)
Changed in python-muranoclient:
assignee: nobody → Rui Chen (kiwik-chenrui)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-ceilometerclient (master)

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
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-muranoclient (master)

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

Changed in python-muranoclient:
status: New → In Progress
Revision history for this message
Rui Chen (kiwik-chenrui) wrote :

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

Dmitry Tantsur (divius)
Changed in python-ironicclient:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-glanceclient (master)

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)
Changed in python-muranoclient:
milestone: none → 0.8.1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-muranoclient (master)

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
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-heatclient (master)

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
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

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
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/python-ceilometerclient 2.2.0

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-heatclient (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/266653

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/python-keystoneclient 2.1.0

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

gordon chung (chungg)
Changed in python-ceilometerclient:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-heatclient (stable/liberty)

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
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/python-heatclient 0.8.1

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

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/python-heatclient 0.9.0

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-cinderclient (master)

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
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-ironicclient (master)

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
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/python-glanceclient 2.0.0

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

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/python-ironicclient 1.2.0

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

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/python-cinderclient 1.7.0

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-heatclient 0.8.1

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-novaclient (master)

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.

Changed in python-glanceclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.