二.安装quantum模块
首先,需要保证quantum的版本和其他模块的版本匹配(我安装的是quantum-2012.2版本),否则会出如下错误:
Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/cliff/app.py", line 249, in run_subcommand result = cmd.run(parsed_args) File "/usr/local/lib/python2.7/dist-packages/python_quantumclient-0.0.0-py2.7.egg/quantumclient/common/command.py", line 35, in run return super(OpenStackCommand, self).run(parsed_args) File "/usr/local/lib/python2.7/dist-packages/cliff/display.py", line 84, in run column_names, data = self.take_action(parsed_args) File "/usr/local/lib/python2.7/dist-packages/python_quantumclient-0.0.0-py2.7.egg/quantumclient/common/command.py", line 41, in take_action return self.get_data(parsed_args) File "/usr/local/lib/python2.7/dist-packages/python_quantumclient-0.0.0-py2.7.egg/quantumclient/quantum/v2_0/__init__.py", line 255, in get_data data = obj_creator(body) File "/usr/local/lib/python2.7/dist-packages/python_quantumclient-0.0.0-py2.7.egg/quantumclient/v2_0/client.py", line 102, in with_params ret = self.function(instance, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/python_quantumclient-0.0.0-py2.7.egg/quantumclient/v2_0/client.py", line 262, in create_network return self.post(self.networks_path, body=body) File "/usr/local/lib/python2.7/dist-packages/python_quantumclient-0.0.0-py2.7.egg/quantumclient/v2_0/client.py", line 593, in post headers=headers, params=params) File "/usr/local/lib/python2.7/dist-packages/python_quantumclient-0.0.0-py2.7.egg/quantumclient/v2_0/client.py", line 518, in do_request self._handle_fault_response(status_code, replybody) File "/usr/local/lib/python2.7/dist-packages/python_quantumclient-0.0.0-py2.7.egg/quantumclient/v2_0/client.py", line 499, in _handle_fault_response exception_handler_v20(status_code, des_error_body) File "/usr/local/lib/python2.7/dist-packages/python_quantumclient-0.0.0-py2.7.egg/quantumclient/v2_0/client.py", line 82, in exception_handler_v20 message=message) QuantumClientException: 404 Not Found The resource could not be found.
头疼的错误,及其不好找,卡了我两个礼拜...
安装过程:
1.安装openvswitch,具体过程参见之前写的博客
2.安装quantum,过程没啥好说的
启动quantum:
quantum一共有四部分,他们的启动顺序有一定要求
1.sudo quantum-openvswitch-agent --config-file=/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini 2.sudo quantum-server --config-file=/etc/quantum/quantum.conf --config-file=/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini 3.sudo quantum-dhcp-agent --config-file=/etc/quantum/quantum.conf --config-file=/etc/quantum/dhcp_agent.ini 4.sudo quantum-l3-agent --config-file=/etc/quantum/l3_agent.ini
调试quantum过程中遇到的各种小错误:
1.日志输出AMQP server on localhost:5672 is unreachable问题的解决方法
/etc/quantum/quantum.conf配置文件中 配置rabbit的内容
[default]
rabbit_password = 123456
rabbit_host = localhost
2.endpoint错误解决方法
需要在keystone里为每个服务配置endpoint
3.启动nova-compute的ImportError: No module named quantum.manager问题
注释掉nova.conf中的network_manager即可
4.修复启动quantum-l3-agent时导入模块错误
sed -i 's/quantum-l3-agent = quantum.agent.l3_nat_agent:main/quantum-l3-agent = quantum.agent.l3_agent:main/g' setup.py
5.修复eventlet一个bug
sed -i 's/def wait(self, check_interval=0.01):/def wait(self, check_interval=0.01,timeout=None):/g' /usr/lib/python2.6/site-packages/eventlet/green/subprocess.py
6.quantum-dhcp启动问题
报错:
2012-12-11 14:47:12 INFO [quantum.openstack.common.rpc.common] Connected to AMQP server on localhost:5672 2012-12-11 14:48:12 ERROR [quantum.openstack.common.rpc.common] Timed out waiting for RPC response: timed out
需要在quantum-dhcp 的启动命令里加quantum.conf配置文件
7.启动quantum-server时Cannot operate on a closed database的问题:
quantum-server启动要加ovs插件的配置文件
8.quantum-server net-list出错
报错:
2012-12-12 14:20:52 ERROR [quantum.openstack.common.policy] Failed to understand rule u'l' Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/quantum-2012.2-py2.7.egg/quantum/openstack/common/policy.py", line 161, in _check ValueError: need more than 1 value to unpack /etc/quantum/policy.py
用/opt/stack/quantum/etc/policy.py覆盖etc/quantum下的同名文件即可
9.虚拟机分配不到ip地址问题
需要先用quantum创建net subnet router等等
tenant_id=`keystone tenant-list |awk '/ admin/ {print $2}'` net_id=`quantum net-create --tenant-id $tenant_id net_one --provider:network_type flat --provider:physical_network physnet1 |awk '/ id/ {print $4}'` subnet_id=`quantum subnet-create --tenant-id $tenant_id --ip_version 4 --gateway 10.0.0.1 $net_id 10.0.0.0/24 -- --enable_dhcp=True |awk '/ id/ {print $4}'` router_id=`quantum router-create --tenant-id $tenant_id router1 |awk '/ id/ {print $4}'` quantum router-interface-add $router_id $subnet_id
quantum.conf的相关配置进行调整
sed -i 's/sql_connection = sqlite:\/\//sql_connection = mysql:\/\/root:123456@localhost\/ovs_quantum/g' /etc/quantum/quantum/plugins/openvswitch/ovs_quantum_plugin.ini sed -i '24a tenant_network_type = none' /etc/quantum/quantum/plugins/openvswitch/ovs_quantum_plugin.ini sed -i '36a network_vlan_ranges = physnet1' /etc/quantum/quantum/plugins/openvswitch/ovs_quantum_plugin.ini sed -i '43a enable_tunneling = False' /etc/quantum/quantum/plugins/openvswitch/ovs_quantum_plugin.ini sed -i '60a integration_bridge = br-int' /etc/quantum/quantum/plugins/openvswitch/ovs_quantum_plugin.ini sed -i '81a bridge_mappings = physnet1:br-int' /etc/quantum/quantum/plugins/openvswitch/ovs_quantum_plugin.ini