def get_webconsole(self, ctx, id, device_id): instance = db.get_instance_by_id(ctx.tenant, id) device = dict( map(lambda d: (d['id'], d), instance['devices']))[device_id] nova = self._get_nova_client(ctx) server = nova.servers.get(device['instance_id']) console = nova.servers.get_vnc_console(server, 'ajaxterm') return console['console']['url']
def get_webconsole(self, ctx, id, device_id): instance = db.get_instance_by_id(ctx.tenant, id) device = dict(map(lambda d: (d['id'], d), instance['devices']))[device_id] nova = self._get_nova_client(ctx) server = nova.servers.get(device['instance_id']) console = nova.servers.get_vnc_console(server, 'ajaxterm') return console['console']['url']
def instance_delete(tenant, id): try: instance_id = ObjectId(id) except InvalidId as e: return api_response(status=400, payload={'error': str(e)}) try: instance = db.get_instance_by_id(tenant, instance_id) except LookupError: return api_response( status=404, payload={'error': "Instance with id %s not found" % id}) destroyed = app.facade.destroy_instance(RequestContext(request), instance) return api_response(status=200, payload=instance_to_json(destroyed))
def get_instance(self, ctx, id): return db.get_instance_by_id(ctx.tenant, id)