部署配置Compute计算节点
安装nova-compute
安装nova-compute的相关组件
yum install openstack-nova-compute MySQL-python -y
安装ceph-fuse客户端,以便可以访问cephfs文件系统
yum install ceph ceph-fuse -y
添加compute节点访问MDS的认证权限
在ceph-node01上执行,获取密钥值并且写入compute节点的目录下
ceph auth get-or-create client.fuse | ssh compute01 tee /ect/ceph/ceph.client.fuse.keyring
同步ceph配置文件
scp -r root@ceph-node01:/etc/ceph/ceph.conf root@compute01:/etc/ceph/
启动ceph-fuse挂载cephfs到nova实例目录,必须加上id和key参数
ceph-fuse -m ceph-node01:6789 /var/lib/nova/instances --id fuse --keyring=/etc/ceph/ceph.client.fuse.keyring
写入启动脚本实现开机自动挂载
echo "ceph-fuse -m ceph-node01:6789 /var/lib/nova/instances --id fuse --keyring=/etc/ceph/ceph.client.fuse.keyring" >> /etc/rc.local
改变实例目录所属的用户权限
chown -R nova:nova /var/lib/nova/instances
启动libvirt管理服务
service libvirtd start
chkconfig libvirtd on
由于nova实例的虚拟磁盘也需要使用ceph rbd,libvrit在信任cephx认证时是需要把id和key绑定virsh的secret
创建一个临时的xml文件指定一些virsh密钥的基本参数
vi secret.xml
<secret ephemeral='no' private='no'>
<usage type='ceph'>
<name>client.volumes secret</name>
</usage>
</secret>
创建一个virsh密钥
virsh secret-define --file secret.xml
返回结果是密钥串
Secret 9a508d43-9695-ca2c-973b-840836e22b31 created
把virsh密钥与volumes池的key以base64编码格式绑定
virsh secret-set-value --secret 9a508d43-9695-ca2c-973b-840836e22b31 --base64 AQCEWRpVGDOsCBAAuGIEzp/FkCc6KPQSaFGAbw==
备份nova配置文件
mv /etc/nova/nova.conf /etc/nova/nova.conf.bak
创建nova配置文件
注意rbd_secret_uuid使用的是libvirt绑定之后的密钥值
笔者这里就是 9a508d43-9695-ca2c-973b-840836e22b31
vi /etc/nova/nova.conf
[DEFAULT]
auth_strategy = keystone
rpc_backend = qpid
qpid_hostname = controller
my_ip = 10.0.0.31
vnc_enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = 10.0.0.31
novncproxy_base_url = http://controller:6080/vnc_auto.html
glance_host = controller
libvirt_inject_password=false
libvirt_inject_key=false
libvirt_inject_partition=-2
libvirt_images_type=rbd
libvirt_images_rbd_pool=volumes
libvirt_images_rbd_ceph_conf=/etc/ceph/ceph.conf
rbd_user=volumes
rbd_secret_uuid= 9a508d43-9695-ca2c-973b-840836e22b31
network_api_class = nova.network.neutronv2.api.API
neutron_url = http://controller:9696
neutron_auth_strategy = keystone
neutron_admin_tenant_name = service
neutron_admin_username = neutron
neutron_admin_password = NEUTRON_PASS
neutron_admin_auth_url = http://controller:35357/v2.0
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver
security_group_api = neutron
[baremetal]
[cells]
[conductor]
[database]
connection = mysql://nova:NOVA_DBPASS@controller/nova
[hyperv]
[image_file_url]
[keymgr]
[keystone_authtoken]
auth_uri = http://controller:5000
auth_host = controller
auth_protocol = http
auth_port = 35357
admin_user = nova
admin_tenant_name = service
admin_password = NOVA_PASS
[libvirt]
virt_type=kvm
[matchmaker_ring]
[metrics]
[osapi_v3]
[rdp]
[spice]
[ssl]
[trusted_computing]
[upgrade_levels]
[vmware]
[xenserver]
[zookeeper]
修改配置文件权限
chown -R root:nova /etc/nova/nova.conf
安装qemu-img
由于源自带的qemu-img版本不支持rbd格式的虚拟磁盘,需要重装带有ceph支持的版本.
笔者安装的是以下版本
qemu-kvm-0.12.1.2-2.415.el6.3ceph.x86_64.rpm
qemu-img-0.12.1.2-2.415.el6.3ceph.x86_64.rpm
启动nova相关服务
service messagebus start
chkconfig messagebus on
service openstack-nova-compute start
chkconfig openstack-nova-compute on
同样的部署步骤添加compute02节点,同时要注意机器名和IP地址必须要修改为对应的