在OpenStack中安装和配置Controller Node的步骤
这是在OpenStack中安装和配置控制器节点的步骤的第二部分。
在本文的第一部分中,我分享了配置以下服务的步骤,以在OpenStack设置中配置控制器节点。
MariaDB
RabbitMQ
Memcached
Keystone
现在,在本文中,我们将继续并共享配置以下服务的步骤
Glance
Nova Compute
在OpenStack中安装和配置Controller节点的步骤
下面是我将在本文中介绍的主题的详细列表。
概览安装和配置
创建一览数据库
创建一目了然的用户和角色
创建一目了然的服务实体
创建图像服务API端点
安装glance软件包
更新glance配置文件
填充图像服务数据库
启用glance API和注册表服务
验证glance API和注册表服务
配置计算
创建计算数据库
创建nova用户并分配角色
创建nova服务实体
创建计算服务端点
创建展示位置服务用户并分配角色
在服务目录中创建Placement API条目
创建Placement API服务端点
部署和配置nova软件包
填充nova-api数据库
注册cell0数据库
创建cell1单元格
填充nova数据库
验证nova cell0和cell1是否正确注册
概览安装和配置
镜像服务(概览)使用户可以发现,注册和检索虚拟机镜像。
它提供了REST API,使我们可以查询虚拟机镜像元数据并检索实际镜像。
我们可以将通过Image服务提供的虚拟机镜像存储在各个位置,从简单的文件系统到对象存储系统(如OpenStack对象存储)。
创建Glance数据库
使用数据库访问客户端以root用户身份连接到数据库服务器:
[root@controller ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 6 Server version: 10.1.20-MariaDB MariaDB Server Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. MariaDB [(none)]> CREATE DATABASE glance; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'redhat'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'redhat'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> exit Bye
说明:
这里的" redhat"是我的nova数据库的密码
创建一目了然的用户和角色
[root@controller ~]# openstack user create --domain default --password-prompt glance User Password: Repeat User Password: +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | 0267824b7d934264aa9d560e7650681b | | enabled | True | | id | 4b773850572c4faf8319a64f5bb5bad7 | | name | glance | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+
将admin
角色添加到glance
用户和service
项目中:
[root@controller ~]# openstack role add --project service --user glance admin
创建一目了然的服务实体
[root@controller ~]# openstack service create --name glance --description "OpenStack Image" image +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Image | | enabled | True | | id | 123bf6d523e948a2abcd4b571e8cbadd | | name | glance | | type | image | +-------------+----------------------------------+
创建图像服务API端点
[root@controller ~]# openstack endpoint create --region RegionOne image public http://controller:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | eedcb15d360644bf9fecc7d7b2a8f22a | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 123bf6d523e948a2abcd4b571e8cbadd | | service_name | glance | | service_type | image | | url | http://controller:9292 | +--------------+----------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne image internal http://controller:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 6423afef595b4d07bbf16435c8537521 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 123bf6d523e948a2abcd4b571e8cbadd | | service_name | glance | | service_type | image | | url | http://controller:9292 | +--------------+----------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne image admin http://controller:9292 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 3de13f6576d34e9d873856a55e43b36d | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 123bf6d523e948a2abcd4b571e8cbadd | | service_name | glance | | service_type | image | | url | http://controller:9292 | +--------------+----------------------------------+
安装glance软件包
[root@controller ~]# yum install openstack-glance -y
更新glance配置文件
更新/etc/glance/glance-api.conf
文件并完成以下操作:
说明:
用上述步骤中分配的glance用户密码和glance数据库密码替换GLANCE_PASS
和GLANCE_DBPASS
[root@controller ~]# openstack-config --set /etc/glance/glance-api.conf database connection mysql+pymysql://glance:GLANCE_DBPASS@controller/glance [root@controller ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_uri http://controller:5000 [root@controller ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_url http://controller:35357 [root@controller ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken memcached_servers controller:11211 [root@controller ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_type password [root@controller ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken project_domain_name Default [root@controller ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken user_domain_name Default [root@controller ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken project_name service [root@controller ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken username glance [root@controller ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken password GLANCE_PASS [root@controller ~]# openstack-config --set /etc/glance/glance-api.conf paste_deploy flavor keystone [root@controller ~]# openstack-config --set /etc/glance/glance-api.conf glance_store stores file,http [root@controller ~]# openstack-config --set /etc/glance/glance-api.conf glance_store default_store file [root@controller ~]# openstack-config --set /etc/glance/glance-api.conf glance_store filesystem_store_datadir /var/lib/glance/images/
更新/etc/glance/glance-registry.conf
文件并完成以下操作:
说明:
用上述步骤中分配的glance用户密码和glance数据库密码替换GLANCE_PASS
和GLANCE_DBPASS
[root@controller ~]# openstack-config --set /etc/glance/glance-registry.conf database connection mysql+pymysql://glance:GLANCE_DBPASS@controller/glance [root@controller ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_uri http://controller:5000 [root@controller ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_url http://controller:35357 [root@controller ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken memcached_servers controller:11211 [root@controller ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_type password [root@controller ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_domain_name default [root@controller ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken user_domain_name default [root@controller ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken project_name service [root@controller ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken username glance [root@controller ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken password GLANCE_PASS [root@controller ~]# openstack-config --set /etc/glance/glance-registry.conf paste_deploy flavor keystone
填充图像服务数据库
[root@controller ~]# su -s /bin/sh -c "glance-manage db_sync" glance /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:1336: OsloDBDeprecationWarning: EngineFacade is deprecated; please use oslo_db.sqlalchemy.enginefacade expire_on_commit=expire_on_commit, _conf=conf) INFO [alembic.runtime.migration] Context impl MySQLImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [alembic.runtime.migration] Running upgrade -> liberty, liberty initial INFO [alembic.runtime.migration] Running upgrade liberty -> mitaka01, add index on created_at and updated_at columns of 'images' table INFO [alembic.runtime.migration] Running upgrade mitaka01 -> mitaka02, update metadef os_nova_server INFO [alembic.runtime.migration] Running upgrade mitaka02 -> ocata_expand01, add visibility to images INFO [alembic.runtime.migration] Running upgrade ocata_expand01 -> pike_expand01, empty expand for symmetry with pike_contract01 INFO [alembic.runtime.migration] Running upgrade pike_expand01 -> queens_expand01 INFO [alembic.runtime.migration] Context impl MySQLImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. Upgraded database to: queens_expand01, current revision(s): queens_expand01 INFO [alembic.runtime.migration] Context impl MySQLImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [alembic.runtime.migration] Context impl MySQLImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. Database migration is up to date. No migration needed. INFO [alembic.runtime.migration] Context impl MySQLImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [alembic.runtime.migration] Context impl MySQLImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. INFO [alembic.runtime.migration] Running upgrade mitaka02 -> ocata_contract01, remove is_public from images INFO [alembic.runtime.migration] Running upgrade ocata_contract01 -> pike_contract01, drop glare artifacts tables INFO [alembic.runtime.migration] Running upgrade pike_contract01 -> queens_contract01 INFO [alembic.runtime.migration] Context impl MySQLImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. Upgraded database to: queens_contract01, current revision(s): queens_contract01 INFO [alembic.runtime.migration] Context impl MySQLImpl. INFO [alembic.runtime.migration] Will assume non-transactional DDL. Database is synced successfully.
说明:
忽略此输出中的所有弃用消息。
启用Glance API和Glance注册表服务
[root@controller ~]# systemctl enable openstack-glance-api.service openstack-glance-registry.service [root@controller ~]# systemctl start openstack-glance-api.service openstack-glance-registry.service
验证Glance API和Glance注册中心服务
使用CirrOS
验证镜像服务的操作,CirrOS是一个小的Linux镜像,可测试OpenStack部署。
[root@controller ~]# source adminrc
下载cirros
源图像
[root@controller ~]# wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img --2016-11-01 16:43:44-- http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img Resolving download.cirros-cloud.net (download.cirros-cloud.net)... 64.90.42.85, 2607:f298:6:a036::bd6:a72a Connecting to download.cirros-cloud.net (download.cirros-cloud.net)|64.90.42.85|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 12716032 (12M) [text/plain] Saving to: ‘cirros-0.4.0-x86_64-disk.img’ 100%[======================================================================================================>] 12,716,032 1.72MB/s in 25s 2016-11-01 16:44:11 (490 KB/s) - ‘cirros-0.4.0-x86_64-disk.img’ saved [12716032/12716032]
检查文件是否已下载
[root@controller ~]# ls -lh cirros-0.4.0-x86_64-disk.img -rw-r--r-- 1 root root 13M Nov 20 2016 cirros-0.4.0-x86_64-disk.img
使用QCOW2
磁盘格式,裸容器格式和公共可见性将图像上传到图像服务,以便所有项目都可以访问它:
[root@controller ~]# openstack image create cirros --file ~/cirros-0.4.0-x86_64-disk.img --disk-format qcow2 --public +------------------+------------------------------------------------------+ | Field | Value | +------------------+------------------------------------------------------+ | checksum | 443b7623e27ecf03dc9e01ee93f67afe | | container_format | bare | | created_at | 2016-11-01T11:53:50Z | | disk_format | qcow2 | | file | /v2/images/169bc19c-e9c9-4de3-ade4-c9cc9a443162/file | | id | 169bc19c-e9c9-4de3-ade4-c9cc9a443162 | | min_disk | 0 | | min_ram | 0 | | name | cirros | | owner | 8bb9c0b1fa7947778a4f914ea0752cfc | | protected | False | | schema | /v2/schemas/image | | size | 12716032 | | status | active | | tags | | | updated_at | 2016-11-01T11:53:51Z | | virtual_size | None | | visibility | public | +------------------+------------------------------------------------------+
确认上传图片并验证属性:
[root@controller ~]# openstack image list +--------------------------------------+--------+--------+ | ID | Name | Status | +--------------------------------------+--------+--------+ | 169bc19c-e9c9-4de3-ade4-c9cc9a443162 | cirros | active | +--------------------------------------+--------+--------+
我们也可以使用(--copy-from)将图像从网上直接上传到扫视图像数据库。
[root@controller ~]# openstack image create "cirros-1" --file ~/cirros-0.4.0-x86_64-disk.img --disk-format qcow2 --public --copy-from http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img ERROR: --copy-from was given, which is an Image v1 option that is no longer supported in Image v2
说明:
仅OS_IMAGE_API_VERSION的V1版本支持参数--copy-from。
因此,我们需要手动更改此变量的API版本。
[root@controller ~]# cat adminrc export OS_PROJECT_DOMAIN_NAME=default export OS_USER_DOMAIN_NAME=default export OS_PROJECT_NAME=admin export OS_USERNAME=admin export OS_PASSWORD=redhat export OS_AUTH_URL=http://controller:35357/v3 export OS_IDENTITY_API_VERSION=3 export OS_IMAGE_API_VERSION=2
[root@controller ~]# export OS_IMAGE_API_VERSION=1
接下来重新尝试上传
[root@controller ~]# openstack image create "cirros-1" --file ~/cirros-0.4.0-x86_64-disk.img --disk-format qcow2 --public --copy-from http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img +------------------+--------------------------------------+ | Field | Value | +------------------+--------------------------------------+ | checksum | None | | container_format | bare | | created_at | 2016-11-01T12:51:21.000000 | | deleted | False | | deleted_at | None | | disk_format | qcow2 | | id | b28add75-85ec-46a3-8b8b-3de77944ee26 | | is_public | True | | min_disk | 0 | | min_ram | 0 | | name | cirros-1 | | owner | None | | properties | | | protected | False | | size | 12716032 | | status | queued | | updated_at | 2016-11-01T12:51:21.000000 | | virtual_size | None | +------------------+--------------------------------------+
检查上传的图片列表
[root@controller ~]# openstack image list +--------------------------------------+----------+--------+ | ID | Name | Status | +--------------------------------------+----------+--------+ | 169bc19c-e9c9-4de3-ade4-c9cc9a443162 | cirros | active | | b28add75-85ec-46a3-8b8b-3de77944ee26 | cirros-1 | active | +--------------------------------------+----------+--------+
配置计算
OpenStack Compute与OpenStack Identity交互以进行身份验证;用于磁盘和服务器镜像的OpenStack镜像服务;和用于用户和管理界面的OpenStack仪表板。
图像访问受到项目和用户的限制;每个项目都限制配额(例如,实例数)。
OpenStack Compute可以在标准硬件上水平扩展,并下载镜像以启动实例。
创建计算数据库
使用数据库访问客户端以root用户身份连接到数据库服务器:
[root@controller ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 9 Server version: 10.1.20-MariaDB MariaDB Server Copyright (c) 2000, 2015, 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_api; Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> CREATE DATABASE nova; Query OK, 1 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_api.* TO 'nova'@'localhost' IDENTIFIED BY 'redhat'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'redhat'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'redhat'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'redhat'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' IDENTIFIED BY 'redhat'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'redhat'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> exit Bye
说明:
这里的" redhat"是我的nova数据库的密码。
取得admin凭证,以访问仅管理员的CLI命令:
[root@controller ~]# source adminrc
创建nova用户并分配角色
[root@controller ~]# openstack user create --domain default --password-prompt nova User Password: Repeat User Password: +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | 0267824b7d934264aa9d560e7650681b | | enabled | True | | id | bb849e7b1b3d444b9304ffc5956f9433 | | name | nova | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+
将admin角色添加到nova用户:
[root@controller ~]# openstack role add --project service --user nova admin
创建nova服务实体
[root@controller ~]# openstack service create --name nova --description "OpenStack Compute" compute +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | OpenStack Compute | | enabled | True | | id | d9a2621eea464566ae90e00f456811dc | | name | nova | | type | compute | +-------------+----------------------------------+
创建Compute Service API端点
[root@controller ~]# openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 7091591858f14f29a1df0a479ca9d644 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | d9a2621eea464566ae90e00f456811dc | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1 | +--------------+----------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 808837731e284e3e9c700514d13669fa | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | d9a2621eea464566ae90e00f456811dc | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1 | +--------------+----------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 8fd0dccb2b4e4f89a68d69f7052cc225 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | d9a2621eea464566ae90e00f456811dc | | service_name | nova | | service_type | compute | | url | http://controller:8774/v2.1 | +--------------+----------------------------------+
创建展示位置服务用户并分配角色
[root@controller ~]# openstack user create --domain default --password-prompt placement User Password: Repeat User Password: +---------------------+----------------------------------+ | Field | Value | +---------------------+----------------------------------+ | domain_id | 0267824b7d934264aa9d560e7650681b | | enabled | True | | id | 2101cf2e577a41eeb2c1c2eb053d7e40 | | name | placement | | options | {} | | password_expires_at | None | +---------------------+----------------------------------+
将具有" admin"角色的" Placement"用户添加到" service"项目中:
[root@controller ~]# openstack role add --project service --user placement admin
在服务目录中创建Placement API条目
[root@controller ~]# openstack service create --name placement --description "Placement API" placement +-------------+----------------------------------+ | Field | Value | +-------------+----------------------------------+ | description | Placement API | | enabled | True | | id | 841a363675d840b3afc3a253c812449b | | name | placement | | type | placement | +-------------+----------------------------------+
创建Placement API服务端点
[root@controller ~]# openstack endpoint create --region RegionOne placement public http://controller:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 92ac4235f27d490a99afe67b69b0cee4 | | interface | public | | region | RegionOne | | region_id | RegionOne | | service_id | 841a363675d840b3afc3a253c812449b | | service_name | placement | | service_type | placement | | url | http://controller:8778 | +--------------+----------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne placement internal http://controller:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 22249b972b744cf2b027125ff59bf745 | | interface | internal | | region | RegionOne | | region_id | RegionOne | | service_id | 841a363675d840b3afc3a253c812449b | | service_name | placement | | service_type | placement | | url | http://controller:8778 | +--------------+----------------------------------+ [root@controller ~]# openstack endpoint create --region RegionOne placement admin http://controller:8778 +--------------+----------------------------------+ | Field | Value | +--------------+----------------------------------+ | enabled | True | | id | 73fcdcbb61c54b898f18cbe91fca31f4 | | interface | admin | | region | RegionOne | | region_id | RegionOne | | service_id | 841a363675d840b3afc3a253c812449b | | service_name | placement | | service_type | placement | | url | http://controller:8778 | +--------------+----------------------------------+
部署和配置nova软件包
安装软件包:
[root@controller ~]# yum -y install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler
更新/etc/nova/nova.conf
文件并完成以下操作:
说明:
用相应的密码替换" RABBIT_PASS"," NOVA_DBPASS"," NOVA_PASS"," PLACEMENT_PASS"。
用控制器IP地址替换10.0.2.10
[root@controller ~]# openstack-config --set /etc/nova/nova.conf database connection mysql+pymysql://nova:NOVA_DBPASS@controller/nova [root@controller ~]# openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata [root@controller ~]# openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 10.0.2.10 [root@controller ~]# openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron True [root@controller ~]# openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver [root@controller ~]# openstack-config --set /etc/nova/nova.conf DEFAULT transport_url = rabbit://openstack:RABBIT_PASS@controller [root@controller ~]# openstack-config --set /etc/nova/nova.conf api auth_strategy keystone [root@controller ~]# openstack-config --set /etc/nova/nova.conf api_database connection mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api [root@controller ~]# openstack-config --set /etc/nova/nova.conf database connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova [root@controller ~]# openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_host controller [root@controller ~]# openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_userid openstack [root@controller ~]# openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_password RABBIT_PASS [root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://controller:5000/v3 [root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers controller:11211 [root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password [root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name default [root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name default [root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service [root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova [root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken password NOVA_PASS [root@controller ~]# openstack-config --set /etc/nova/nova.conf vnc emabled true [root@controller ~]# openstack-config --set /etc/nova/nova.conf vnc server_listen 10.0.2.10 [root@controller ~]# openstack-config --set /etc/nova/nova.conf vnc server_proxyclient_address 10.0.2.10 [root@controller ~]# openstack-config --set /etc/nova/nova.conf glance api_servers http://controller:9292 [root@controller ~]# openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp [root@controller ~]# openstack-config --set /etc/nova/nova.conf placement os_region_name RegionOne [root@controller ~]# openstack-config --set /etc/nova/nova.conf placement project_domain_name Default [root@controller ~]# openstack-config --set /etc/nova/nova.conf placement project_name service [root@controller ~]# openstack-config --set /etc/nova/nova.conf placement auth_type password [root@controller ~]# openstack-config --set /etc/nova/nova.conf placement user_domain_name Default [root@controller ~]# openstack-config --set /etc/nova/nova.conf placement auth_url http://controller:5000/v3 [root@controller ~]# openstack-config --set /etc/nova/nova.conf placement username placement [root@controller ~]# openstack-config --set /etc/nova/nova.conf placement password PLACEMENT_PASS
说明:
忽略以下命令中与弃用相关的任何输出消息
填充nova-api数据库
[root@controller ~]# su -s /bin/sh -c "nova-manage api_db sync" nova /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] not ssuported exception.NotSupportedWarning
注册cell0数据库
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] not ssuported exception.NotSupportedWarning
创建cell1单元格
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] not ssuported exception.NotSupportedWarning f671ab47-a48f-4ca2-80bb-444f5cfa84dd
填充nova数据库
[root@controller ~]# su -s /bin/sh -c "nova-manage db sync" nova /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] not ssuported exception.NotSupportedWarning /usr/lib/python2.7/site-packages/pymysql/cursors.py:166: Warning: (1831, u'Duplicate index `block_device_mapping_instance_uuid_virtual_name_device_name_idx`. This is deprecated and will be disallowed in a future release.') result = self._query(query) /usr/lib/python2.7/site-packages/pymysql/cursors.py:166: Warning: (1831, u'Duplicate index `uniq_instances0uuid`. This is deprecated and w ill be disallowed in a future release.') result = self._query(query)
验证nova cell0和cell1是否正确注册
[root@controller ~]# nova-manage cell_v2 list_cells /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] 不支持 exception.NotSupportedWarning +-------+--------------------------------------+------------------------------------+-------------------------------------------------+ | Name | UUID | Transport URL | Database Connection | +-------+--------------------------------------+------------------------------------+-------------------------------------------------+ | cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://nova:** **@controller/nova_cell0 | | cell1 | f671ab47-a48f-4ca2-80bb-444f5cfa84dd | rabbit://openstack:** **@controller | mysql+pymysql://nova:** **@controller/nova | +-------+--------------------------------------+------------------------------------+-------------------------------------------------+
启动Compute服务并将其配置为在系统启动时启动
[root@controller ~]# systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service [root@controller ~]# systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
检查新星服务状态
[root@controller ~]# systemctl status openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service ● openstack-nova-api.service - OpenStack Nova API Server Loaded: loaded (/usr/lib/systemd/system/openstack-nova-api.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2016-11-01 20:11:47 IST; 2min 51s ago Main PID: 14061 (nova-api) CGroup: /system.slice/openstack-nova-api.service ├─14061 /usr/bin/python2 /usr/bin/nova-api ├─14157 /usr/bin/python2 /usr/bin/nova-api └─14159 /usr/bin/python2 /usr/bin/nova-api Nov 01 20:11:15 controller.example.com systemd[1]: openstack-nova-api.service holdoff time over, scheduling restart. Nov 01 20:11:15 controller.example.com systemd[1]: Starting OpenStack Nova API Server... Nov 01 20:11:23 controller.example.com nova-api[14061]: /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] 不支持 Nov 01 20:11:23 controller.example.com nova-api[14061]: exception.NotSupportedWarning Nov 01 20:11:47 controller.example.com systemd[1]: Started OpenStack Nova API Server. ● openstack-nova-consoleauth.service - OpenStack Nova VNC console auth Server Loaded: loaded (/usr/lib/systemd/system/openstack-nova-consoleauth.service; disabled; vendor preset: disabled) Active: active (running) since Thu 2016-11-01 20:14:29 IST; 9s ago Main PID: 14245 (nova-consoleaut) CGroup: /system.slice/openstack-nova-consoleauth.service └─14245 /usr/bin/python2 /usr/bin/nova-consoleauth Nov 01 20:13:33 controller.example.com systemd[1]: Starting OpenStack Nova VNC console auth Server... Nov 01 20:14:02 controller.example.com nova-consoleauth[14245]: /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] 不支持 Nov 01 20:14:02 controller.example.com nova-consoleauth[14245]: exception.NotSupportedWarning Nov 01 20:14:29 controller.example.com systemd[1]: Started OpenStack Nova VNC console auth Server. ● openstack-nova-scheduler.service - OpenStack Nova Scheduler Server Loaded: loaded (/usr/lib/systemd/system/openstack-nova-scheduler.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2016-11-01 20:14:31 IST; 7s ago Main PID: 14246 (nova-scheduler) CGroup: /system.slice/openstack-nova-scheduler.service └─14246 /usr/bin/python2 /usr/bin/nova-scheduler Nov 01 20:13:33 controller.example.com systemd[1]: Starting OpenStack Nova Scheduler Server... Nov 01 20:14:01 controller.example.com nova-scheduler[14246]: /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] 不支持 Nov 01 20:14:01 controller.example.com nova-scheduler[14246]: exception.NotSupportedWarning Nov 01 20:14:31 controller.example.com systemd[1]: Started OpenStack Nova Scheduler Server. ● openstack-nova-conductor.service - OpenStack Nova Conductor Server Loaded: loaded (/usr/lib/systemd/system/openstack-nova-conductor.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2016-11-01 20:14:29 IST; 9s ago Main PID: 14247 (nova-conductor) CGroup: /system.slice/openstack-nova-conductor.service └─14247 /usr/bin/python2 /usr/bin/nova-conductor Nov 01 20:13:33 controller.example.com systemd[1]: Starting OpenStack Nova Conductor Server... Nov 01 20:14:02 controller.example.com nova-conductor[14247]: /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] 不支持 Nov 01 20:14:02 controller.example.com nova-conductor[14247]: exception.NotSupportedWarning Nov 01 20:14:29 controller.example.com systemd[1]: Started OpenStack Nova Conductor Server. ● openstack-nova-novncproxy.service - OpenStack Nova NoVNC Proxy Server Loaded: loaded (/usr/lib/systemd/system/openstack-nova-novncproxy.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2016-11-01 20:13:33 IST; 1min 5s ago Main PID: 14248 (nova-novncproxy) CGroup: /system.slice/openstack-nova-novncproxy.service └─14248 /usr/bin/python2 /usr/bin/nova-novncproxy --web /usr/share/novnc/ Nov 01 20:13:33 controller.example.com systemd[1]: Started OpenStack Nova NoVNC Proxy Server. Nov 01 20:13:33 controller.example.com systemd[1]: Starting OpenStack Nova NoVNC Proxy Server... Nov 01 20:14:02 controller.example.com nova-novncproxy[14248]: /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] 不支持 Nov 01 20:14:02 controller.example.com nova-novncproxy[14248]: exception.NotSupportedWarning
就是这样,现在我们可以检查Controller节点上运行的总体OpenStack服务状态。
[root@controller ~]# source adminrc
[root@controller ~]# openstack-status == Nova services == openstack-nova-api: active openstack-nova-compute: inactive (disabled on boot) openstack-nova-network: inactive (disabled on boot) openstack-nova-scheduler: active openstack-nova-conductor: active openstack-nova-console: active openstack-nova-consoleauth: active (disabled on boot) openstack-nova-xvpvncproxy: inactive (disabled on boot) == Glance services == openstack-glance-api: active openstack-glance-registry: active == Keystone service == openstack-keystone: inactive (disabled on boot) == Horizon service == openstack-dashboard: active == Support services == mariadb: active dbus: active rabbitmq-server: active memcached: active == Keystone users == +----------------------------------+-----------+ | ID | Name | +----------------------------------+-----------+ | 1774158c0048410ea8114a35b7e2db7e | admin | | 2101cf2e577a41eeb2c1c2eb053d7e40 | placement | | 4b773850572c4faf8319a64f5bb5bad7 | glance | | bb849e7b1b3d444b9304ffc5956f9433 | nova | | c9c4f121493144be98097c67ad9feeb0 | demo | +----------------------------------+-----------+ == Glance images == +--------------------------------------+----------+ | ID | Name | +--------------------------------------+----------+ | 169bc19c-e9c9-4de3-ade4-c9cc9a443162 | cirros | | b28add75-85ec-46a3-8b8b-3de77944ee26 | cirros-1 | +--------------------------------------+----------+ == Nova managed services == +--------------------------------------+------------------+------------------------+----------+---------+-------+------------ ----------------+-----------------+-------------+ | Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | Forced down | +--------------------------------------+------------------+------------------------+----------+---------+-------+------------ ----------------+-----------------+-------------+ | b282f419-a2ff-47da-9e67-7fdf91d6840a | nova-console | controller.example.com | internal | enabled | up | 2016-11-02T 08:44:03.000000 | - | False | | 48074945-992e-4eb1-b0fe-851b9a4a644e | nova-consoleauth | controller.example.com | internal | enabled | up | 2016-11-02T 08:44:00.000000 | - | False | | 15a3f6c8-fb3b-4f0d-bef2-32bff32b3e97 | nova-scheduler | controller.example.com | internal | enabled | up | 2016-11-02T 08:44:01.000000 | - | False | | acaa6b72-fc6b-4cde-b3e7-8f1bdd25a211 | nova-conductor | controller.example.com | internal | enabled | up | 2016-11-02T 08:44:01.000000 | - | False | +--------------------------------------+------------------+------------------------+----------+---------+-------+------------ ----------------+-----------------+-------------+ == Nova networks == == Nova instance flavors == +----+------+-----------+------+-----------+------+-------+-------------+-----------+-------------+ | ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | Description | +----+------+-----------+------+-----------+------+-------+-------------+-----------+-------------+ +----+------+-----------+------+-----------+------+-------+-------------+-----------+-------------+ == Nova instances == +----+------+-----------+--------+------------+-------------+----------+ | ID | Name | Tenant ID | Status | Task State | Power State | Networks | +----+------+-----------+--------+------------+-------------+----------+ +----+------+-----------+--------+------------+-------------+----------+