[Openstack] nova error migrating with floating ips: 'FixedIP' object has no attribute '_sa_instance_state'
Nathanael Burton
nathanael.i.burton at gmail.com
Thu Jun 26 01:54:09 UTC 2014
Noel, it was an inline comment to the db/sqlalchemy/api.py file for the
referenced review.
This is the way I suggested in the floating_ip_update() method, but it's
not really much better:
if 'fixed_ip' in values:
values['fixed_ip'] = _fixed_ip_get_by_address(context,
values['fixed_ip'].address,
session)
I have tested the above in Icehouse with NFS and live migration with a
floating_ip. It does seem to work.
Thanks,
Nate
On Jun 25, 2014 6:15 PM, "Noel Burton-Krahn" <noel at pistoncloud.com> wrote:
> Thanks, Nate. I couldn't find your detailed comments in the code review.
> Is there a better way to do a recursive update of SA objects?
>
> This fix worked for me, but it seems ugly to have a special case for a
> field by name. Is there a less hard-coded way to do this?
>
> def save(self, context):
> ...
> if 'fixed_ip' in updates:
> updates['fixed_ip'].save(context)
> del(updates['fixed_ip'])
>
> --
> Noel
>
>
>
>
> On Wed, Jun 25, 2014 at 2:56 PM, Nathanael Burton <
> nathanael.i.burton at gmail.com> wrote:
>
>> Noel, Roman,
>>
>> I made some comments on the proposed review with some minor changes that
>> fixed the "AssertionError: A conflicting state is already present in the
>> identity map" that Noel and I were both having. Please take a look and let
>> me know if that looks ok.
>>
>> Thanks,
>>
>> Nate
>>
>>
>> On Wed, Jun 25, 2014 at 4:43 PM, Nathanael Burton <
>> nathanael.i.burton at gmail.com> wrote:
>>
>>> I've recreated the same issue as Noel with the proposed code under
>>> review (https://review.openstack.org/#/c/102514).
>>>
>>> Nate
>>>
>>>
>>> On Wed, Jun 25, 2014 at 1:45 PM, Noel Burton-Krahn <noel at pistoncloud.com
>>> > wrote:
>>>
>>>> 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:
>>>>
>>>> + updates['fixed_ip'] = db.fixed_ip_get(context, id_)
>>>>
>>>> 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?
>>>>
>>>> Traceback:
>>>>
>>>> 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,))
>>>> 2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher
>>>> Traceback (most recent call last):
>>>> 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
>>>> 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
>>>> 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
>>>> 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
>>>> 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
>>>> 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
>>>> 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
>>>> 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
>>>> 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
>>>> 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
>>>> 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__
>>>> 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
>>>> 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
>>>> 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_
>>>> 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
>>>> 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
>>>> 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
>>>> 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
>>>> 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,))
>>>> 2014-06-25 17:30:21.764 4992 TRACE oslo.messaging.rpc.dispatcher
>>>> 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
>>>> 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"]
>>>> 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
>>>> Jun 25 17:30:21 10.35.0.14 nova-network.log: from py-amqp v1.5.0.
>>>> 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
>>>> Jun 25 17:30:21 10.35.0.14 nova-network.log: from py-amqp v1.5.0.
>>>>
>>>>
>>>>
>>>> On Wed, Jun 25, 2014 at 5:48 AM, Roman Podoliaka <
>>>> rpodolyaka at mirantis.com> wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I believe this should be fixed by
>>>>> https://review.openstack.org/#/c/102514
>>>>>
>>>>> Thanks,
>>>>> Roman
>>>>>
>>>>> On Wed, Jun 25, 2014 at 9:39 AM, Noel Burton-Krahn <
>>>>> noel at pistoncloud.com> wrote:
>>>>> > Thanks a lot for the quick reply, Dan. It's good to know that
>>>>> _context is
>>>>> > expected to be a RequestContext. We do have some changes to nova,
>>>>> although
>>>>> > none are obviously in this area. I'll look there and file a bug if
>>>>> this is
>>>>> > from pure nova.
>>>>> >
>>>>> > --
>>>>> > Noel
>>>>> >
>>>>> >
>>>>> >
>>>>> > On Tue, Jun 24, 2014 at 3:33 PM, Dan Smith <dansmith at redhat.com>
>>>>> wrote:
>>>>> >>
>>>>> >> -----BEGIN PGP SIGNED MESSAGE-----
>>>>> >> Hash: SHA1
>>>>> >>
>>>>> >>
>>>>> >> > floating_ip.save() Exception during message handling: 'FixedIP'
>>>>> >> > object has no attribute '_sa_instance_state'
>>>>> >> >
>>>>> >> >
>>>>> >> > The floating_ip object's context did appears to be a
>>>>> >> > RequestContext object, not a SQLAlchemy object
>>>>> >>
>>>>> >> I think you're confusing NovaObjects with SA objects. A NovaObject's
>>>>> >> _context *should* be a RequestContext.
>>>>> >>
>>>>> >>
>>>>> >> > floating_ip.__dict__={'_address': IPAddress('10.35.4.6'),
>>>>> >> > '_interface': u'public', '_updated_at': datetime.datetime(2014, 6,
>>>>> >> > 24, 20, 38, 28, tzinfo=<iso8601.iso8601.Utc object at
>>>>> >> > 0x7f97cad18e10>), '_context': <nova.context.RequestContext object
>>>>> >> > at 0x7f97cac4acd0>, '_auto_assigned': False, '_pool': u'nova',
>>>>> >> > '_deleted_at': None, '_deleted': False, '_created_at':
>>>>> >> > datetime.datetime(2014, 6, 24, 16, 14, 50,
>>>>> >> > tzinfo=<iso8601.iso8601.Utc object at 0x7f97cad18dd0>),
>>>>> >> > '_fixed_ip_id': 10, '_host': u'10.35.0.15', '_changed_fields':
>>>>> >> > set([]), '_id': 6, '_project_id':
>>>>> >> > '96164da78025487daf0b7a20cb338939'}
>>>>> >>
>>>>> >> This is a NovaObject, but the reference to "_sa_instance_state" is a
>>>>> >> SQLAlchemy thing, AFAIK. The commit of mine you reference is about
>>>>> >> converting the use of some SA objects and bare dicts to NovaObjects.
>>>>> >> If your object looks like the above, but you're getting the above
>>>>> >> message about _sa_instance_state, the something is very (very)
>>>>> confused.
>>>>> >>
>>>>> >>
>>>>> >> > I'm still working through why
>>>>> >> > floating_ip_obj.FloatingIP.get_by_address() may return an object
>>>>> >> > that doesn't work.
>>>>> >> >
>>>>> >> > Dan, does this ring any bells?
>>>>> >>
>>>>> >> This looks highly fishy. Is the code modified in any way? If not,
>>>>> file
>>>>> >> a bug with all these details please.
>>>>> >>
>>>>> >> - --Dan
>>>>> >> -----BEGIN PGP SIGNATURE-----
>>>>> >> Version: GnuPG v1
>>>>> >> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>>>>> >>
>>>>> >> iQEcBAEBAgAGBQJTqfy0AAoJEBeZxaMESjNVrakIANBBYbr+EOHTv8fPYE/Gb4jo
>>>>> >> zoNKuixNZFEJk19qTY2Fdk4OsKw1qq1aJ+kXH/G9WZEQQjNwkrbOhyb2gTEk4rF/
>>>>> >> HQEKRoHVMAa3cOtwzCRsyYVQ/Q0MdNJFug+CYPcGHQYT1en+c8kdVhLAfnXD/pBu
>>>>> >> XO9l2elQr4uBq2fmkG0Biet35qqb62g5p6o1haxhzLWM83X+9yTwTalyqcdCmgKz
>>>>> >> Uzy1V2A9pYxpiPyPC1R3y6onq8R9HlLrGH1SMtPgDNyno+HsWrokbLvgWKJr0tfU
>>>>> >> asAfamRkS92BkeyCx4SoCcIho+NIq7ySILRhDx2ojGtIKjelI6KYAcqQQoKHcT0=
>>>>> >> =qvTt
>>>>> >> -----END PGP SIGNATURE-----
>>>>> >
>>>>> >
>>>>> >
>>>>> > _______________________________________________
>>>>> > Mailing list:
>>>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>>>>> > Post to : openstack at lists.openstack.org
>>>>> > Unsubscribe :
>>>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>>>>> >
>>>>>
>>>>> _______________________________________________
>>>>> Mailing list:
>>>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>>>>> Post to : openstack at lists.openstack.org
>>>>> Unsubscribe :
>>>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list:
>>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>>>> Post to : openstack at lists.openstack.org
>>>> Unsubscribe :
>>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20140625/d5027856/attachment.html>
More information about the Openstack
mailing list