1:打开虚拟机进入数据库

mysql -u root -p

2:创建三个数据库 nova_apinova, 和 nova_cell0

CREATE DATABASE nova_api;
CREATE DATABASE nova;
CREATE DATABASE nova_cell0;

3:分别给这三个数据库授权

 

GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%'  IDENTIFIED BY 'NOVA_DBPASS';

GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'主机名' IDENTIFIED BY 'NOVA_DBPASS';

 GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';

GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'主机名' IDENTIFIED BY 'NOVA_DBPASS';

GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'NOVA_DBPASS';

GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'主机名' IDENTIFIED BY 'NOVA_DBPASS';

 还有自己的主机名授权

4:在profile中配置

根据自己的情况更改admin和密码与ip

5:创建nova用户

 

openstack user create --domain default --password-prompt nova

6:添加admin角色进nova用户

openstack role add --project service --user nova admin

 7:创建nova服务

openstack service create --name nova --description "OpenStack Compute" compute

8:创建api服务

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

 

 9:设置密码

openstack user create --domain default --password-prompt placement

10:添加一个角色进服务

openstack role add --project service --user placement admin

11:在服务目录中创建ipa

 12:创建api服务节点

openstack endpoint create --region RegionOne placement public http://controller:8778

 

 

openstack endpoint create --region RegionOne placement internal http://controller:8778

 

openstack endpoint create --region RegionOne placement admin http://controller:8778

 13:下载需要的包

# yum install openstack-nova-api      yum install openstack-nova-conductor 
  yum install openstack-nova-console  yum install openstack-nova-novncproxy 
  yum installopenstack-nova-scheduler yum installopenstack-nova-placement-api

14:编辑/etc/nova/nova.conf中的配置文件

[DEFAULT]
# ...
enabled_apis = osapi_compute,metadata
[api_database]
# ...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api

[database]
# ...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova
[DEFAULT]
# ...
transport_url = rabbit://openstack:RABBIT_PASS@controller
[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 = NOVA_PASS

controller为自己的ip地址

service为自己设置的用户名

NOVA_PASS为自己的密码

[DEFAULT]
# ...
my_ip = 10.0.0.11

设置为自己的IP地址

[DEFAULT]
# ...
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[vnc]
enabled = true
# ...
server_listen = $my_ip
server_proxyclient_address = $my_ip

设置为自己的IP地址

[glance]
# ...
api_servers = http://controller:9292
[oslo_concurrency]
# ...
lock_path = /var/lib/nova/tmp
[placement]
# ...
os_region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:5000/v3
username = placement
password = PLACEMENT_PASS

controller为自己的ip地址

service为自己设置的用户名

NOVA_PASS为自己的密码

15:在/etc/httpd/conf.d/00-nova-placement-api.conf里添加

<Directory /usr/bin>
   <IfVersion >= 2.4>
      Require all granted
   </IfVersion>
   <IfVersion < 2.4>
      Order allow,deny
      Allow from all
   </IfVersion>
</Directory>

16:重启服务

systemctl restart httpd

17:填充nova-api数据库

su -s /bin/sh -c "nova-manage api_db sync" nova

18:注册 cell0数据库

su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova

19:创建cell1单元格

su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova

20:填充nova数据库

 

# su -s /bin/sh -c "nova-manage db sync" nova

21:验证是否已被成功注册

 nova-manage cell_v2 list_cells

 22:启动计算服务

# systemctl enable openstack-nova-api.service
  systemctl enable openstack-nova-consoleauth
  systemctl enable openstack-nova-scheduler
  systemctl enable openstack-nova-conductor
  systemctl enable openstack-nova-novncproxy
# systemctl start openstack-nova-api
  systemctl start openstack-nova-consoleauth
  systemctl start openstack-nova-scheduler
  systemctl start openstack-nova-conductor
  systemctl start openstack-nova-novncproxy

都为running即为成功!!

 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐