因为有些 IP 地址是我们局域网正在用的,新建的 VM 不能占用这些 IP,所以需要划分一些 IP 留给 OpenStack Nova 用,需要进入数据库后修改 fixed_ips 这个表的 reserved 为 0,比如我们想把 172.16.39.222-226 这5个 IP 留给 OpenStack Nova instances:
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 135
Server version: 5.1.54-1ubuntu4 (Ubuntu)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use nova;
Database changed
mysql> update fixed_ips set reserved = '1';
Query OK, 6 rows affected (0.00 sec)
Rows matched: 1448 Changed: 6 Warnings: 0
mysql> update fixed_ips set reserved = '0' where address='172.16.39.222';
mysql> update fixed_ips set reserved = '0' where address='172.16.39.223';
mysql> update fixed_ips set reserved = '0' where address='172.16.39.224';
mysql> update fixed_ips set reserved = '0' where address='172.16.39.225';
mysql> update fixed_ips set reserved = '0' where address='172.16.39.226';
复制代码
重启 OpenStack Nova 的各个模块,然后新建一个 ubuntu instance 测试一下是否得到了正确的 IP 并能 ping 通网关(172.16.38.1)。
遇到了错误,log如下
2012-02-24 15:26:38,239 CRITICAL nova [-] –bridge is required to create a network.
(nova): TRACE: Traceback (most recent call last):
(nova): TRACE: File “/usr/bin/nova-manage”, line 2141, in
(nova): TRACE: main()
(nova): TRACE: File “/usr/bin/nova-manage”, line 2129, in main
(nova): TRACE: fn(*fn_args, **fn_kwargs)
(nova): TRACE: File “/usr/bin/nova-manage”, line 766, in create
(nova): TRACE: raise exception.NetworkNotCreated(req=’–bridge’)
(nova): TRACE: NetworkNotCreated: –bridge is required to create a network.
本来用的是Flatdhcp,后来改成和你一样的flat模式,但是结果依旧,ifconfig结果表示
br100正常接受和发送数据,请教一下可能是什么问题。
(PS:之前nova-manage create能正常执行,但是实例ping不同,再后来就instance直接一直pending mykey了,就重新装了一遍nova,结network就出问题了,请指教。)
回答:
上面错误提示很清楚 –bridge is required to create a network,需要有 bridge,检查一下是否有 br100,没有的话需要安装 apt-get install bridge-utils 并且配置 /etc/network/interface
$ ifconfig
br100 Link encap:Ethernet HWaddr 00:1b:24:92:a2:42