Ensure _get_changed_synthetic_fields() return updatable fields - breaks consumers

Bug #1777908 reported by Boden R on 2018-06-20
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
High
Unassigned

Bug Description

It appears the landing of [1] into stable/queens has broken some consumers, at least vmware-nsx.

When running with [1] in neutron/queens, we now get:
----
security_group_rule is already registered
Loaded quota_driver: <neutron.db.quota.driver.DbQuotaDriver object at 0x7fd805e1e750>.
Loaded quota_driver: <neutron.db.quota.driver.DbQuotaDriver object at 0x7ff8b1e0c790>.
create failed: No details.: DetachedInstanceError: Parent instance <SecurityGroup at 0x7fd804039f10> is not bound to a Session; lazy load operation of attribute 'ext_properties' cannot proceed (Background on this error at: http://sqlalche.me/e/bhk3)
Traceback (most recent call last):
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/src/neutron/neutron/api/v2/resource.py", line 98, in resource
    result = method(request=request, **args)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/src/neutron/neutron/api/v2/base.py", line 425, in create
    return self._create(request, body, **kwargs)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/src/neutron/neutron/db/api.py", line 91, in wrapped
    setattr(e, '_RETRY_EXCEEDED', True)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
    self.force_reraise()
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
    six.reraise(self.type_, self.value, self.tb)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/src/neutron/neutron/db/api.py", line 87, in wrapped
    return f(*args, **kwargs)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/local/lib/python2.7/site-packages/oslo_db/api.py", line 154, in wrapper
    ectxt.value = e.inner_exc
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
    self.force_reraise()
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
    six.reraise(self.type_, self.value, self.tb)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/local/lib/python2.7/site-packages/oslo_db/api.py", line 142, in wrapper
    return f(*args, **kwargs)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/src/neutron/neutron/db/api.py", line 126, in wrapped
    LOG.debug("Retry wrapper got retriable exception: %s", e)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
    self.force_reraise()
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
    six.reraise(self.type_, self.value, self.tb)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/src/neutron/neutron/db/api.py", line 122, in wrapped
    return f(*dup_args, **dup_kwargs)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/src/neutron/neutron/api/v2/base.py", line 539, in _create
    obj = do_create(body)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/src/neutron/neutron/api/v2/base.py", line 521, in do_create
    request.context, reservation.reservation_id)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
    self.force_reraise()
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
    six.reraise(self.type_, self.value, self.tb)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/src/neutron/neutron/api/v2/base.py", line 514, in do_create
    return obj_creator(request.context, **kwargs)
  File "vmware_nsx/tests/unit/extensions/test_provider_security_groups.py", line 53, in create_security_group
    context, security_group)
  File "vmware_nsx/db/extended_security_group.py", line 77, in create_provider_security_group
    context, security_group, False, True)
  File "vmware_nsx/db/extended_security_group.py", line 107, in create_security_group_without_rules
    secgroup_dict = self._make_security_group_dict(sg)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/src/neutron/neutron/db/securitygroups_db.py", line 280, in _make_security_group_dict
    security_group.db_obj)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/src/neutron/neutron/db/_resource_extend.py", line 75, in apply_funcs
    resolved_func(response, db_object)
  File "vmware_nsx/db/extended_security_group.py", line 348, in _extend_security_group_with_properties
    if sg_db.ext_properties:
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/local/lib/python2.7/site-packages/sqlalchemy/orm/attributes.py", line 242, in __get__
    return self.impl.get(instance_state(instance), dict_)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/local/lib/python2.7/site-packages/sqlalchemy/orm/attributes.py", line 599, in get
    value = self.callable_(state, passive)
  File "/home/boden/src/vmware-nsx/.tox/py27-dev/local/lib/python2.7/site-packages/sqlalchemy/orm/strategies.py", line 596, in _load_for_state
    (orm_util.state_str(state), self.key)
DetachedInstanceError: Parent instance <SecurityGroup at 0x7fd804039f10> is not bound to a Session; lazy load operation of attribute 'ext_properties' cannot proceed (Background on this error at: http://sqlalche.me/e/bhk3)

{0} vmware_nsx.tests.unit.extensions.test_provider_security_groups.ProviderSecurityGroupExtTestCase.test_create_provider_security_groups_same_tenant [0.806920s] ... FAILED
----

If I manually revert [1] in neutron/queens of my workspace, the test passes.
ATM I'm only testing locally; working on a sample patch for the gate to reference here.

Is there a way we can do [1] without breaking consumers?

[1] https://review.openstack.org/#/c/573617/

Boden R (boden) wrote :

An example failure can be seen in [1].
I will try a sample patch to revert the neutron change in queens and see if it fixed [1] (just to be sure).

[1] http://logs.openstack.org/25/576925/1/check/openstack-tox-py27/279e3ec/job-output.txt.gz#_2018-06-20_18_08_15_934777

Boden R (boden) wrote :
Slawek Kaplonski (slaweq) wrote :

@Boden: this was proposed and already merged also to Ocata: https://review.openstack.org/#/c/573620/1 so probably we will have to revert it there too.

Boden R (boden) wrote :
Changed in neutron:
status: New → Confirmed
importance: Undecided → High

Change abandoned by boden (<email address hidden>) on branch: stable/ocata
Review: https://review.openstack.org/577208
Reason: reverted the right way

Change abandoned by boden (<email address hidden>) on branch: stable/queens
Review: https://review.openstack.org/576940
Reason: in favor of https://review.openstack.org/#/c/577513/

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

Other bug subscribers