Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose console port, add debug image flag #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@ def launch():
request.form['token'],
request.form['platform'],
request.form['version'],
debug_image=(request.form.get('debug', '0') == '1'),
tz_offset=(int(request.form['tz_offset']) if 'tz_offset' in request.form else None),
oauth=request.form.get('oauth', None)
)
emulators[uuid] = emu
emu.last_ping = now()
emu.run()
return jsonify(uuid=uuid, ws_port=emu.ws_port, vnc_display=emu.vnc_display, vnc_ws_port=emu.vnc_ws_port)
return jsonify(uuid=uuid, ws_port=emu.ws_port, vnc_display=emu.vnc_display,
vnc_ws_port=emu.vnc_ws_port, console_port=emu.console_port)

@app.route('/qemu/<emu>/ping', methods=['POST'])
def ping(emu):
Expand Down
6 changes: 4 additions & 2 deletions emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def _free_display(display):


class Emulator(object):
def __init__(self, token, platform, version, tz_offset=None, oauth=None):
def __init__(self, token, platform, version, debug_image=False, tz_offset=None, oauth=None):
self.token = token
self.qemu = None
self.pkjs = None
Expand All @@ -38,6 +38,7 @@ def __init__(self, token, platform, version, tz_offset=None, oauth=None):
self.tz_offset = tz_offset
self.oauth = oauth
self.persist_dir = None
self.debug_image = debug_image

def run(self):
self.group = gevent.pool.Group()
Expand Down Expand Up @@ -172,4 +173,5 @@ def _spawn_pkjs(self):
self.group.spawn(self.pkjs.communicate)

def _find_qemu_images(self):
return settings.QEMU_IMAGE_ROOT + "/" + self.platform + "/" + self.version + "/"
image_type = 'debug' if self.debug_image else 'release'
return settings.QEMU_IMAGE_ROOT + "/" + image_type + "/" + self.platform + "/" + self.version + "/"