安装 nova
预配置
创建数据库
1 2 3 4 5 6 7 create database nova;create database nova_api;create database nova_cell0;grant all privileges on nova.* to 'nova' @'%' identified by 'nova_dbpass' ;grant all privileges on nova_api.* to 'nova' @'%' ;grant all privileges on nova_cell0.* to 'nova' @'%' ;
引用环境变量
1 source /opt/data/openstack/admin_openrc
创建用户并加入角色
1 2 openstack user create --domain default --password-prompt nova openstack role add --project service --user nova admin
创建服务
1 openstack service create --name nova --description "OpenStack Compute" compute
创建 api 节点
1 2 3 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
安装服务-controller 节点
1 apt install -y nova-api nova-conductor nova-novncproxy nova-scheduler
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 [api_database] connection = mysql+pymysql://nova:nova_dbpass@controller/nova_api # ... [database] connection = mysql+pymysql://nova:nova_dbpass@controller/nova # ... [DEFAULT] #log_dir = /var/log/nova transport_url = rabbit://openstack:rabbitmq_pass@controller:5672/ my_ip = 10.0.0.11 # ... [api] auth_strategy = keystone # ... [keystone_authtoken] www_authenticate_uri = http://controller:5000/ memcached_servers = controller:11211 auth_type = password auth_url = http://controller:5000/ project_domain_name = Default user_domain_name = Default username = nova password = nova_pass # ... [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_type = password auth_url = http://controller:5000/v3 project_name = service project_domain_name = Default username = placement user_domain_name = Default password = placement_pass region_name = RegionOne
同步数据
1 2 3 4 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=cell --verbose" nova su -s /bin/bash -c "nova-manage db sync" nova
验证
1 su -s /bin/bash -c "nova-manage cell_v2 list_cells" nova
重启服务
1 2 3 4 systemctl restart nova-api.service systemctl restart nova-scheduler.service systemctl restart nova-conductor.service systemctl restart nova-novncproxy.service
安装服务-compute节点
1 2 3 apt install -y nova-compute sudo vim /etc/nova/nova.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 [Default] # ... transport_url = rabbit://openstack:RABBIT_PASS@controller my_ip = 10.0.0.21 [api] # ... auth_strategy = keystone [ [keystone_authtoken] # ... www_authenticate_uri = http://controller:5000/ auth_url = http://controller:5000/ memcached_servers = controller:11211 auth_type = password project_domain_name = Default user_domain_name = Default project_name = service username = nova password = NOVA_PASS [service_user] # ... send_service_user_token = true auth_url = https://controller/identity auth_strategy = keystone auth_type = password project_domain_name = Default project_name = service user_domain_name = Default username = nova password = NOVA_PASS [vnc] # ... enabled = true server_listen = 0.0.0.0 server_proxyclient_address = $my_ip novncproxy_base_url = http://controller:6080/vnc_auto.html [glance] # ... api_servers = http://controller:9292 [oslo_concurrency] # ... lock_path = /var/lib/nova/tmp [placement] # ... auth_type = password auth_url = http://controller:5000/v3 project_name = service project_domain_name = Default username = placement user_domain_name = Default password = PLACEMENT_PASS region_name = RegionOne
查看服务器是否支持硬件加速,如果是0,表示不支持,需要修改如下配置
1 egrep -c '(vmx|svm)' /proc/cpuinfo
1 2 3 [libvirt] # ... virt_type = qemu
自动注册计算节点
1 2 3 [scheduler] # ... discover_hosts_in_cells_interval = 300
重启服务
1 systemctl restart nova-compute
controller 节点添加数据
1 2 3 source /opt/data/openstack/admin_openrcsu -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
1 2 3 4 openstack compute service list openstack catalog list openstack image list sudo nova-status upgrade check
https://docs.openstack.org/nova/yoga/install/controller-install-ubuntu.html