OpenStack Queens三节点从零部署-安装部署Nova(一)

最后修改时间:2018年6月26日

文档版本:1.0

本操作在控制节点上完成

一. 在Keystone中添加用户及其他服务相关

# 添加nova和placement用户
root@controller:~(keystone)# openstack user create --domain default --project service --password root nova
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | nn3c2r0rc32m0xmr89q3xm0tq8cqrm09 |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 64c5x32456hv89o4vqt45yw43tyb545b |
| name                | nova                             |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
 
root@controller:~(keystone)# openstack user create --domain default --project service --password root placement
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| default_project_id  | nn3c2r0rc32m0xmr89q3xm0tq8cqrm09 |
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 64c5x32456hv89o4vqt45yw43tyb545b |
| name                | placement                        |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
 
# 为两个用户添加管理员角色
root@controller:~(keystone)# openstack role add --project service --user nova admin
root@controller:~(keystone)# openstack role add --project service --user placement admin
 
# 创建服务
root@controller:~(keystone)# openstack service create --name nova --description "OpenStack Compute service" compute
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Compute service        |
| enabled     | True                             |
| id          | 89cm89fpacfm0443040c430mc4f0cfcf |
| name        | nova                             |
| type        | compute                          |
+-------------+----------------------------------+
root@controller:~(keystone)# openstack service create --name placement --description "OpenStack Compute Placement service" placement
+-------------+-------------------------------------+
| Field       | Value                               |
+-------------+-------------------------------------+
| description | OpenStack Compute Placement service |
| enabled     | True                                |
| id          | 56hu4ye5g34ft7ul0pt4j8d234qw4v5g    |
| name        | placement                           |
| type        | placement                           |
+-------------+-------------------------------------+
 
# 定义一个临时变量,避免重复输入controller的IP
root@controller:~(keystone)# export controller=192.168.0.10
 
# 创建nova服务endpoint(public,internal,admin)
root@controller:~(keystone)# openstack endpoint create --region RegionOne compute public http://$controller:8774/v2.1/%\(tenant_id\)s
+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | 78n9qrf0jqf230mfc80fqcn32s82rrf9            |
| interface    | public                                      |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | 89cm89fpacfm0443040c430mc4f0cfcf            |
| service_name | nova                                        |
| service_type | compute                                     |
| url          | http://192.168.0.10:8774/v2.1/%(tenant_id)s |
+--------------+---------------------------------------------+
 
root@controller:~(keystone)# openstack endpoint create --region RegionOne compute internal http://$controller:8774/v2.1/%\(tenant_id\)s
+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | 09uhn3f3gr99787934ff04fj3gwv3034            |
| interface    | internal                                    |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | 89cm89fpacfm0443040c430mc4f0cfcf            |
| service_name | nova                                        |
| service_type | compute                                     |
| url          | http://192.168.0.10:8774/v2.1/%(tenant_id)s |
+--------------+---------------------------------------------+
 
root@controller:~(keystone)# openstack endpoint create --region RegionOne compute admin http://$controller:8774/v2.1/%\(tenant_id\)s
+--------------+---------------------------------------------+
| Field        | Value                                       |
+--------------+---------------------------------------------+
| enabled      | True                                        |
| id           | 3f8s1w1jm04f5euytgb6h78t45367r5g            |
| interface    | admin                                       |
| region       | RegionOne                                   |
| region_id    | RegionOne                                   |
| service_id   | 89cm89fpacfm0443040c430mc4f0cfcf            |
| service_name | nova                                        |
| service_type | compute                                     |
| url          | http://192.168.0.10:8774/v2.1/%(tenant_id)s |
+--------------+---------------------------------------------+
 
# 创建placement服务endpoint(public,internal,admin)
root@controller:~(keystone)# openstack endpoint create --region RegionOne placement public http://$controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 98dfs8gf67nb45bf832njyh9cvs83rjf |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 56hu4ye5g34ft7ul0pt4j8d234qw4v5g |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://192.168.0.10:8778         |
+--------------+----------------------------------+
 
root@controller:~(keystone)# openstack endpoint create --region RegionOne placement internal http://$controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 89ds2g6kjgf7n32hv823nos731kj3njk |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 56hu4ye5g34ft7ul0pt4j8d234qw4v5g |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://192.168.0.10:8778         |
+--------------+----------------------------------+
 
root@controller:~(keystone)# openstack endpoint create --region RegionOne placement admin http://$controller:8778
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 2j3n58xhn34vho2d94nfl23vn40wn348 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 56hu4ye5g34ft7ul0pt4j8d234qw4v5g |
| service_name | placement                        |
| service_type | placement                        |
| url          | http://192.168.0.10:8778         |
+--------------+----------------------------------+

二. 为nova添加数据库

root@controller:~(keystone)# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 32
Server version: 10.0.34-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
# 添加数据库
MariaDB [(none)]> create database nova;
Query OK, 1 row affected (0.00 sec)
 
# 为数据库赋予用户权限
MariaDB [(none)]> grant all privileges on nova.* to nova@'localhost' identified by 'root';
Query OK, 0 row affected (0.00 sec)
 
MariaDB [(none)]> grant all privileges on nova.* to nova@'%' identified by 'root';
Query OK, 0 row affected (0.00 sec)
 
# 添加数据库
MariaDB [(none)]> create database nova_api;
Query OK, 1 row affected (0.00 sec)
 
# 为数据库赋予用户权限
MariaDB [(none)]> grant all privileges on nova_api.* to nova@'localhost' identified by 'root';
Query OK, 0 row affected (0.00 sec)
 
MariaDB [(none)]> grant all privileges on nova_api.* to nova@'%' identified by 'root';
Query OK, 0 row affected (0.00 sec)
 
# 添加数据库
MariaDB [(none)]> create database nova_placement;
Query OK, 1 row affected (0.00 sec)
 
# 为数据库赋予用户权限
MariaDB [(none)]> grant all privileges on nova_placement.* to nova@'localhost' identified by 'root';
Query OK, 0 row affected (0.00 sec)
 
MariaDB [(none)]> grant all privileges on nova_placement.* to nova@'%' identified by 'root';
Query OK, 0 row affected (0.00 sec)
 
# 添加数据库
MariaDB [(none)]> create database nova_cell0;
Query OK, 1 row affected (0.00 sec)
 
# 为数据库赋予用户权限
MariaDB [(none)]> grant all privileges on nova_cell0.* to nova@'localhost' identified by 'root';
Query OK, 0 row affected (0.00 sec)
 
MariaDB [(none)]> grant all privileges on nova_cell0.* to nova@'%' identified by'root';
Query OK, 0 row affected (0.00 sec)
 
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> exit
Bye
Leave a Reply