Changes to VLAN mapping results in "is not mapped" error

Bug #1743425 reported by Tyler Bishop on 2018-01-15
44
This bug affects 9 people
Affects Status Importance Assigned to Milestone
neutron
High
Mark McClain

Bug Description

With neutron-server if you enable the type_drivers = vlan and set a mapping in [ml2_type_vlan] then install the neutron database, the service will start and map successfully.

However if you change the mapping after and restart the service you will receive error:

2018-01-15 11:50:36.875 9764 ERROR neutron File "/usr/lib/python2.7/site-packages/neutron/plugins/ml2/drivers/type_vlan.py", line 133, in _sync_vlan_allocations
2018-01-15 11:50:36.875 9764 ERROR neutron ctx.session.delete(alloc)
2018-01-15 11:50:36.875 9764 ERROR neutron File "/usr/lib64/python2.7/site-packages/sqlalchemy/orm/session.py", line 1744, in delete
2018-01-15 11:50:36.875 9764 ERROR neutron raise exc.UnmappedInstanceError(instance)
2018-01-15 11:50:36.875 9764 ERROR neutron UnmappedInstanceError: Class 'neutron.objects.plugins.ml2.vlanallocation.VlanAllocation' is not mapped
2018-01-15 11:50:36.875 9764 ERROR neutron

plugin.ini:
[ml2]
type_drivers = vlan
tenant_network_types = vlan
mechanism_drivers = openvswitch

[ml2_type_vlan]
network_vlan_ranges = physnet0:2:4000

sync DB:
 su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron

Start neutron-server, Success!

Now change plugin.ini to the following:

[ml2_type_vlan]
network_vlan_ranges = physnet1:2:4000

Restart neutron-server. Failure!

Versions:
openstack-neutron-11.0.2-3.el7.noarch
openstack-neutron-ml2-11.0.2-3.el7.noarch
openstack-neutron-common-11.0.2-3.el7.noarch
openstack-neutron-openvswitch-11.0.2-3.el7.noarch
openstack-neutron-linuxbridge-11.0.2-3.el7.noarch
python-neutron-11.0.2-3.el7.noarch
python-neutron-lib-1.9.1-1.el7.noarch
python2-neutronclient-6.5.0-1.el7.noarch

pip
neutron==11.0.2
neutron-lib==1.9.1
python-neutronclient==6.5.0

CentOS 7 @ 3.10.0-693.11.6.el7.x86_64

Tomasz Setkowski (s-tom-a) wrote :
Download full text (11.9 KiB)

I can confirm this. I am getting exactly same behavior. It looks as if original network name stays in database, then fails if configuration does not map it to anything.

I am deploying openstack from source:
Version:
neutron-11.0.1.tar.gz

Stackstrace:

Unrecoverable error: please check log for details.: UnmappedInstanceError: Class 'neutron.objects.plugins.ml2.vlanallocation.VlanAllocation' is not mapped
2018-01-17 20:05:39.647 6 ERROR neutron.service Traceback (most recent call last):
2018-01-17 20:05:39.647 6 ERROR neutron.service File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/neutron/service.py", line 86, in serve_wsgi
2018-01-17 20:05:39.647 6 ERROR neutron.service service.start()
2018-01-17 20:05:39.647 6 ERROR neutron.service File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/neutron/service.py", line 62, in start
2018-01-17 20:05:39.647 6 ERROR neutron.service self.wsgi_app = _run_wsgi(self.app_name)
2018-01-17 20:05:39.647 6 ERROR neutron.service File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/neutron/service.py", line 289, in _run_wsgi
2018-01-17 20:05:39.647 6 ERROR neutron.service app = config.load_paste_app(app_name)
2018-01-17 20:05:39.647 6 ERROR neutron.service File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/neutron/common/config.py", line 122, in load_paste_app
2018-01-17 20:05:39.647 6 ERROR neutron.service app = loader.load_app(app_name)
2018-01-17 20:05:39.647 6 ERROR neutron.service File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/oslo_service/wsgi.py", line 353, in load_app
2018-01-17 20:05:39.647 6 ERROR neutron.service return deploy.loadapp("config:%s" % self.config_path, name=name)
2018-01-17 20:05:39.647 6 ERROR neutron.service File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
2018-01-17 20:05:39.647 6 ERROR neutron.service return loadobj(APP, uri, name=name, **kw)
2018-01-17 20:05:39.647 6 ERROR neutron.service File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
2018-01-17 20:05:39.647 6 ERROR neutron.service return context.create()
2018-01-17 20:05:39.647 6 ERROR neutron.service File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
2018-01-17 20:05:39.647 6 ERROR neutron.service return self.object_type.invoke(self)
2018-01-17 20:05:39.647 6 ERROR neutron.service File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 144, in invoke
2018-01-17 20:05:39.647 6 ERROR neutron.service **context.local_conf)
2018-01-17 20:05:39.647 6 ERROR neutron.service File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
2018-01-17 20:05:39.647 6 ERROR neutron.service val = callable(*args, **kw)
2018-01-17 20:05:39.647 6 ERROR neutron.service File "/var/lib/kolla/venv/local/lib/python2.7/site-packages/paste/urlmap.py", line 31, in urlmap_factory
2018-01-17 20:05:39.647 6 ERROR neutron.service app = loader.get_app(app_name, global_conf=global_conf)
2018-01-17 20:05:39...

Matt Faraday (lordxenu) wrote :
Download full text (11.9 KiB)

Would also like to confirm this. Can't quite understand it as I did a packstack all in one, modified the neutron settings and it all worked... but when I deployed fully to a cluster and then edited using the exact same config settings it fails.

Here's my ml2_conf.ini

[ml2_type_vlan]
network_vlan_ranges = vlan197:197:197

[ovs]
bridge_mappings = vlan197:br-vlan

and my openvswitch_agent.ini

bridge_mappings = vlan197:br-vlan

upon restarting neutron server I get

2018-02-13 19:26:25.154 17030 ERROR neutron.service [req-e79459aa-626c-4e6c-9616-e536f85cd622 - - - - -] Unrecoverable error: please check log for details.: UnmappedInstanceError: Class 'neutron.objects.plugins.ml2.vlanallocation.VlanAllocation' is not mapped
2018-02-13 19:26:25.154 17030 ERROR neutron.service Traceback (most recent call last):
2018-02-13 19:26:25.154 17030 ERROR neutron.service File "/usr/lib/python2.7/site-packages/neutron/service.py", line 86, in serve_wsgi
2018-02-13 19:26:25.154 17030 ERROR neutron.service service.start()
2018-02-13 19:26:25.154 17030 ERROR neutron.service File "/usr/lib/python2.7/site-packages/neutron/service.py", line 62, in start
2018-02-13 19:26:25.154 17030 ERROR neutron.service self.wsgi_app = _run_wsgi(self.app_name)
2018-02-13 19:26:25.154 17030 ERROR neutron.service File "/usr/lib/python2.7/site-packages/neutron/service.py", line 289, in _run_wsgi
2018-02-13 19:26:25.154 17030 ERROR neutron.service app = config.load_paste_app(app_name)
2018-02-13 19:26:25.154 17030 ERROR neutron.service File "/usr/lib/python2.7/site-packages/neutron/common/config.py", line 122, in load_paste_app
2018-02-13 19:26:25.154 17030 ERROR neutron.service app = loader.load_app(app_name)
2018-02-13 19:26:25.154 17030 ERROR neutron.service File "/usr/lib/python2.7/site-packages/oslo_service/wsgi.py", line 353, in load_app
2018-02-13 19:26:25.154 17030 ERROR neutron.service return deploy.loadapp("config:%s" % self.config_path, name=name)
2018-02-13 19:26:25.154 17030 ERROR neutron.service File "/usr/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
2018-02-13 19:26:25.154 17030 ERROR neutron.service return loadobj(APP, uri, name=name, **kw)
2018-02-13 19:26:25.154 17030 ERROR neutron.service File "/usr/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
2018-02-13 19:26:25.154 17030 ERROR neutron.service return context.create()
2018-02-13 19:26:25.154 17030 ERROR neutron.service File "/usr/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
2018-02-13 19:26:25.154 17030 ERROR neutron.service return self.object_type.invoke(self)
2018-02-13 19:26:25.154 17030 ERROR neutron.service File "/usr/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 144, in invoke
2018-02-13 19:26:25.154 17030 ERROR neutron.service **context.local_conf)
2018-02-13 19:26:25.154 17030 ERROR neutron.service File "/usr/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
2018-02-13 19:26:25.154 17030 ERROR neutron.service val = callable(*args, **kw)
2018-02-13 19:26:25.154 17030 ERROR neutron.service File "/usr/lib/python2.7/site-...

Matt Faraday (lordxenu) wrote :

I can pretty much reproduce this at will now.

steps:

with a working installation of neutron, edit /etc/neutron/plugins/ml2/ml2_conf.ini

change network_vlan_ranges= xxx to anything else. invent a new network and put it in here

then in /etc/neutron/plugins/ml2/openvswitch_agent change

bridge_mappings= old_br_name to

bridge_mappings= new_br_name

Then restart neutron-server and it will fail.

Change the values back to their previous values and it will start.
Even if you delete the networks from neutron/openstack it still won't allow you to change them.

How am I supposed to remove the vlan mapping and bridge mapping for networks I've deleted ? It seems to want to keep them in the config file or else it will result in neutron spitting out the error UnmappedInstanceError: Class 'neutron.objects.plugins.ml2.vlanallocation.VlanAllocation' is not mapped

Matt Faraday (lordxenu) wrote :

And I found my solution (sorry for the constant comments but I hope it helps someone)

I had to login to mysql as the neutron user (password was found in neutron.conf)

Then I had to select neutron DB and run command

MariaDB [neutron]> TRUNCATE TABLE ml2_vlan_allocations;

Now I am able to change the network_vlan_ranges in ml2_conf.ini and the bridge_mappings directives in openvswitch_agent.ini

No idea why it's keeping those old entries in the database when nothing is using them.
But this resolved it for me.

Changed in neutron:
importance: Undecided → High
status: New → Confirmed
Changed in neutron:
assignee: nobody → Mark McClain (markmcclain)
status: Confirmed → In Progress

Reviewed: https://review.openstack.org/569295
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=6bfbfdbb3db4daf815da6d1a16706f2eec0a2e35
Submitter: Zuul
Branch: stable/queens

commit 6bfbfdbb3db4daf815da6d1a16706f2eec0a2e35
Author: zhsun <email address hidden>
Date: Mon Jan 15 11:12:40 2018 +0800

    Fix delete vlan allocation error for ML2

    Method "delete()" of ovo object should be invoked.
    Closes-bug: #1743425
    Change-Id: I942e1a5072ce111beb94ffd6298bb3e23e2bb343
    (cherry picked from commit 6c4bc1cf0585bdbe3701e0a2a87659881f5b1c73)

tags: added: in-stable-queens

Reviewed: https://review.openstack.org/569296
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=e50a0b7c118fafcb46a545db28a025ecf3a615d4
Submitter: Zuul
Branch: stable/pike

commit e50a0b7c118fafcb46a545db28a025ecf3a615d4
Author: zhsun <email address hidden>
Date: Mon Jan 15 11:12:40 2018 +0800

    Fix delete vlan allocation error for ML2

    Method "delete()" of ovo object should be invoked.

    Closes-bug: #1743425
    Change-Id: I942e1a5072ce111beb94ffd6298bb3e23e2bb343
    (cherry picked from commit 6c4bc1cf0585bdbe3701e0a2a87659881f5b1c73)

tags: added: in-stable-pike

This issue was fixed in the openstack/neutron 12.0.3 release.

This issue was fixed in the openstack/neutron 11.0.5 release.

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

Other bug subscribers