Пример #1
0
    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']
Пример #2
0
    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']
Пример #3
0
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))
Пример #4
0
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))
Пример #5
0
 def get_instance(self, ctx, id):
     return db.get_instance_by_id(ctx.tenant, id)
Пример #6
0
 def get_instance(self, ctx, id):
     return db.get_instance_by_id(ctx.tenant, id)