
Per the spec [1]: contributor/ – anything related to contributing to the project or how the team is managed. Applies to some of the current content under /developer, we are changing the name to emphasize that not all contributors are developers and sometimes developers are users but not contributors. We currently have a handful of docs that focus on the "how to develop or contribute" aspects of nova, and these are moved. Docs that focus on architecture or design decisions for nova are not moved, as these will go into 'reference'. A TODO is added to the former 'api_plugins' document as it's mega out-of-date and needs some serious work. [1] specs.openstack.org/openstack/docs-specs/specs/pike/os-manuals-migration Change-Id: Iad770688b4eafeb9caa710b4398b02d80a017a70
2.7 KiB
2.7 KiB
Testing Serial Console
The main aim of this feature is exposing an interactive web-based serial consoles through a web-socket proxy. This page describes how to test it from a devstack environment.
Setting up a devstack environment
For instructions on how to setup devstack with serial console support enabled see this guide.
Testing the API
Starting a new instance.
# cd devstack && . openrc
# nova boot --flavor 1 --image cirros-0.3.2-x86_64-uec cirros1
Nova provides a command nova get-serial-console which will returns a URL with a valid token to connect to the serial console of VMs.
# nova get-serial-console cirros1
+--------+-----------------------------------------------------------------+
| Type | Url |
+--------+-----------------------------------------------------------------+
| serial | ws://127.0.0.1:6083/?token=5f7854b7-bf3a-41eb-857a-43fc33f0b1ec |
+--------+-----------------------------------------------------------------+
Currently nova does not provide any client able to connect from an interactive console through a web-socket. A simple client for test purpose can be written with few lines of Python.
# sudo easy_install ws4py || sudo pip install ws4py
# cat >> client.py <<EOF
import sys
from ws4py.client.threadedclient import WebSocketClient
class LazyClient(WebSocketClient):
def run(self):
try:
while not self.terminated:
try:
= self.sock.recv(4096)
b
sys.stdout.write(b)
sys.stdout.flush()except: # socket error expected
pass
finally:
self.terminate()
if __name__ == '__main__':
if len(sys.argv) != 2 or not sys.argv[1].startswith("ws"):
print "Usage %s: Please use websocket url"
print "Example: ws://127.0.0.1:6083/?token=xxx"
1)
exit(try:
= LazyClient(sys.argv[1], protocols=['binary'])
ws connect()
ws.while True:
# keyboard event...
= sys.stdin.read(1)
c if c:
ws.send(c)
ws.run_forever()except KeyboardInterrupt:
ws.close() EOF
# python client.py ws://127.0.0.1:6083/?token=5f7854b7-bf3a-41eb-857a-43fc33f0b1ec
<enter>
cirros1 login