7.添加OpenStack计算服务
添加计算服务
安装和配置控制器节点
创建数据库
mysql -uroot -ptoyo123 CREATE DATABASE nova; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \ IDENTIFIED BY 'toyo123'; GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \ IDENTIFIED BY 'toyo123'; exit
创建服务凭据
source admin-openrc.sh keystone user-create --name nova --pass Abcd1234 keystone user-role-add --user nova --tenant service --role admin keystone service-create --name nova --type compute \ --description "OpenStack Compute" keystone endpoint-create \ --service-id $(keystone service-list | awk '/ compute / {print $2}') \ --publicurl http://controller:8774/v2/%\(tenant_id\)s \ --internalurl http://controller:8774/v2/%\(tenant_id\)s \ --adminurl http://controller:8774/v2/%\(tenant_id\)s \ --region regionOne
安装和配置计算控制器件
yum install -y openstack-nova-api openstack-nova-cert openstack-nova-conductor \ openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler \ python-novaclient
编辑 /etc/nova/nova.conf文件
mv /etc/nova/nova.conf /etc/nova/nova.conf_bak vim /etc/nova/nova.conf [database] connection = mysql://nova:toyo123@controller/nova [DEFAULT] rpc_backend = rabbit rabbit_host = controller rabbit_password = Abcd1234 auth_strategy = keystone verbose = True my_ip = 192.168.116.8 vncserver_listen = 192.168.116.8 vncserver_proxyclient_address = 192.168.116.8 [keystone_authtoken] auth_uri = http://controller:5000/v2.0 identity_uri = http://controller:35357 admin_tenant_name = service admin_user = nova admin_password = Abcd1234 [glance] host = controller
填充数据库并启动服务与设置开机自启动
su -s /bin/sh -c "nova-manage db sync" nova systemctl enable openstack-nova-api.service openstack-nova-cert.service \ openstack-nova-consoleauth.service openstack-nova-scheduler.service \ openstack-nova-conductor.service openstack-nova-novncproxy.service systemctl restart openstack-nova-api.service openstack-nova-cert.service \ openstack-nova-consoleauth.service openstack-nova-scheduler.service \ openstack-nova-conductor.service openstack-nova-novncproxy.service
安装和配置计算节点
安装软件包:
yum install -y openstack-nova-compute sysfsutils
编辑/etc/nova/nova.conf件
mv /etc/nova/nova.conf /etc/nova/nova.conf_bak vim /etc/nova/nova.conf [DEFAULT] rpc_backend = rabbit rabbit_host = controller rabbit_password = Abcd1234 auth_strategy = keystone my_ip = 192.168.116.7 vnc_enabled = True vncserver_listen = 0.0.0.0 vncserver_proxyclient_address = 192.168.116.7 novncproxy_base_url = http://controller:6080/vnc_auto.html verbose = True [keystone_authtoken] auth_uri = http://controller:5000/v2.0 identity_uri = http://controller:35357 admin_tenant_name = service admin_user = nova admin_password = Abcd1234 [glance] host = controller
确定你的计算节点是否支持硬件加速虚拟机:
egrep -c '(vmx|svm)' /proc/cpuinfo
如果此命令返回的值 一或更大,你的计算节点支持硬件加速,这通常不需要额外的配置。如果
此命令返回的值为零,你的计算节点不支持硬件加速,你必须配置libvirt的使用,而不是KVM的QEMU
vim /etc/nova/nova.conf
[libvirt]
virt_type = qemu
启动服务并设置为自启动
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl restart libvirtd.service openstack-nova-compute.service
验证操作
source admin-openrc.sh nova service-list nova image-list