Ask Your Question
2

ImportError: Class ml2 cannot be found when execute "neutron-db-manage" command

asked 2015-01-08 04:40:33 -0500

grkim gravatar image

updated 2015-01-12 00:43:37 -0500

When I execute "su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf \ --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade juno" neutron" command, I got this error. I could not find the reason, Plz help me!.

No handlers could be found for logger "neutron.common.legacy"
Traceback (most recent call last):
  File "/usr/bin/neutron-db-manage", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python2.6/site-packages/neutron/db/migration/cli.py", line 169, in main
    CONF.command.func(config, CONF.command.name)
  File "/usr/lib/python2.6/site-packages/neutron/db/migration/cli.py", line 82, in do_upgrade_downgrade
    do_alembic_command(config, cmd, revision, sql=CONF.command.sql)
  File "/usr/lib/python2.6/site-packages/neutron/db/migration/cli.py", line 60, in do_alembic_command
    getattr(alembic_command, cmd)(config, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/alembic/command.py", line 124, in upgrade
    script.run_env()
  File "/usr/lib/python2.6/site-packages/alembic/script.py", line 191, in run_env
    util.load_python_file(self.dir, 'env.py')
  File "/usr/lib/python2.6/site-packages/alembic/util.py", line 186, in load_python_file
    module = imp.load_source(module_id, path, open(path, 'rb'))
  File "/usr/lib/python2.6/site-packages/neutron/db/migration/alembic_migrations/env.py", line 42, in <module>
    importutils.import_class(class_path)
  File "/usr/lib/python2.6/site-packages/neutron/openstack/common/importutils.py", line 33, in import_class
    traceback.format_exception(*sys.exc_info())))
ImportError: Class ml2 cannot be found (['Traceback (most recent call last):\n', '  File "/usr/lib/python2.6/site-packages/neutron/openstack/common/importutils.py", line 28, in import_class\n    __import__(mod_str)\n', 'ValueError: Empty module name\n'])
edit retag flag offensive close merge delete

Comments

There are some bugs reported/disucssed in launchpad. Try to use the fix from that.

https://bugs.launchpad.net/neutron/+b...

Ranjit gravatar imageRanjit ( 2015-01-09 01:03:51 -0500 )edit

4 answers

Sort by ยป oldest newest most voted
2

answered 2015-01-09 05:44:20 -0500

dbaxps gravatar image

updated 2015-01-13 03:40:05 -0500

Please, view :- https://ask.openstack.org/en/question...
https://ask.openstack.org/en/question...
Please, run on your Controller :-

[root@juno1f21 ~(keystone_admin)]# rpm -qa | grep ml2
libxml2-python-2.9.1-6.fc21.x86_64
libxml2-2.9.1-6.fc21.x86_64
openstack-neutron-ml2-2014.2.1-1.fc22.noarch

On Ubuntu check presence of packages :-

neutron-server 
neutron-plugin-ml2 
python-neutronclient

and verify your configs per http://docs.openstack.org/juno/instal...
Here goes neutron.conf from F21 Multinode RDO Juno system

[root@juno1f21 neutron(keystone_admin)]# cat neutron.orig
[DEFAULT]
verbose = True
router_distributed = False
debug = False
use_syslog = False
log_dir =/var/log/neutron
bind_host = 0.0.0.0
bind_port = 9696
core_plugin =neutron.plugins.ml2.plugin.Ml2Plugin
service_plugins =neutron.services.l3_router.l3_router_plugin.L3RouterPlugin
auth_strategy = keystone
base_mac = fa:16:3e:00:00:00
mac_generation_retries = 16
dhcp_lease_duration = 86400
dhcp_agent_notification = True
allow_bulk = True
allow_pagination = False
allow_sorting = False
allow_overlapping_ips = True
agent_down_time = 75
router_scheduler_driver = neutron.scheduler.l3_agent_scheduler.ChanceScheduler
dhcp_agents_per_network = 1
api_workers = 2
rpc_workers = 2
use_ssl = False
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
nova_url = http://192.168.1.127:8774/v2
nova_region_name =RegionOne
nova_admin_username =nova
nova_admin_tenant_id =f3f0c2e5bbcc42c9bf2366576a0b222c
nova_admin_password =d9583177a2444f06
nova_admin_auth_url =http://192.168.1.127:35357/v2.0
send_events_interval = 2
kombu_reconnect_delay=1.0
rabbit_host=192.168.1.127
rabbit_port=5672
rabbit_hosts=192.168.1.127:5672
rabbit_use_ssl=False
rabbit_userid=guest
rabbit_password=guest
rabbit_virtual_host=/
rabbit_ha_queues=False
rpc_backend=neutron.openstack.common.rpc.impl_kombu
control_exchange=neutron
[matchmaker_redis]
[matchmaker_ring]
[quotas]
[agent]
root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf
report_interval = 30
[keystone_authtoken]
auth_host = 192.168.1.127
auth_port = 35357
auth_protocol = http
admin_tenant_name = services
admin_user = neutron
admin_password = 808e36e154bd4cee
auth_uri=http://192.168.1.127:5000/
[database]
connection = mysql://neutron:0e2b927a21b44737@192.168.1.127/neutron
max_retries = 10
retry_interval = 10
min_pool_size = 1
max_pool_size = 10
idle_timeout = 3600
max_overflow = 20
[service_providers]
service_provider=LOADBALANCER:Haproxy:neutron.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
service_provider=VPN:openswan:neutron.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default

I am not sure about details ( systems are different ) but pot 9696 is obviously skipped in your config.

edit flag offensive delete link more

Comments

Hi,

This is my lists of configuration files in /etc/neutron directory on "controller" node.

dhcp_agent.ini

fwaas_driver.ini

l3_agent.ini

lbaas_agent.ini

metadata_agent.ini

neutron.conf

plugin.ini -> /etc/neutron/plugins/ml2/ml2_conf.ini

plugins

policy.json

release

rootwrap.co

grkim gravatar imagegrkim ( 2015-01-13 00:08:25 -0500 )edit

And I also chek URLs what you said, but I could not find any soulution . Thanks.

grkim gravatar imagegrkim ( 2015-01-13 00:12:12 -0500 )edit

And I execute "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" command instead of juno in last of my command

grkim gravatar imagegrkim ( 2015-01-13 06:52:37 -0500 )edit

I don't know why official installation guide is not correct. anyway Thanks all!

grkim gravatar imagegrkim ( 2015-01-13 06:53:46 -0500 )edit
2

answered 2015-01-09 01:07:42 -0500

This can happen if you are using an alias for your plugin in neutron.conf.

# (StrOpt) Neutron core plugin entrypoint to be loaded from the
# neutron.core_plugins namespace. See setup.cfg for the entrypoint names of the
# plugins included in the neutron source distribution. For compatibility with
# previous versions, the class name of a plugin can be specified instead of its
# entrypoint name.
#
core_plugin = ml2

Its a bug: https://review.openstack.org/#/c/81221/

You can work around it by putting in the full class name for your plugin in neutron.conf.

I think the full class path is neutron.plugins.ml2.plugin.Ml2Plugin but not 100% sure.

edit flag offensive delete link more

Comments

I did this and it worked, but then it gives me a similar error about "router" -- is there some other full class path I can use for that?

gnychis gravatar imagegnychis ( 2015-01-09 06:25:42 -0500 )edit

I got same router error after change "core_plugin" section

grkim gravatar imagegrkim ( 2015-01-12 00:20:25 -0500 )edit
2

If you have "Class router can not be found" issue please try to replace value in "service_plugins" option from "router" to "neutron.services.l3_router.l3_router_plugin.L3RouterPlugin". I found it in "https://ask.openstack.org/en/question/52502/unable-to-configure-neutron-db-in-juno/".

Chaiwat Jaiton gravatar imageChaiwat Jaiton ( 2015-01-22 01:01:04 -0500 )edit
0

answered 2015-01-12 00:42:22 -0500

grkim gravatar image

updated 2015-01-12 02:41:59 -0500

I chaged core_plugin section in neutron.conf file. But I got another error:

No handlers could be found for logger "neutron.common.legacy" Traceback (most recent call last): File "/usr/bin/neutron-db-manage", line 10, in <module> sys.exit(main()) File "/usr/lib/python2.6/site-packages/neutron/db/migration/cli.py", line 169, in main CONF.command.func(config, CONF.command.name) File "/usr/lib/python2.6/site-packages/neutron/db/migration/cli.py", line 88, in do_stamp sql=CONF.command.sql) File "/usr/lib/python2.6/site-packages/neutron/db/migration/cli.py", line 60, in do_alembic_command getattr(alembic_command, cmd)(config, args, *kwargs) File "/usr/lib/python2.6/site-packages/alembic/command.py", line 214, in stamp script.run_env() File "/usr/lib/python2.6/site-packages/alembic/script.py", line 191, in run_env util.load_python_file(self.dir, 'env.py') File "/usr/lib/python2.6/site-packages/alembic/util.py", line 186, in load_python_file module = imp.load_source(module_id, path, open(path, 'rb')) File "/usr/lib/python2.6/site-packages/neutron/db/migration/alembic_migrations/env.py", line 42, in <module> importutils.import_class(class_path) File "/usr/lib/python2.6/site-packages/neutron/openstack/common/importutils.py", line 33, in import_class traceback.format_exception(*sys.exc_info()))) ImportError: Class router cannot be found (['Traceback (most recent call last):\n', ' File "/usr/lib/python2.6/site-packages/neutron/openstack/common/importutils.py", line 28, in import_class\n __import__(mod_str)\n', 'ValueError: Empty module name\n'])

What can I do to solve this problem?

Thanks


ml2_conf.ini <<<<<<

[ml2]

type_drivers = flat,gre

tenant_network_types = gre

mechanism_drivers = openvswitch

[ml2_type_flat]

[ml2_type_vlan]

[ml2_type_gre]

tunnel_id_ranges = 1:1000

[ml2_type_vxlan]

[securitygroup]

enable_security_group = True

enable_ipset = True

firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver

neutron.conf <<<<<

[DEFAULT]

rpc_backend = rabbit

rabbit_host = controller

rabbit_password = PASSWORD

auth_strategy = keystone

core_plugin = neutron.plugins.ml2.plugin.Ml2Plugin

service_plugins = router

allow_overlapping_ips = True

notify_nova_on_port_status_changes = True

notify_nova_on_port_data_changes = True

nova_url = http://controller:8774/v2

nova_admin_auth_url = http://controller:35357/v2.0

nova_region_name = regionOne

nova_admin_username = nova

nova_admin_tenant_id = 718310229672467dbabc510458990207

nova_admin_password = PASSWORD

verbose = True

[quotas]

[agent]

[keystone_authtoken]

auth_uri = http://controller:5000/v2.0

identity_uri = http://controller:35357

admin_tenant_name = service

admin_user = neutron

admin_password = PASSWORD

[database]

connection = mysql://neutron:PASSWORD@controller/neutron

[service_providers]

I attached my config files, I dont' have neutron-dist.conf file. And I seted "rabbit" for rpc_backend section, I follow this in guide [1]

Thanks [1] http://docs.openstack.org/juno/install-guide/install/yum/content/neutron-controller-node.html (http://docs.openstack.org/juno/instal...)

edit flag offensive delete link more

Comments

Post your ml2_conf.ini,neutron-dist.conf,neutron.conf us an update to your question.

My particular concerns are  "RPC_BACKEND" parameters throughout the config files
dbaxps gravatar imagedbaxps ( 2015-01-12 02:18:43 -0500 )edit

Hi I update my config file above . Plz have a look it. Thanks

grkim gravatar imagegrkim ( 2015-01-12 02:33:32 -0500 )edit

I don't see [OVS], [AGENT] sections in ml2_conf.ini. I am updating answer.

dbaxps gravatar imagedbaxps ( 2015-01-12 02:44:14 -0500 )edit

Hi, My configuration is for controller node not for network node. I met this error on my controller node. In contoller case, ther are no OVS and AGENT setction . Thanks

grkim gravatar imagegrkim ( 2015-01-12 04:29:04 -0500 )edit
0

answered 2016-10-05 08:34:17 -0500

Hi Guys,grkim; is there any solution about this issue ? I met this issue too. thanks

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-01-08 04:39:40 -0500

Seen: 4,943 times

Last updated: Oct 05