#错误描述 :
打开openstack控制台后,控制台出错,显示Failed to connect to server (code: 1006),如下图:
#错误分析:
点击只显示控制台可看到地址是controller:6080…… 应该是域名解析出错。域名解析出错也可分为两个地方,1.nova节点的/etc/hosts中controller解析错误或者像下面nova节点的nova.conf中的[default]节中的配置出错;2.打开控制台的那台主机的域名解析出错,把controller解析成了别的ip(windows系统的/etc/hosts文件在C:\Windows\System32\drivers\etc\hosts)
[default]
……
novncproxy_base_url = http://controller:6080/vnc_auto.html
#解决方案
修改nova节点的nova.conf文件把上面的controller改成自己控制节点的ip
20181002更新
vnc界面如果出问题,排查思路如下
systemctl status openstack-nova-compute
systemctl status libvirtd
nova show 4f877e37-6a8e-4b96-9727-66ac0774da9c|grep instance
+ 查看虚拟机vnc端口
virsh vncdisplay $intance_name
+ 通过vnc客户端连接查看下vnc是否可用 或者telnet 查看该端口是否启用
反之亦可,控制节点通过sockify代理novnc 控制节点得novnc代理计算节点kvm的vnc
20190314更新
/var/log/nova/nova-novncproxy.log
2019-03-13 09:48:52.380 166194 DEBUG nova.console.websocketproxy [-] Closing socket listening at 172.16.0.2:6080 vmsg /usr/lib/python2.7/dist-packages/websockify/websocket.py:878
2019-03-13 09:48:57.428 173428 INFO nova.console.websocketproxy [-] WebSocket server settings:
2019-03-13 09:48:57.428 173428 INFO nova.console.websocketproxy [-] - Listen on 172.16.0.2:6080
2019-03-13 09:48:57.428 173428 INFO nova.console.websocketproxy [-] - Flash security policy server
2019-03-13 09:48:57.428 173428 INFO nova.console.websocketproxy [-] - Web server (no directory listings). Web root: /usr/share/novnc
2019-03-13 09:48:57.429 173428 INFO nova.console.websocketproxy [-] - No SSL/TLS support (no cert file)
2019-03-13 09:48:57.429 173428 INFO nova.console.websocketproxy [-] - proxying from 172.16.0.2:6080 to None:None
2019-03-13 09:52:16.630 173428 DEBUG nova.console.websocketproxy [-] 172.16.0.3: new handler Process vmsg /usr/lib/python2.7/dist-packages/websockify/websocket.py:878
2019-03-13 09:52:16.679 173428 DEBUG nova.console.websocketproxy [-] 172.16.0.3: new handler Process vmsg /usr/lib/python2.7/dist-packages/websockify/websocket.py:878
2019-03-13 09:52:16.683 174927 INFO nova.console.websocketproxy [-] 172.16.0.3 - - [13/Mar/2019 09:52:16] 172.16.0.3: Plain non-SSL (ws://) WebSocket connection
2019-03-13 09:52:16.684 174927 INFO nova.console.websocketproxy [-] 172.16.0.3 - - [13/Mar/2019 09:52:16] 172.16.0.3: Version hybi-13, base64: 'False'
2019-03-13 09:52:16.684 174927 INFO nova.console.websocketproxy [-] 172.16.0.3 - - [13/Mar/2019 09:52:16] 172.16.0.3: Path: '/websockify'
2019-03-13 09:52:16.715 174927 INFO nova.console.websocketproxy [req-3b13cf5e-fef1-4312-88bc-09d262030e6f - - - - -] handler exception: The token '5e795d5a-77ce-4fd4-817d-89a81b7545fe' is invalid or has expired
2019-03-13 09:52:16.715 174927 DEBUG nova.console.websocketproxy [req-3b13cf5e-fef1-4312-88bc-09d262030e6f - - - - -] exception vmsg /usr/lib/python2.7/dist-packages/websockify/websocket.py:878
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy Traceback (most recent call last):
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy File "/usr/lib/python2.7/dist-packages/websockify/websocket.py", line 933, in top_new_client
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy client = self.do_handshake(startsock, address)
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy File "/usr/lib/python2.7/dist-packages/websockify/websocket.py", line 863, in do_handshake
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy self.RequestHandlerClass(retsock, address, self)
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy File "/usr/lib/python2.7/dist-packages/nova/console/websocketproxy.py", line 176, in __init__
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy websockify.ProxyRequestHandler.__init__(self, *args, **kwargs)
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy File "/usr/lib/python2.7/dist-packages/websockify/websocket.py", line 114, in __init__
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy SimpleHTTPRequestHandler.__init__(self, req, addr, server)
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy File "/usr/lib/python2.7/SocketServer.py", line 652, in __init__
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy self.handle()
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy File "/usr/lib/python2.7/dist-packages/websockify/websocket.py", line 581, in handle
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy SimpleHTTPRequestHandler.handle(self)
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy self.handle_one_request()
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy method()
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy File "/usr/lib/python2.7/dist-packages/websockify/websocket.py", line 543, in do_GET
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy if not self.handle_websocket():
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy File "/usr/lib/python2.7/dist-packages/websockify/websocket.py", line 531, in handle_websocket
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy self.new_websocket_client()
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy File "/usr/lib/python2.7/dist-packages/nova/console/websocketproxy.py", line 108, in new_websocket_client
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy raise exception.InvalidToken(token=token)
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy InvalidToken: The token '5e795d5a-77ce-4fd4-817d-89a81b7545fe' is invalid or has expired
2019-03-13 09:52:16.715 174927 ERROR nova.console.websocketproxy
通过日志可以看出是token问题 过期或者无效,缓存token的是memcache
nova-consoleauth
r日志/var/log/nova/nova-consoleauth.log
2019-03-13 09:52:24.075 173407 INFO nova.consoleauth.manager [req-a1e9b25d-39ea-420c-970a-1156fee6f5f5 - - - - -] Checking Token: 5e795d5a-77ce-4fd4-817d-89a81b7545fe, False
nova-console
nova-novncproxy
服务是否正常memcache
来缓存得 查看nova。conf
中 memcache的配置[cache]
backend = oslo_cache.memcache_pool
enabled = True
memcached_servers = 172.16.0.2:11211,172.16.0.3:11211,172.16.0.4:11211
可以看到是memcached_servers
这个选项写错修改成memcache_servers
重启nova服务解决问题