1 錯誤詳情
在創建實例時,實例狀態顯示“錯誤”
故障代碼為500,提示為No valid host was found
2 原因分析
需要更多的日志信息來定位具體的問題
2.1 計算節點
/var/log/nova/nova-compute.log日志:
Failed to contact the endpoint at http://controller:8778 for discovery.
8778是placement服務的端口。
2.2 控制節點
/var/log/placement/placement-api.log出現如下錯誤日志:
AH01630: client denied by server configuration: /usr/bin/placement-api
/var/log/nova/nova-conductor.log出現如下錯誤日志:
Got 403: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>403 Forbidden</title> </head><body> <h1>Forbidden</h1> <p>You don't have permission to access /allocation_candidates on this server.</p> </body></html>
/var/log/nova/nova-conductor.log出現如下錯誤日志:
NoValidHost: No valid host was found.
: NoValidHost_Remote: No valid host was found.
2.3 問題定位
根據多個服務的日志信息,可以看出問題出在placement服務,並且是目錄權限問題。
placement服務是基於http服務,使用了wsgi插件,於是檢查placement的wsgi配置文件/etc/httpd/conf.d/00-placement-api.conf,經過和其他服務的配置文件比較,發現沒有對目錄進行授權。
3 解決問題
3.1 方法
環境說明:centos 7.6,apache版本2.4
編輯placement的配置文件:/etc/httpd/conf.d/00-placement-api.conf
<VirtualHost *:8778> #在該節點增加以下部分,對目錄授權 <Directory /usr/bin> <IfVersion >= 2.4> Require all granted </IfVersion> <IfVersion < 2.4> Order allow,deny Allow from all </IfVersion> </Directory> </VirtualHost>
重啟httpd服務:
# systemctl restart httpd
3.2 解決后效果
在控制節點中運行以下命令檢查服務狀態:
# curl http://controller:8778/
返回如下結果:
{"versions": [{"status": "CURRENT", "min_version": "1.0", "max_version": "1.36", "id": "v1.0", "links": [{"href": "", "rel": "self"}]}]}