添加计算服务
安装和配置控制器节点
创建数据库
mysql -uroot -ptoyo123CREATE 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.shkeystone user-create --name nova --pass Abcd1234keystone user-role-add --user nova --tenant service --role adminkeystone 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_bakvim /etc/nova/nova.conf[database]connection = mysql://nova:toyo123@controller/nova[DEFAULT]rpc_backend = rabbitrabbit_host = controllerrabbit_password = Abcd1234auth_strategy = keystoneverbose = Truemy_ip = 192.168.116.8vncserver_listen = 192.168.116.8vncserver_proxyclient_address = 192.168.116.8[keystone_authtoken]auth_uri = http://controller:5000/v2.0identity_uri = http://controller:35357admin_tenant_name = serviceadmin_user = novaadmin_password = Abcd1234[glance]host = controller
填充数据库并启动服务与设置开机自启动
su -s /bin/sh -c "nova-manage db sync" novasystemctl enable openstack-nova-api.service openstack-nova-cert.service \ openstack-nova-consoleauth.service openstack-nova-scheduler.service \ openstack-nova-conductor.service openstack-nova-novncproxy.servicesystemctl 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_bakvim /etc/nova/nova.conf[DEFAULT]rpc_backend = rabbitrabbit_host = controllerrabbit_password = Abcd1234auth_strategy = keystonemy_ip = 192.168.116.7vnc_enabled = Truevncserver_listen = 0.0.0.0vncserver_proxyclient_address = 192.168.116.7novncproxy_base_url = http://controller:6080/vnc_auto.htmlverbose = True[keystone_authtoken]auth_uri = http://controller:5000/v2.0identity_uri = http://controller:35357admin_tenant_name = serviceadmin_user = novaadmin_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.servicesystemctl restart libvirtd.service openstack-nova-compute.service
验证操作
source admin-openrc.shnova service-listnova image-list