from invirt.common import InvalidInput, CodeError
from view import View, revertStandardError
+import ajaxterm
static_dir = os.path.join(os.path.dirname(__file__), 'static')
else:
raise InvalidInput('back', back, 'Not a known back page.')
+ atmulti = ajaxterm.Multiplex()
+ atsessions = {}
+
+ @cherrypy.expose
+ @cherrypy.tools.mako(filename="/terminal.mako")
+ def terminal(self, machine_id):
+ machine = validation.Validate(cherrypy.request.login, cherrypy.request.state, machine_id=machine_id).machine
+
+ status = controls.statusInfo(machine)
+ has_vnc = hasVnc(status)
+
+ d = dict(on=status,
+ has_vnc=has_vnc,
+ machine=machine,
+ hostname=cherrypy.request.local.name)
+ return d
+
machine = MachineView()
pre.term span.b6 { background-color: #0bb; }
pre.term span.b7 { background-color: #bbb; }
-body { background-color: #888; }
#term {
float: left;
}
<%def name="commands()">
% if on:
% if not machine.type.hvm:
- Console access: type
+ Console access: <a href="machine/${machine.machine_id}/terminal">Web Terminal</a> or type
<tt>ssh ${machine.name}@${config.console.hostname}</tt>
on Athena. <a href="https://xvm.scripts.mit.edu/wiki/SerialConsole">(more info)</a>
% elif has_vnc:
- <strong><a href="machine/${machine.machine_id}/vnc">Get Console</a></strong>
+ <strong><a href="machine/${machine.machine_id}/vnc">Get Console</a> or <a href="machine/${machine.machine_id}/terminal">Web Terminal</a></strong>
% else:
VNC console not enabled; still booting?
% endif
% if machine:
<li><a href="machine/${machine.machine_id}">Info</a></li>
<li><a href="machine/${machine.machine_id}/vnc">Console</a></li>
+<li><a href="machine/${machine.machine_id}/terminal">Terminal</a></li>
% endif
<li><a href="help">Help</a></li>
</ul>
--- /dev/null
+<%page expression_filter="h" />
+<%inherit file="skeleton.mako" />
+
+<%def name="title()">
+Terminal for ${machine.name}
+</%def>
+
+<style type='text/css'>body { max-width: none }</style>
+% if not on:
+<p> Your machine appears to be off.</p>
+% elif has_vnc:
+<p> Your machine appears to be an HVM; you will need to specially configure a serial console before you can use this terminal.</p>
+% endif
+
+<%def name="header_extra()">
+${parent.header_extra()}
+<link rel="stylesheet" type="text/css" href="static/ajaxterm/ajaxterm.css"/>
+<script type="text/javascript" src="static/ajaxterm/sarissa.js"></script>
+<script type="text/javascript" src="static/ajaxterm/sarissa_dhtml.js"></script>
+<script type="text/javascript" src="static/ajaxterm/ajaxterm.js"></script>
+<script type="text/javascript">
+window.onload=function() {
+ t=ajaxterm.Terminal("term", 80,25);
+}
+</script>
+</%def>
+
+<div id="term"></div>