前言:
最近在研究云原生里面的OpenStack,因此,使用脚本打算搭建一套测试学习用的OpenStack平台,但OpenStack平台搭建完成后,发现了非常多的错误。感觉就是错误套错误,因此,记录一下错误发生的情况和如何解决错误,或许,会帮助到他人,毕竟,一个坑一个人跳就好了,不要都跳坑。
错误一:
ResourceProviderCreationFailed,此错误的详细日志记录如下:
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager [req-54886134-cdf7-47c4-bf43-6a34890ca1e1 - - - - -] Error updating resources for node controller.: ResourceProviderCreationFailed: Failed to create resource provider controller
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager Traceback (most recent call last):
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 7578, in update_available_resource_for_node
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager rt.update_available_resource(context, nodename)
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager File "/usr/lib/python2.7/site-packages/nova/compute/resource_tracker.py", line 720, in update_available_resource
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager self._update_available_resource(context, resources)
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager File "/usr/lib/python2.7/site-packages/oslo_concurrency/lockutils.py", line 274, in inner
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager return f(*args, **kwargs)
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager File "/usr/lib/python2.7/site-packages/nova/compute/resource_tracker.py", line 796, in _update_available_resource
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager self._update(context, cn)
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager File "/usr/lib/python2.7/site-packages/nova/compute/resource_tracker.py", line 918, in _update
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager inv_data,
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager File "/usr/lib/python2.7/site-packages/nova/scheduler/client/__init__.py", line 68, in set_inventory_for_provider
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager parent_provider_uuid=parent_provider_uuid,
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager File "/usr/lib/python2.7/site-packages/nova/scheduler/client/__init__.py", line 37, in __run_method
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager return getattr(self.instance, __name)(*args, **kwargs)
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager File "/usr/lib/python2.7/site-packages/nova/scheduler/client/report.py", line 1104, in set_inventory_for_provider
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager parent_provider_uuid=parent_provider_uuid)
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager File "/usr/lib/python2.7/site-packages/nova/scheduler/client/report.py", line 673, in _ensure_resource_provider
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager name=name or uuid)
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager ResourceProviderCreationFailed: Failed to create resource provider controller
2022-04-27 07:59:10.845 1274 ERROR nova.compute.manager
那么,日志茫茫多,怎么排查呢?请注意开始的两段话:
Error updating resources for node controller.: ResourceProviderCreationFailed: Failed to create resource provider controller
这里说的是更新控制节点的资源,无法创建资源以提供给控制端,直觉是placement api有问题,是不是placement用户的权限问题?
[root@controller ~]# openstack user list
+----------------------------------+-----------+
| ID | Name |
+----------------------------------+-----------+
| 1f9634bdf2ec47c68920201a2ee8174d | admin |
| 404e46ced80441e49b913e13003c83d2 | nova |
| 7df0cd7dfc5d49509782335ac677bdd1 | neutron |
| 971eb546e98e406b9be0d7462e5f4f15 | demo |
| a5771c91b4f941258e05151eb23d6d0c | glance |
| b7fb795d186840e7b0645d6ccf784a07 | placement |
+----------------------------------+-----------+
因此, 将该用户加入到admin组,执行命令:
openstack role add --project service --user placement admin
但很可惜,这个命令报了第二个错:
[root@controller nova]# openstack role add --project service --user placement admin
You are not authorized to perform the requested action: identity:list_roles. (HTTP 403) (Request-ID: req-92f671b0-79a7-49c7-8ee5-bb4154946f4f)
第二个错误解决后,查看日志可以看到错误消失了,正常的日志是这样的:
2022-**** *****5.454 1271 INFO nova.compute.manager [req-e2b80b65-d3d5-4651-9513-c57863b1e482 - - - - -] Updating bandwidth usage cache
错误二:
openstack role add --project service --user placement admin 这个命令输出错误如下(正常情况下,此命令是没有任何输出的):
You are not authorized to perform the requested action: identity:list_roles. (HTTP 403) (Request-ID: req-92f671b0-79a7-49c7-8ee5-bb4154946f4f)
这个错误是身份验证失败,其原因很多,但主要的常见的原因是token失效了,针对此问题,解决方法为重新生成token即可,因此,执行命令:
ADMIN_TOKEN=$(openssl rand -hex 10)
crudini --set /etc/keystone/keystone.conf DEFAULT admin_token $ADMIN_TOKEN
source admin-openrc.sh
再次执行openstack role add --project service --user placement admin 进行用户提权,成功,命令没有任何输出。
总结:
错误很多,也是互相有依赖的,OpenStack有非常多的错误是密码和权限相关的,因此,在搭建部署的时候要多注意哦。