# 建立数据库用户及权限 create database nova; grant all privileges on nova.* to nova@'localhost' identified by 'Abc@123'; grant all privileges on nova.* to nova@'%' identified by 'Abc@123'; create database nova_api; grant all privileges on nova_api.* to nova@'localhost' identified by 'Abc@123'; grant all privileges on nova_api.* to nova@'%' identified by 'Abc@123'; create database nova_cell0; grant all privileges on nova_cell0.* to nova@'localhost' identified by 'Abc@123'; grant all privileges on nova_cell0.* to nova@'%' identified by 'Abc@123'; flush privileges;
# 建立用户、角色、服务、项目、域、端点 source ~/.openstack_admin openstack user create --domain default --password Abc@123 nova openstack role add --project service --user nova admin openstack service create --name nova --description "OpenStack Compute Service" compute openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1 openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1 openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1
# 安装程序包 yum install -y openstack-nova-api openstack-nova-conductor openstack-nova-novncproxy openstack-nova-scheduler openstack-nova-console
# 变更配置文件 cd /etc/nova mv nova.conf nova.conf.org cat > /etc/nova/nova.conf << EOF [DEFAULT] my_ip = 192.168.10.218 enabled_apis = osapi_compute,metadata transport_url = rabbit://openstack:Abc@123@controller user_neutron = true firewall_driver = nova.virt.firewall.NoopFirewallDriver [api_database] connection = mysql+pymysql://nova:Abc@123@controller/nova_api [database] connection = mysql+pymysql://nova:Abc@123@controller/nova [api] auth_strategy = keystone [keystone_authtoken] auth_url = http://controller:5000/v3 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project _name = service username = nova password = Abc@123 [vnc] enabled = true server_listen = \$my_ip server_proxyclient_address = \$my_ip [glance] api_servers = http://controller:9292 [oslo_concurrency] lock_path = /var/lib/nova/tmp [placement] auth_url = http://controller:5000/v3 region_name = RegionOne project_domain_name = default user_domain_name = default project _name = service auth_type = password username = placement password = Abc@123 [scheduler] discover_hosts_in_cells_interval = 300 EOF chmod 640 /etc/nova/nova.conf chown root:nova /etc/nova/nova.conf
# 同步数据库 su -s /bin/bash -c "nova-manage api_db sync" nova su -s /bin/bash -c "nova-manage cell_v2 map_cell0" nova su -s /bin/bash -c "nova-manage cell_v2 create_cell --name cell1 --verbose" nova su -s /bin/bash -c "nova-manage db sync" nova su -s /bin/bash -c "nova-manage cell_v2 list_cells" nova su -s /bin/bash -c "nova-manage cell_v2 discover_hosts --verbose" nova
# 开启服务 systemctl restart openstack-nova-api && systemctl enable openstack-nova-api systemctl restart openstack-nova-scheduler && systemctl enable openstack-nova-scheduler systemctl restart openstack-nova-conductor && systemctl enable openstack-nova-conductor systemctl restart openstack-nova-novncproxy && systemctl enable openstack-nova-novncproxy systemctl restart openstack-nova-consoleauth && systemctl enable openstack-nova-consoleauth
# 验证 openstack compute service list