一、首先登录controller1创建nova数据库,并赋于远程和本地访问的权限。
 
 
mysql -u root -p
 
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost'  IDENTIFIED BY 'venic8888';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%'  IDENTIFIED BY 'venic8888';
flush PRIVILEGES;
 
 
二、身份认证调用
使用1台controller1创建身份认证调用
 
source admin-openrc.sh
 
openstack user create --domain default --password-prompt nova
User Password:
Repeat User Password:
+-----------+----------------------------------+
| Field     | Value                            |
+-----------+----------------------------------+
| domain_id | default                          |
| enabled   | True                             |
| id        | 8c46e4760902464b889293a74a0c90a8 |
| name      | nova                             |
+-----------+----------------------------------+
 
 openstack role add --project service --user nova admin
 
 openstack service create --name nova --description "OpenStack Compute" compute
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Compute                |
| enabled     | True                             |
| id          | 060d59eac51b4594815603d75a00aba2 |
| name        | nova                             |
| type        | compute                          |
+-------------+----------------------------------+
 
 
 openstack endpoint create --region RegionOne compute public http://controller:8774/v2/%\(tenant_id\)s
+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | 3c1caa473bfe4390a11e7177894bcc7b        |
| interface    | public                                  |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | e702f6f497ed42e6a8ae3ba2e5871c78        |
| service_name | nova                                    |
| service_type | compute                                 |
| url          | http://controller:8774/v2/%(tenant_id)s |
+--------------+-----------------------------------------+
 
 openstack endpoint create --region RegionOne compute internal http://controller:8774/v2/%\(tenant_id\)s
+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | e3c918de680746a586eac1f2d9bc10ab        |
| interface    | internal                                |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | e702f6f497ed42e6a8ae3ba2e5871c78        |
| service_name | nova                                    |
| service_type | compute                                 |
| url          | http://controller:8774/v2/%(tenant_id)s |
+--------------+-----------------------------------------+
 
 openstack endpoint create --region RegionOne compute admin http://controller:8774/v2/%\(tenant_id\)s
+--------------+-----------------------------------------+
| Field        | Value                                   |
+--------------+-----------------------------------------+
| enabled      | True                                    |
| id           | 38f7af91666a47cfb97b4dc790b94424        |
| interface    | admin                                   |
| region       | RegionOne                               |
| region_id    | RegionOne                               |
| service_id   | e702f6f497ed42e6a8ae3ba2e5871c78        |
| service_name | nova                                    |
| service_type | compute                                 |
| url          | http://controller:8774/v2/%(tenant_id)s |
+--------------+-----------------------------------------+
 
 
三、下载安装nova组件
2台controller
yum install openstack-nova-api openstack-nova-cert openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler python-novaclient -y
 
2台controller配置nova配置文件
 
在controller1上
vi /etc/nova/nova.conf
[DEFAULT]
resume_guests_state_on_host_boot=True
rpc_backend = rabbit
auth_strategy = keystone
my_ip = 10.40.42.2
enabled_apis=osapi_compute,metadata
verbose = True
 
ram_allocation_ratio = 1.0
disk_allocation_ratio=1.2
allow_resize_to_same_host=true
allow_migrate_to_same_host=true
 
network_api_class = nova.network.neutronv2.api.API
security_group_api = neutron
linuxnet_interface_driver = nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver
 
dhcp_domain = stg
 
osapi_compute_listen = 10.40.42.2
osapi_compute_listen_port = 8774
metadata_listen  = 10.40.42.2
metadata_listen_port = 8775
novncproxy_host = 10.40.42.2
novncproxy_port = 6080
 
[database]
connection = mysql://nova:venic8888@controller/nova
 
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = nova
password = nova
 
[vnc]
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
 
[glance]
host = controller
 
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
 
[oslo_messaging_rabbit]
rabbit_host=controller
rabbit_userid = openstack
rabbit_password = openstack
rabbit_retry_interval=1
rabbit_retry_backoff=2
rabbit_max_retries=0
rabbit_durable_queues=true
rabbit_ha_queues=true
 
[neutron]
url = http://controller:9696
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron
 
service_metadata_proxy = True
metadata_proxy_shared_secret = venicchina
 
[cinder]
os_region_name=RegionOne
 
以上的紫色配置原本是要等配neutron和测试cinder时再加的,只是这里我提前贴出来了以便做全局维护 ,如果你们是新搭环境的话,这个紫色配置要等安装了neutron+cinder包再加,不然会有报错,cinder也是后来新加测试用,上线一段时间发现可用性较差,也就没有上线
 
 
在controller2上
vi /etc/nova/nova.conf
 
[DEFAULT]
rpc_backend = rabbit
auth_strategy = keystone
my_ip = 10.40.42.1
enabled_apis=osapi_compute,metadata
verbose = True
 
ram_allocation_ratio = 1.0
allow_resize_to_same_host=true
allow_migrate_to_same_host=true
 
network_api_class = nova.network.neutronv2.api.API
security_group_api = neutron
linuxnet_interface_driver = nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver
 
dhcp_domain = stg
 
osapi_compute_listen = 10.40.42.1
osapi_compute_listen_port = 8774
metadata_listen  = 10.40.42.1
metadata_listen_port = 8775
novncproxy_host = 10.40.42.1
novncproxy_port = 6080
 
[database]
connection = mysql://nova:venic8888@controller/nova
 
[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
project_name = service
username = nova
password = nova
 
[vnc]
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
 
[glance]
host = controller
 
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
 
[oslo_messaging_rabbit]
rabbit_host=controller
rabbit_userid = openstack
rabbit_password = openstack
rabbit_retry_interval=1
rabbit_retry_backoff=2
rabbit_max_retries=0
rabbit_durable_queues=true
rabbit_ha_queues=true
 
[neutron]
url = http://controller:9696
auth_url = http://controller:35357
auth_plugin = password
project_domain_id = default
user_domain_id = default
region_name = RegionOne
project_name = service
username = neutron
password = neutron
 
service_metadata_proxy = True
metadata_proxy_shared_secret = venicchina
 
[cinder]
os_region_name=RegionOne
 
 
以上的紫色配置原本是要等配neutron和测试cinder时再加的,只是这里我提前贴出来了以便做全局维护 ,如果你们是新搭环境的话,这个紫色配置要等安装了neutron+cinder包再加,不然会有报错,cinder也是后来新加测试用,上线一段时间发现可用性较差,也就没有上线
 
 
其中一台controller 同步数据库
# su -s /bin/sh -c "nova-manage db sync" nova
 
两台controller 开启服务,以及加入开机自启
 
# 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