openstack-havana云平台实验(5)
时间:2016-10-10 09:32 来源:潇湘夜雨 作者:华嵩阳 点击:次
三、安装配置Nova
3.1 准备工作
3.1.1 启用网络接口的PROMISC功能
本示例将基于FlatDHCP网络模型,因此其所有工作可以仅通过一个网络接口完成。在所有的节点上,需要为此接口开启“promisc”标志,这可通过如下命令实现。
# ip link set eth0 promisc on
确认其已经启用“PROMISC”功能。
# ip link show eth0
[root@node1 stackimages(keystone_admin)]# ip link show eth0
2: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:f8:c2:31 brd ff:ff:ff:ff:ff:ff
[root@node1 stackimages(keystone_admin)]# service libvirtd status
libvirtd (pid 10765) 正在运行...
[root@node1 stackimages(keystone_admin)]# virsh iface-bridge eth0 br100
Created bridge br100 with attached device eth0
Bridge interface br100 started
[root@node1 stackimages(keystone_admin)]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:f8:c2:31 brd ff:ff:ff:ff:ff:ff
523: br-ex: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/ether 4e:09:99:ec:c4:48 brd ff:ff:ff:ff:ff:ff
inet6 fe80::a078:2aff:fe49:154a/64 scope link
valid_lft forever preferred_lft forever
704: br100: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/ether 00:0c:29:f8:c2:31 brd ff:ff:ff:ff:ff:ff
inet 172.18.109.235/26 brd 172.18.109.255 scope global br100
inet6 fe80::20c:29ff:fef8:c231/64 scope link
valid_lft forever preferred_lft forever
461: ovs-system: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
link/ether 86:5b:81:7f:46:1f brd ff:ff:ff:ff:ff:ff
462: br-int: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/ether a2:e8:7f:79:95:49 brd ff:ff:ff:ff:ff:ff
inet6 fe80::d0ba:3dff:fe48:83cf/64 scope link
valid_lft forever preferred_lft forever
查看桥接接口的信息。
# brctl show
bridge name bridge id STP enabled interfaces
br100 8000.000c29ed4c10 no eth0
virbr0 8000.5254003bee3a yes virbr0-nic
3.1.2 启动messagbus服务
# service messagebus start
# chkconfig messagebus on
[root@node1 stackimages(keystone_admin)]# service messagebus status
messagebus (pid 1590) 正在运行...
3.2 安装nova
# yum install openstack-utils memcached qpid-cpp-server
# yum install openstack-nova
初始化nova数据库,同时创建其服务同名的用户,并为其指定密码,这里选择使用与服务名同名的密码nova。
[root@node1 stackimages(keystone_admin)]# openstack-db --init --service nova --password nova
nova default DB is not mysql. Would you like to reset to mysql now? (y/n): y
Please enter the password for the 'root' MySQL user:
Verified connectivity to MySQL.
Creating 'nova' database.
Initializing the nova database, please wait...
Complete!
如果不想使用默认的nova用户访问其数据,也可以使用下面的命令为nova创建数据库及相关的用户。
# mysql -uroot -p
mysql> CREATE DATABASE nova;
mysql> GRANT ALL ON nova.* TO 'NOVA_USER'@'%' IDENTIFIED BY 'NOVA_PASS';
mysql> GRANT ALL ON nova.* TO 'NOVA_USER'@'localhost' IDENTIFIED BY 'NOVA_PASS';
mysql> FLUSH PRIVILEGES;
3.3 配置nova
3.3.1 编辑配置文件/etc/nova/nova.conf,修改其内容如下所示:
[DEFAULT]
my_ip=172.18.109.235
state_path=/var/lib/nova
network_manager=nova.network.manager.FlatDHCPManager
api_paste_config=/etc/nova/api-paste.ini
auth_strategy=keystone
novncproxy_host=0.0.0.0
novncproxy_port=6080
instance_name_template=instance-%08x
dhcpbridge_flagfile=/etc/nova/nova.conf
public_interface=eth0
dhcpbridge=/usr/bin/nova-dhcpbridge
flat_network_bridge=br100
flat_interface=eth0
vlan_interface=eth0
fixed_range=172.18.109.192/26
force_dhcp_release=True
log_dir=/var/log/nova
rpc_backend=nova.openstack.common.rpc.impl_qpid
qpid_hostname=172.18.109.235
qpid_port=5672
firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
libvirt_type=qemu
live_migration_uri=qemu+tcp://%s/system
live_migration_flag=VIR_MIGRATE_UNDEFINE_SOURCE, VIR_MIGRATE_PEER2PEER
novncproxy_base_url=http://172.18.109.235:6080/vnc_auto.html
vncserver_listen=172.18.109.235
vncserver_proxyclient_address=172.18.109.235
vnc_enabled=true
connection=mysql://nova:nova@172.18.109.235/nova
volume_driver=nova.virt.baremetal.volume_driver.LibvirtVolumeDriver
[keystone_authtoken]
admin_tenant_name=service
admin_user=nova
admin_password=nova
auth_host=172.18.109.235
auth_port=35357
auth_protocol=http
auth_version=v2.0
signing_dir=/var/lib/nova/keystone-signing
如果要开启api还需添加认证方式和密码到文件/etc/nova/api-paste.ini
[filter:authtoken]
paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
auth_host = 172.18.109.235
auth_port = 35357
auth_protocol = http
auth_uri = http://172.18.109.235:5000/v2.0
admin_tenant_name = service
admin_user = nova
admin_password = nova
说明:KVM虚拟化要求CPU支持svm或vmx,因此,这里的Openstack所在的系统RHEL6.4必须直接运行于支持这两种特性之一的CPU平台上。如果整个过程是在虚拟机上进行测试的话,比如Openstack所安装的系统RHEL6.4本身就运行于虚拟上,那么,虚拟化技术只能使用qemu而不能使用KVM。此种情形下,需要执行如下步骤,在RHEL6.4启动对qemu的支持。
(1)安装libguestfs-tools
# yum -y install libguestfs-tools
(2)设定libvirt类型为qemu
openstack-config --set /etc/nova/nova.conf DEFAULT libvirt_type qemu
(3)为qemu-kvm创建所需要链接
# ln -sv /usr/libexec/qemu-kvm /usr/bin/qemu
(4)重启libvirtd服务
# service libvirtd restart
3.3.2 导入或迁移nova数据库
# nova-manage db sync
3.2.3 安装配置qpid队列服务
# yum install -y qpid-cpp-server
# sed -i -e 's/auth=.*/auth=no/g' /etc/qpidd.conf
# service qpidd start
# chkconfig qpidd on
3.3.4 启动服务
首先创建nova服务的锁文件目录,并将其权限赋予nova用户。
# mkdir /var/lock/nova
# chown -R nova.nova /var/lock/nova/
而后启动nova相关的服务,并将其设置为开机自动启动。
# for svc in api compute network cert console scheduler; do service openstack-nova-$svc start; chkconfig openstack-nova-$svc on; done
查看服务启动状况:
[root@node1 ~(keystone_admin)]# nova-manage service list
Binary Host Zone Status State Updated_At
nova-console node1.test.com internal enabled :-) 2016-10-06 05:23:09 (责任编辑:liangzh) |