<div dir="ltr"><div>I've recreated the same issue as Noel with the proposed code under review (<a href="https://review.openstack.org/#/c/102514">https://review.openstack.org/#/c/102514</a>).<br><br></div>Nate<br></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 25, 2014 at 1:45 PM, Noel Burton-Krahn <span dir="ltr"><<a href="mailto:noel@pistoncloud.com" target="_blank">noel@pistoncloud.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks, Roman. That fix did get past the sa_instance_state problem, but I bumped into something new. It looks like floating_ip_update() doesn't like the SA fixed ip that's fetched here:<div>
<br></div>
<div><div>+ updates['fixed_ip'] = db.fixed_ip_get(context, id_)</div><div><br></div><div>I'm not sure what "A conflicting state is already present in the identity map" means. Is there another way to fetch the fixed ip?</div>
<div><br></div><div>Traceback:</div><div><br></div><div><div>Jun 25 17:30:21 10.35.0.14 nova-network 2014-06-25 17:30:21.764 4992 ERROR oslo.messaging.rpc.dispatcher [-] Exception during message handling: A conflicting state is already present in the identity map for key (<class 'nova.db.sqlalchemy.models.FixedIp'>, (3L,))</div>
<div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher Traceback (most recent call last):</div><div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 133, in _dispatch_and_reply</div>
<div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 176, in _dispatch</div><div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 122, in _do_dispatch</div>
<div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/nova/network/floating_ips.py", line 575, in migrate_instance_start</div><div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/nova/objects/base.py", line 151, in wrapper</div>
<div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/nova/objects/floating_ip.py", line 135, in save</div><div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/nova/db/api.py", line 386, in floating_ip_update</div>
<div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 164, in wrapper</div><div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 1024, in floating_ip_update</div>
<div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/nova/openstack/common/db/sqlalchemy/models.py", line 88, in update</div><div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.py", line 220, in __set__</div>
<div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.py", line 780, in set</div><div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.py", line 801, in fire_replace_event</div>
<div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 87, in set_</div><div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 1490, in _save_or_update_state</div>
<div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 1746, in _save_or_update_impl</div><div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 1739, in _update_impl</div>
<div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/identity.py", line 119, in add</div><div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher AssertionError: A conflicting state is already present in the identity map for key (<class 'nova.db.sqlalchemy.models.FixedIp'>, (3L,))</div>
<div>2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher </div><div>Jun 25 17:30:21 10.35.0.14 nova-network 2014-06-25 17:30:21.765 4992 ERROR oslo.messaging._drivers.common [-] Returning exception A conflicting state is already present in the identity map for key (<class 'nova.db.sqlalchemy.models.FixedIp'>, (3L,)) to caller</div>
<div>Jun 25 17:30:21 10.35.0.14 nova-network 2014-06-25 17:30:21.766 4992 ERROR oslo.messaging._drivers.common [-] ['Traceback (most recent call last):\n', ' File "/usr/lib64/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 133, in _dispatch_and_reply\n', ' File "/usr/lib64/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 176, in _dispatch\n', ' File "/usr/lib64/python2.7/site-packages/oslo/messaging/rpc/dispatcher.py", line 122, in _do_dispatch\n', ' File "/usr/lib64/python2.7/site-packages/nova/network/floating_ips.py", line 575, in migrate_instance_start\n', ' File "/usr/lib64/python2.7/site-packages/nova/objects/base.py", line 151, in wrapper\n', ' File "/usr/lib64/python2.7/site-packages/nova/objects/floating_ip.py", line 135, in save\n', ' File "/usr/lib64/python2.7/site-packages/nova/db/api.py", line 386, in floating_ip_update\n', ' File "/usr/lib64/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 164, in wrapper\n', ' File "/usr/lib64/python2.7/site-packages/nova/db/sqlalchemy/api.py", line 1024, in floating_ip_update\n', ' File "/usr/lib64/python2.7/site-packages/nova/openstack/common/db/sqlalchemy/models.py", line 88, in update\n', ' File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.py", line 220, in __set__\n', ' File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.py", line 780, in set\n', ' File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/attributes.py", line 801, in fire_replace_event\n', ' File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 87, in set_\n', ' File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 1490, in _save_or_update_state\n', ' File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 1746, in _save_or_update_impl\n', ' File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 1739, in _update_impl\n', ' File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/identity.py", line 119, in add\n', "AssertionError: A conflicting state is already present in the identity map for key (<class 'nova.db.sqlalchemy.models.FixedIp'>, (3L,))\n"]</div>
<div>Jun 25 17:30:21 10.35.0.14 nova-network.log: /usr/lib64/python2.7/site-packages/amqp/channel.py:616: VDeprecationWarning: The auto_delete flag for exchanges has been deprecated and will be removed</div><div>Jun 25 17:30:21 10.35.0.14 nova-network.log: from py-amqp v1.5.0.</div>
<div>Jun 25 17:30:21 10.35.0.14 nova-network.log: /usr/lib64/python2.7/site-packages/amqp/channel.py:616: VDeprecationWarning: The auto_delete flag for exchanges has been deprecated and will be removed</div><div>Jun 25 17:30:21 10.35.0.14 nova-network.log: from py-amqp v1.5.0.</div>
</div><div><br></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 25, 2014 at 5:48 AM, Roman Podoliaka <span dir="ltr"><<a href="mailto:rpodolyaka@mirantis.com" target="_blank">rpodolyaka@mirantis.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I believe this should be fixed by <a href="https://review.openstack.org/#/c/102514" target="_blank">https://review.openstack.org/#/c/102514</a><br>
<br>
Thanks,<br>
Roman<br>
<div><div><br>
On Wed, Jun 25, 2014 at 9:39 AM, Noel Burton-Krahn <<a href="mailto:noel@pistoncloud.com" target="_blank">noel@pistoncloud.com</a>> wrote:<br>
> Thanks a lot for the quick reply, Dan. It's good to know that _context is<br>
> expected to be a RequestContext. We do have some changes to nova, although<br>
> none are obviously in this area. I'll look there and file a bug if this is<br>
> from pure nova.<br>
><br>
> --<br>
> Noel<br>
><br>
><br>
><br>
> On Tue, Jun 24, 2014 at 3:33 PM, Dan Smith <<a href="mailto:dansmith@redhat.com" target="_blank">dansmith@redhat.com</a>> wrote:<br>
>><br>
>> -----BEGIN PGP SIGNED MESSAGE-----<br>
>> Hash: SHA1<br>
>><br>
>><br>
>> > floating_ip.save() Exception during message handling: 'FixedIP'<br>
>> > object has no attribute '_sa_instance_state'<br>
>> ><br>
>> ><br>
>> > The floating_ip object's context did appears to be a<br>
>> > RequestContext object, not a SQLAlchemy object<br>
>><br>
>> I think you're confusing NovaObjects with SA objects. A NovaObject's<br>
>> _context *should* be a RequestContext.<br>
>><br>
>><br>
>> > floating_ip.__dict__={'_address': IPAddress('10.35.4.6'),<br>
>> > '_interface': u'public', '_updated_at': datetime.datetime(2014, 6,<br>
>> > 24, 20, 38, 28, tzinfo=<iso8601.iso8601.Utc object at<br>
>> > 0x7f97cad18e10>), '_context': <nova.context.RequestContext object<br>
>> > at 0x7f97cac4acd0>, '_auto_assigned': False, '_pool': u'nova',<br>
>> > '_deleted_at': None, '_deleted': False, '_created_at':<br>
>> > datetime.datetime(2014, 6, 24, 16, 14, 50,<br>
>> > tzinfo=<iso8601.iso8601.Utc object at 0x7f97cad18dd0>),<br>
>> > '_fixed_ip_id': 10, '_host': u'10.35.0.15', '_changed_fields':<br>
>> > set([]), '_id': 6, '_project_id':<br>
>> > '96164da78025487daf0b7a20cb338939'}<br>
>><br>
>> This is a NovaObject, but the reference to "_sa_instance_state" is a<br>
>> SQLAlchemy thing, AFAIK. The commit of mine you reference is about<br>
>> converting the use of some SA objects and bare dicts to NovaObjects.<br>
>> If your object looks like the above, but you're getting the above<br>
>> message about _sa_instance_state, the something is very (very) confused.<br>
>><br>
>><br>
>> > I'm still working through why<br>
>> > floating_ip_obj.FloatingIP.get_by_address() may return an object<br>
>> > that doesn't work.<br>
>> ><br>
>> > Dan, does this ring any bells?<br>
>><br>
>> This looks highly fishy. Is the code modified in any way? If not, file<br>
>> a bug with all these details please.<br>
>><br>
>> - --Dan<br>
>> -----BEGIN PGP SIGNATURE-----<br>
>> Version: GnuPG v1<br>
>> Comment: Using GnuPG with Thunderbird - <a href="http://www.enigmail.net/" target="_blank">http://www.enigmail.net/</a><br>
>><br>
>> iQEcBAEBAgAGBQJTqfy0AAoJEBeZxaMESjNVrakIANBBYbr+EOHTv8fPYE/Gb4jo<br>
>> zoNKuixNZFEJk19qTY2Fdk4OsKw1qq1aJ+kXH/G9WZEQQjNwkrbOhyb2gTEk4rF/<br>
>> HQEKRoHVMAa3cOtwzCRsyYVQ/Q0MdNJFug+CYPcGHQYT1en+c8kdVhLAfnXD/pBu<br>
>> XO9l2elQr4uBq2fmkG0Biet35qqb62g5p6o1haxhzLWM83X+9yTwTalyqcdCmgKz<br>
>> Uzy1V2A9pYxpiPyPC1R3y6onq8R9HlLrGH1SMtPgDNyno+HsWrokbLvgWKJr0tfU<br>
>> asAfamRkS92BkeyCx4SoCcIho+NIq7ySILRhDx2ojGtIKjelI6KYAcqQQoKHcT0=<br>
>> =qvTt<br>
>> -----END PGP SIGNATURE-----<br>
><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Mailing list: <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a><br>
> Post to : <a href="mailto:openstack@lists.openstack.org" target="_blank">openstack@lists.openstack.org</a><br>
> Unsubscribe : <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a><br>
><br>
<br>
_______________________________________________<br>
Mailing list: <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a><br>
Post to : <a href="mailto:openstack@lists.openstack.org" target="_blank">openstack@lists.openstack.org</a><br>
Unsubscribe : <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a><br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Mailing list: <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a><br>
Post to : <a href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a><br>
Unsubscribe : <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack</a><br>
<br></blockquote></div><br></div>