Invalid input for operation: Unknown provider:physical_network physnet1
在使用quantum创建network的时报如下错误
quantum net-create --shared ext_net --provider:network_type vlan --provider:physical_network physnet1 --provider:segmentation_id 1104
Invalid input for operation: Unknown provider:physical_network physnet1
我采用的是linuxbridge方式:
/etc/quantum/plugins/linuxbridge# ls /etc/quantum/plugins/linuxbridge/linuxbridge_conf.ini中VLAN部分如下:
tenant_network_type = vlan
network_vlan_ranges = physnet1:1000:2999
按理说应该没问题的
查看下/var/log/quantum/server.log, 发现:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/quantum/api/v2/resource.py", line 82, in resource
result = method(request=request, **args)
File "/usr/lib/python2.7/dist-packages/quantum/api/v2/base.py", line 369, in create
obj = obj_creator(request.context, **kwargs)
File "/usr/lib/python2.7/dist-packages/quantum/plugins/linuxbridge/lb_quantum_plugin.py", line 393, in create_network
network['network'])
File "/usr/lib/python2.7/dist-packages/quantum/plugins/linuxbridge/lb_quantum_plugin.py", line 362, in _process_provider_create
raise q_exc.InvalidInput(error_message=msg)
InvalidInput: Invalid input for operation: Unknown provider:physical_network physnet1:.
打开文件/usr/lib/python2.7/dist-packages/quantum/plugins/linuxbridge/lb_quantum_plugin.py找到362行处
if network_type in [constants.TYPE_VLAN, constants.TYPE_FLAT]:
if physical_network_set:
if physical_network not in self.network_vlan_ranges:
msg = (_("Unknown provider:physical_network %s:") %
physical_network)
raise q_exc.InvalidInput(error_message=msg)
elif 'default' in self.network_vlan_ranges:
physical_network = 'default'
else:
msg = _("provider:physical_network required")
raise q_exc.InvalidInput(error_message=msg)
return (network_type, physical_network, segmentation_id)
显然physical_network not in self.network_vlan_ranges判断结果是False。
于是,在这里加入代码把self.network_vlan_ranges打出来(这里改完代码以后要重启所有quantum服务)
打出来结果为空,
重新检查
/etc/quantum/plugins/linuxbridge# ls /etc/quantum/plugins/linuxbridge/linuxbridge_conf.ini
没有问题
于是,打开debug模式
/etc/quantum/quantum.conf
debug=True
再次运行quantum net-create --shared ext_net --provider:network_type vlan --provider:physical_network physnet1 --provider:segmentation_id 1104
查看server.log, 发现:
2013-11-10 13:07:07 DEBUG [quantum.service] VLANS.network_vlan_ranges = []
2013-11-10 13:07:07 DEBUG [quantum.service] VLANS.tenant_network_type = local
显然,quantum读到的配置有问题,接着往上找,发现:
2013-11-10 13:07:07 DEBUG [quantum.service] config_file = ['/etc/quantum/quantum.conf', '/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini']
原来问题在这里。
因为之前用过openswitch,默认使用的plugin配置文件就是ovs的那个了。
配置在这里:
vi /etc/default/quantum-server
# defaults for quantum-server
# path to config file corresponding to the core_plugin specified in
# quantum.conf
QUANTUM_PLUGIN_CONFIG="/etc/quantum/plugins/linuxbridge/linuxbridge_conf.ini"