7、同步nova-api数据库
[root@controller ~]# su -s /bin/sh -c "nova-manage api_db sync" nova
8、注册cell数据库
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova
9、创建cell1单元表
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 create_cell -- name=cell1 --verbose" nova 108a6e6f-c68c-465f-b4bd-a83d0d13b277
10、填充nova数据库
[root@controller ~]# su -s /bin/sh -c "nova-manage db sync" nova # 忽略输出的启用信息
11、检查nova、cell0和cell1是否注册正确
[root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova +-------+--------------------------------------+-------------------------------- ----------+-------------------------------------------------+----------+ | Name | UUID | Transport URL | Database Connection | Disabled | +-------+--------------------------------------+-------------------------------- ----------+-------------------------------------------------+----------+ | cell0 | 00000000-0000-0000-0000-000000000000 | none:/ | mysql+pymysql://nova:****@controller/nova_cell0 | False | | cell1 | 108a6e6f-c68c-465f-b4bd-a83d0d13b277 | rabbit://openstack:****@controller:5672/ | mysql+pymysql://nova:****@controller/nova | False | +-------+--------------------------------------+-------------------------------- ----------+-------------------------------------------------+----------+
12、启动服务
[root@controller ~]# systemctl enable \ openstack-nova-api \ openstack-nova-scheduler \ openstack-nova-conductor \ openstack-nova-novncproxy [root@controller ~]# systemctl start \ openstack-nova-api \ openstack-nova-scheduler \ openstack-nova-conductor \ openstack-nova-novncproxy [root@controller ~]# systemctl status \ openstack-nova-api \ openstack-nova-scheduler \ openstack-nova-conductor \ openstack-nova-novncproxy
下面在compute执行
13、安装软件包
14、修改nova配置文件
编辑/etc/nova/nova.conf文件,完成如下操作:
在[DEFAULT]部分,只启用计算和元数据api:
[DEFAULT] enabled_apis = osapi_compute,metadata # 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata
在[DEFAULT]部分,配置RabbitMQ消息队列访问:
[DEFAULT] transport_url = rabbit://openstack:000000@controller # 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf DEFAULT transport_url rabbit://openstack:000000@controller
在[api]和[keystone_authtoken]部分中,配置身份服务访问:
[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 = 000000 # 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf api auth_strategy keystone openstack-config --set /etc/nova/nova.conf keystone_authtoken www_authenticate_uri http://controller:5000/ openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://controller:5000/ openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers controller:11211 openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name Default openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name Default openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova openstack-config --set /etc/nova/nova.conf keystone_authtoken password 000000
在[DEFAULT]部分,配置my_ip选项:
[DEFAULT] my_ip = 192.168.75.21 # 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.75.21
在[DEFAULT]部分,启用对网络服务的支持:
[DEFAULT] use_neutron = true firewall_driver = nova.virt.firewall.NoopFirewallDriver # 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron true openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
在[vnc]部分,启用并配置远程控制台访问:
[vnc] enabled = true server_listen = 0.0.0.0 server_proxyclient_address = 192.168.75.20 novncproxy_base_url = http://192.168.75.20:6080/vnc_auto.html # 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf vnc enabled true openstack-config --set /etc/nova/nova.conf vnc server_listen 0.0.0.0 openstack-config --set /etc/nova/nova.conf vnc server_proxyclient_address 192.168.75.21 openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://192.168.75.20:6080/vnc_auto.html
In the [glance] section, configure the location of the Image service API:
[glance] api_servers = http://controller:9292 # 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf glance api_servers http://controller:9292
In the [oslo_concurrency] section, configure the lock path:
[oslo_concurrency] lock_path = /var/lib/nova/tmp # 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp
In the [placement] section, configure the Placement API:
placement] 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 = 000000 # 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf placement region_name RegionOne openstack-config --set /etc/nova/nova.conf placement project_domain_name Default openstack-config --set /etc/nova/nova.conf placement project_name service openstack-config --set /etc/nova/nova.conf placement auth_type password openstack-config --set /etc/nova/nova.conf placement user_domain_name Default openstack-config --set /etc/nova/nova.conf placement auth_url http://controller:5000/v3 openstack-config --set /etc/nova/nova.conf placement username placement openstack-config --set /etc/nova/nova.conf placement password 000000
15、确定计算节点是否支持虚拟机的硬件加速
[root@compute ~]# egrep -c '(vmx|svm)' /proc/cpuinfo 0 # 如果此命令返回的值为1或更大,则表示计算节点支持硬件加速,这通常不需要额外的配置。 # 如果此命令返回值为0,则表示计算节点不支持硬件加速,必须将libvirt配置为使用QEMU而不是KVM。
编辑/etc/nova/nova.conf文件中的[libvirt]部分。
[libvirt] virt_type = qemu # 使用下面的命令可直接修改 openstack-config --set /etc/nova/nova.conf libvirt virt_type qemu
16、启动服务
[root@compute ~]# systemctl enable libvirtd.service openstack-novacompute.service [root@compute ~]# systemctl start libvirtd.service openstack-novacompute.service
17、将计算节点添加到单元格数据库中
在控制节点执行
[root@controller ~]# source admin-openrc [root@controller ~]# openstack compute service list --service nova-compute +----+--------------+---------+------+---------+-------+------------------------ ----+ | ID | Binary | Host | Zone | Status | State | Updated At | +----+--------------+---------+------+---------+-------+------------------------ ----+ | 7 | nova-compute | compute | nova | enabled | up | 2023-06- 07T08:43:07.000000 | +----+--------------+---------+------+---------+-------+------------------------ ----+ # 发现计算主机 [root@controller ~]# su -s /bin/sh -c "nova-manage cell_v2 discover_hosts -- verbose" nova Found 2 cell mappings. Skipping cell0 since it does not contain hosts. Getting computes from cell 'cell1': 108a6e6f-c68c-465f-b4bd-a83d0d13b277 Checking host mapping for compute host 'compute': b73acc61-300e-4a9b-99bf- 6151507b5759 Creating host mapping for compute host 'compute': b73acc61-300e-4a9b-99bf- 6151507b5759 Found 1 unmapped computes in cell: 108a6e6f-c68c-465f-b4bd-a83d0d13b277
18、验证
[root@controller ~]# nova-status upgrade check Error: Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/nova/cmd/status.py", line 398, in main ret = fn(*fn_args, **fn_kwargs) File "/usr/lib/python2.7/site-packages/oslo_upgradecheck/upgradecheck.py", line 102, in check result = func(self) File "/usr/lib/python2.7/site-packages/nova/cmd/status.py", line 164, in _check_placement versions = self._placement_get("/") File "/usr/lib/python2.7/site-packages/nova/cmd/status.py", line 154, in _placement_get return client.get(path, raise_exc=True).json() File "/usr/lib/python2.7/site-packages/keystoneauth1/adapter.py", line 386, in get return self.request(url, 'GET', **kwargs) File "/usr/lib/python2.7/site-packages/keystoneauth1/adapter.py", line 248, in request return self.session.request(url, method, **kwargs) File "/usr/lib/python2.7/site-packages/keystoneauth1/session.py", line 961, in request raise exceptions.from_response(resp, method, url) Forbidden: Forbidden (HTTP 403)
解决办法
# 在/etc/httpd/conf.d/00-placement-api.conf文件中,添加以下内容 <Directory /usr/bin> <IfVersion >= 2.4> Require all granted </IfVersion> <IfVersion < 2.4> Order allow,deny Allow from all </IfVersion> </Directory> # 重启httpd服务 [root@controller ~]# systemctl restart httpd # 在次执行文件 [root@controller ~]# nova-status upgrade check +------------------------------------------------------------------+ | Upgrade Check Results | +------------------------------------------------------------------+ | Check: Cells v2 | | Result: Failure | | Details: No host mappings found but there are compute nodes. Run | | command 'nova-manage cell_v2 simple_cell_setup' and then | | retry. | +------------------------------------------------------------------+ | Check: Placement API | | Result: Success | | Details: None | +------------------------------------------------------------------+ | Check: Ironic Flavor Migration | | Result: Success | | Details: None | +------------------------------------------------------------------+ | Check: Cinder API | | Result: Success | | Details: None | 六、安装neutron服务 1、创建数据库 2、获取admin凭证 3、创建neutron用户 +------------------------------------------------------------------+