Openstack 创建云主机报错500:No valid host was found. There are not enough hosts available

首先查看计算节点上的日志/var/log/nova/nova-compute
发现以下报错

2020-04-22 15:27:21.863 12189
ERROR
nova.compute.resource_tracker
[req-2239869a-3786-406c-9f10-8b24911058b4 - - - - -]
Skipping removal of allocations for deleted instances: 
Failed to retrieve allocations for resource provider 091f1c9b-793d-4863-9a39-49f26bdbf09a: 
{
"errors": 
	[
		{
		"status": 404,
	 	"request_id": "req-f20e9b15-9ffc-413d-a133-f90f246bb66c",
	 	"detail": "The resource could not be found. Resource provider '091f1c9b-793d-4863-9a39-49f26bdbf09a' not found: No resource provider with uuid 091f1c9b-793d-4863-9a39-49f26bdbf09a found  ",
	 	"title": "Not Found"
		}
	]
} 

2020-04-22 15:27:21.888 12189
ERROR 
nova.scheduler.client.report 
[req-2239869a-3786-406c-9f10-8b24911058b4 - - - - -] 
[req-de3ddf22-5bd5-4e08-8a7e-5ac206c06bff]
Failed to create resource provider record in placement API for UUID 091f1c9b-793d-4863-9a39-49f26bdbf09a. Got 409: 
{
"errors": 
	[
		{
		"status": 409,
		"request_id": "req-de3ddf22-5bd5-4e08-8a7e-5ac206c06bff", 
		"detail": "There was a conflict when trying to complete your request. Conflicting resource provider name: compute already exists.  ", 
		"title": "Conflict"
		}
	]
}

怀疑是计算节点注册时resource provider更新出现问题
随后重新将计算节点注册进openstack后依然报错,查阅资料后找到以下解决方法
安装osc-placement包对resource provider进行操作

yum install -y python2-osc-placement

加入环境变量并执行命令

export OS_PLACEMENT_API_VERSION=1.10
openstack allocation candidate list --resource VCPU=1

查看当前计算节点和resource provider

openstack compute service list
openstack resource provider  list

停止计算节点nova-compute服务
从service中删除计算节点和resource provider

openstack compute service delete <uuid>
openstack resource provider delete <uuid>

重新注册计算节点(如果有自动注册可以不输入以下命令)

su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

创建实例成功,报错消失

你可能感兴趣的:(openstack)