From 130c37f8c45b2c3c719bc47af009956dea2079cf Mon Sep 17 00:00:00 2001 From: Liam McLoughlin Date: Mon, 6 Jul 2015 18:46:37 -0700 Subject: [PATCH] Expose console port, add debug image flag --- controller.py | 4 +++- emulator.py | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/controller.py b/controller.py index 0345b4d..4ea3f55 100644 --- a/controller.py +++ b/controller.py @@ -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//ping', methods=['POST']) def ping(emu): diff --git a/emulator.py b/emulator.py index 52a95da..37c1d0e 100644 --- a/emulator.py +++ b/emulator.py @@ -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 @@ -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() @@ -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 + "/"