API Endpoint

Nova has a system for managing multiple APIs on different subdomains. Currently there is support for the OpenStack API, as well as the Amazon EC2 API.

Common Components

The nova.api Module

The nova.api.cloud Module

OpenStack API

The openstack Module

The auth Module

The backup_schedules Module

The faults Module

The flavors Module

The images Module

The servers Module

The sharedipgroups Module

EC2 API

The nova.api.ec2 Module

Starting point for routing EC2 requests.

class Authorizer(application)

Bases: nova.wsgi.Middleware

Authorize an EC2 API request.

Return a 401 if ec2.controller and ec2.action in WSGI environ may not be executed in nova.context.

class EC2KeystoneAuth(application)

Bases: nova.wsgi.Middleware

Authenticate an EC2 request with keystone and convert to context.

class Executor

Bases: nova.wsgi.Application

Execute an EC2 API request.

Executes ‘ec2.action’ upon ‘ec2.controller’, passing ‘nova.context’ and ‘ec2.action_args’ (all variables in WSGI environ.) Returns an XML response, or a 400 upon failure.

class FaultWrapper(application)

Bases: nova.wsgi.Middleware

Calls the middleware stack, captures any exceptions into faults.

class Lockout(application)

Bases: nova.wsgi.Middleware

Lockout for x minutes on y failed auths in a z minute period.

x = lockout_timeout flag y = lockout_window flag z = lockout_attempts flag

Uses memcached if lockout_memcached_servers flag is set, otherwise it uses a very simple in-process cache. Due to the simplicity of the implementation, the timeout window is started with the first failed request, so it will block if there are x failed logins within that period.

There is a possible race condition where simultaneous requests could sneak in before the lockout hits, but this is extremely rare and would only result in a couple of extra failed attempts.

class NoAuth(application)

Bases: nova.wsgi.Middleware

Add user:project as ‘nova.context’ to WSGI environ.

class RequestLogging(application)

Bases: nova.wsgi.Middleware

Access-Log akin logging for all EC2 API requests.

RequestLogging.log_request_completion(response, request, start)
class Requestify(app, controller)

Bases: nova.wsgi.Middleware

class Validator(application)

Bases: nova.wsgi.Middleware

Validator.validate_ec2_id(val)
ec2_error(req, request_id, code, message)

Helper to send an ec2_compatible error

The apirequest Module

APIRequest class

class APIRequest(controller, action, version, args)

Bases: object

APIRequest.invoke(context)

The cloud Module

The images Module

The metadatarequesthandler Module

Tests

The api_unittest Module

The api_integration Module

The cloud_unittest Module

The api.fakes Module

The api.test_wsgi Module

The test_api Module

The test_auth Module

The test_faults Module

The test_flavors Module

The test_images Module

The test_servers Module

The test_sharedipgroups Module