思路仅供参考
在配置完openstack测试创建实例的时候,发现有报错:no valid host。可能导致这个报错的原因有很多,可能是节点本身存储不够。也可能是配置问题。
一般情况下,创建实例报错,可以查看的日志有:控制节点的conductor日志以及调度日志schedule。计算节点的compute日志,首先查看控制节点的conductor日志:
tail -300f /var/log/nova/nova-conductor.log
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager [req-e08a8d8d-f6de-4249-a8c3-8ac5771c7ef0 a37fd80024f0443f9169ee9119ab62ea 0e6779d7332c4710928b2c5356a1cf0a - default default] Failed to schedule instances: NoValidHost_Remote: No valid host was found. There are not enough hosts available.
Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py”, line 226, in inner
return func(*args, **kwargs)
File “/usr/lib/python2.7/site-packages/nova/scheduler/manager.py”, line 169, in select_destinations
allocation_request_version, return_alternates)
File “/usr/lib/python2.7/site-packages/nova/scheduler/filter_scheduler.py”, line 91, in select_destinations
allocation_request_version, return_alternates)
File “/usr/lib/python2.7/site-packages/nova/scheduler/filter_scheduler.py”, line 256, in _schedule
claimed_instance_uuids)
File “/usr/lib/python2.7/site-packages/nova/scheduler/filter_scheduler.py”, line 293, in _ensure_sufficient_hosts
raise exception.NoValidHost(reason=reason)
NoValidHost: No valid host was found. There are not enough hosts available.
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager Traceback (most recent call last):
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/nova/conductor/manager.py”, line 1238, in schedule_and_build_instances
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager instance_uuids, return_alternates=True)
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/nova/conductor/manager.py”, line 750, in _schedule_instances
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager return_alternates=return_alternates)
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/nova/scheduler/client/init.py”, line 50, in select_destinations
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager instance_uuids, return_objects, return_alternates)
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/nova/scheduler/client/init.py”, line 35, in __run_method
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager return getattr(self.instance, __name)(*args, **kwargs)
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/nova/scheduler/client/query.py”, line 42, in select_destinations
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager instance_uuids, return_objects, return_alternates)
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/nova/scheduler/rpcapi.py”, line 160, in select_destinations
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager return cctxt.call(ctxt, ‘select_destinations’, **msg_args)
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/oslo_messaging/rpc/client.py”, line 179, in call
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager retry=self.retry)
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/oslo_messaging/transport.py”, line 133, in _send
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager retry=retry)
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/oslo_messaging/_drivers/amqpdriver.py”, line 584, in send
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager call_monitor_timeout, retry=retry)
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/oslo_messaging/_drivers/amqpdriver.py”, line 575, in _send
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager raise result
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager NoValidHost_Remote: No valid host was found. There are not enough hosts available.
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager Traceback (most recent call last):
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py”, line 226, in inner
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager return func(*args, **kwargs)
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/nova/scheduler/manager.py”, line 169, in select_destinations
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager allocation_request_version, return_alternates)
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/nova/scheduler/filter_scheduler.py”, line 91, in select_destinations
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager allocation_request_version, return_alternates)
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/nova/scheduler/filter_scheduler.py”, line 256, in _schedule
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager claimed_instance_uuids)
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager File “/usr/lib/python2.7/site-packages/nova/scheduler/filter_scheduler.py”, line 293, in _ensure_sufficient_hosts
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager raise exception.NoValidHost(reason=reason)
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager NoValidHost: No valid host was found. There are not enough hosts available.
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager
2019-04-28 09:16:50.921 16770 ERROR nova.conductor.manager
2019-04-28 09:16:51.095 16770 WARNING nova.scheduler.utils [req-e08a8d8d-f6de-4249-a8c3-8ac5771c7ef0 a37fd80024f0443f9169ee9119ab62ea 0e6779d7332c4710928b2c5356a1cf0a - default default] Failed to compute_task_build_instances: No valid host was found. There are not enough hosts available.
Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py”, line 226, in inner
return func(*args, **kwargs)
File “/usr/lib/python2.7/site-packages/nova/scheduler/manager.py”, line 169, in select_destinations
allocation_request_version, return_alternates)
File “/usr/lib/python2.7/site-packages/nova/scheduler/filter_scheduler.py”, line 91, in select_destinations
allocation_request_version, return_alternates)
File “/usr/lib/python2.7/site-packages/nova/scheduler/filter_scheduler.py”, line 256, in _schedule
claimed_instance_uuids)
File “/usr/lib/python2.7/site-packages/nova/scheduler/filter_scheduler.py”, line 293, in _ensure_sufficient_hosts
raise exception.NoValidHost(reason=reason)
日志一直重复no valid host was found。
我们继续查看计算节点的compute日志:
tail -300f /var/log/nova/nova-compute.log
2019-04-28 09:16:47.085 13481 INFO nova.compute.resource_tracker [req-1b6c1db2-57c9-429f-a965-207fcd4d5a23 - - - - -] Final resource view: name=datanote1 phys_ram=16378MB used_ram=512MB phys_disk=49GB used_disk=0GB total_vcpus=4 used_vcpus=0 pci_stats=[]
2019-04-28 09:16:47.139 13481 ERROR nova.scheduler.client.report [req-1b6c1db2-57c9-429f-a965-207fcd4d5a23 - - - - -] [req-684cdfd9-a572-4991-8f92-887638ca664a] Failed to create resource provider record in placement API for UUID 1073c937-9af0-4f94-a644-e015fa2e7432. Got 409: {“errors”: [{“status”: 409, “request_id”: “req-684cdfd9-a572-4991-8f92-887638ca664a”, “detail”: "There was a conflict when trying to complete your request.\n\n Conflicting resource provider name: datanote1 already exists. ", “title”: “Conflict”}]}.
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager [req-1b6c1db2-57c9-429f-a965-207fcd4d5a23 - - - - -] Error updating resources for node datanote1.: ResourceProviderCreationFailed: Failed to create resource provider datanote1
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager Traceback (most recent call last):
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/nova/compute/manager.py”, line 7833, in _update_available_resource_for_node
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager rt.update_available_resource(context, nodename)
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/nova/compute/resource_tracker.py”, line 720, in update_available_resource
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager self._update_available_resource(context, resources)
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/oslo_concurrency/lockutils.py”, line 274, in inner
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager return f(*args, **kwargs)
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/nova/compute/resource_tracker.py”, line 797, in _update_available_resource
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager self._update(context, cn)
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/retrying.py”, line 68, in wrapped_f
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager return Retrying(*dargs, **dkw).call(f, *args, **kw)
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/retrying.py”, line 223, in call
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager return attempt.get(self._wrap_exception)
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/retrying.py”, line 261, in get
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager six.reraise(self.value[0], self.value[1], self.value[2])
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/retrying.py”, line 217, in call
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/nova/compute/resource_tracker.py”, line 959, in _update
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager self._update_to_placement(context, compute_node)
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/nova/compute/resource_tracker.py”, line 911, in _update_to_placement
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager context, compute_node.uuid, name=compute_node.hypervisor_hostname)
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/nova/scheduler/client/init.py”, line 35, in __run_method
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager return getattr(self.instance, __name)(*args, **kwargs)
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/nova/scheduler/client/report.py”, line 1006, in get_provider_tree_and_ensure_root
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager parent_provider_uuid=parent_provider_uuid)
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/nova/scheduler/client/report.py”, line 672, in _ensure_resource_provider
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager parent_provider_uuid=parent_provider_uuid)
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/nova/scheduler/client/report.py”, line 74, in wrapper
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager return f(self, *a, **k)
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager File “/usr/lib/python2.7/site-packages/nova/scheduler/client/report.py”, line 606, in _create_resource_provider
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager raise exception.ResourceProviderCreationFailed(name=name)
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager ResourceProviderCreationFailed: Failed to create resource provider datanote1
2019-04-28 09:16:47.140 13481 ERROR nova.compute.manager
这里可以发现错误:无法在计算节点创建资源provider,当尝试完成该创建请求时发现矛盾的资源。
There was a conflict when trying to complete your request.\n\n Conflicting resource provider name: datanote1 already exists. ", “title”: “Conflict”}]
Failed to create resource provider datanote1
经过仔细检查发现nova.conf的配置文件配置有问题,更正所有配置后,重启服务,仍然报相同的错误。笔者这里是将发现的计算节点删除,然后重新发现计算节点
MariaDB [(none)]> use nova;
Database changed
MariaDB [nova]> delete from nova.services where host=“datanote1”;
Query OK, 1 row affected (0.00 sec)
MariaDB [nova]> delete from compute_nodes where \ hypervisor_hostname=“datanote1”;
Query OK, 1 row affected (0.00 sec)
控制节点 systemctl restart openstack-nova-api.service \
openstack-nova-consoleauth.service openstack-nova-scheduler.service
openstack-nova-conductor.service openstack-nova-novncproxy.service
计算节点 systemctl restart libvirtd.service openstack-nova-compute.service
控制节点:
#. admin-openrc
#su -s /bin/sh -c “nova-manage cell_v2 discover_hosts --verbose” nova
#openstack compute service list