Endpoint Documentation

This page contains the Endpoint Package documentation.

The admin Module

Admin API controller, exposed through http via the api worker.

class nova.endpoint.admin.AdminController

Bases: object

API Controller for users, hosts, nodes, and workers. Trivial admin_only wrapper will be replaced with RBAC, allowing project managers to administer project users.

deregister_user(*args, **kwargs)
Internal wrapper method for admin-only API calls
describe_host(*args, **kwargs)
Internal wrapper method for admin-only API calls
describe_hosts(*args, **kwargs)
Internal wrapper method for admin-only API calls
describe_user(*args, **kwargs)
Internal wrapper method for admin-only API calls
describe_users(*args, **kwargs)
Internal wrapper method for admin-only API calls
generate_x509_for_user(*args, **kwargs)
Internal wrapper method for admin-only API calls
register_user(*args, **kwargs)
Internal wrapper method for admin-only API calls
nova.endpoint.admin.admin_only(target)
Decorator for admin-only API calls
nova.endpoint.admin.host_dict(host)
Convert a host model object to a result dict
nova.endpoint.admin.user_dict(user, base64_file=None)
Convert the user object to a result dict

The api Module

Tornado REST API Request Handlers for Nova functions Most calls are proxied into the responsible controller.

class nova.endpoint.api.APIRequest(controller, action)

Bases: object

send(context, **kwargs)
class nova.endpoint.api.APIRequestContext(handler, user, project)
Bases: object
class nova.endpoint.api.APIRequestHandler(application, request, transforms=None)

Bases: tornado.web.RequestHandler

execute(*args, **kwargs)
get(controller_name)
post(controller_name)
class nova.endpoint.api.APIServerApplication(controllers)
Bases: tornado.web.Application
class nova.endpoint.api.MetadataRequestHandler(application, request, transforms=None)

Bases: tornado.web.RequestHandler

get(path)
lookup(path, data)
print_data(data)
class nova.endpoint.api.RootRequestHandler(application, request, transforms=None)

Bases: tornado.web.RequestHandler

get()

The cloud Module

Cloud Controller: Implementation of EC2 REST API calls, which are dispatched to other nodes via AMQP RPC. State is via distributed datastore.

class nova.endpoint.cloud.CloudController

Bases: object

CloudController provides the critical dispatch between inbound API calls through the endpoint and messages sent to the other nodes.

allocate_address(context, *args, **kwargs)
associate_address(context, *args, **kwargs)
attach_volume(context, *args, **kwargs)
create_key_pair(context, *args, **kwargs)
create_security_group(context, *args, **kwargs)
create_volume(context, *args, **kwargs)
delete_key_pair(context, *args, **kwargs)
delete_security_group(context, *args, **kwargs)
delete_volume(context, *args, **kwargs)
deregister_image(context, *args, **kwargs)
describe_addresses(context, *args, **kwargs)
describe_availability_zones(context, *args, **kwargs)
describe_image_attribute(context, *args, **kwargs)
describe_images(context, *args, **kwargs)
describe_instances(context, *args, **kwargs)
describe_key_pairs(context, *args, **kwargs)
describe_regions(context, *args, **kwargs)
describe_security_groups(context, *args, **kwargs)
describe_snapshots(context, *args, **kwargs)
describe_volumes(context, *args, **kwargs)
detach_volume(context, *args, **kwargs)
disassociate_address(context, *args, **kwargs)
format_addresses(context)
format_volume(context, volume)
get_console_output(context, *args, **kwargs)
get_instance_by_ip(ip)
get_metadata(ip)
instances
All instances in the system, as dicts
lease_ip(context, private_ip, **kwargs)
modify_image_attribute(context, *args, **kwargs)
reboot_instances(context, *args, **kwargs)
register_image(context, *args, **kwargs)
release_address(context, *args, **kwargs)
release_ip(context, private_ip, **kwargs)
run_instances(context, *args, **kwargs)
setup()
Ensure the keychains and folders exist.
terminate_instances(context, *args, **kwargs)
update_state(topic, value)
accepts status reports from the queue and consolidates them
volumes
returns a list of all volumes

The images Module

Proxy AMI-related calls from the cloud controller, to the running objectstore daemon.

nova.endpoint.images.conn(context)
nova.endpoint.images.deregister(context, image_id)
unregister an image
nova.endpoint.images.list(context, filter_list=[])

return a list of all images that a user can see

optionally filtered by a list of image_id

nova.endpoint.images.modify(context, image_id, operation)
nova.endpoint.images.qs(params)
nova.endpoint.images.register(context, image_location)
rpc call to register a new image based from a manifest

The api_unittest Module

class nova.tests.api_unittest.ApiEc2TestCase(methodName='runTest')

Bases: nova.test.BaseTestCase

expect_http(host=None, is_secure=False)
setUp()
test_describe_instances()
test_get_all_key_pairs()
class nova.tests.api_unittest.FakeHttplibConnection(app, host, is_secure=False)

Bases: object

a fake httplib.HTTPConnection for boto to use

requests made via this connection actually get translated and routed into our tornado app, we then wait for the response and turn it back into the httplib.HTTPResponse that boto expects.

close()
getresponse()
request(method, path, data, headers)
class nova.tests.api_unittest.FakeHttplibSocket(s)

Bases: object

a fake socket implementation for httplib.HTTPResponse, trivial

makefile(mode, other)
class nova.tests.api_unittest.FakeTornadoConnection(d)

Bases: object

a fake connection object for tornado to pass to its handlers

web requests are expected to write to this as they get data and call finish when they are done with the request, we buffer the writes and kick off a callback when it is done so that we can feed the result back into boto.

finish()
stream
write(chunk)
class nova.tests.api_unittest.FakeTornadoStream

Bases: object

a fake stream to satisfy tornado’s assumptions, trivial

set_close_callback(f)
nova.tests.api_unittest.boto_to_tornado(method, path, headers, data, host, connection=None)

translate boto requests into tornado requests

connection should be a FakeTornadoHttpConnection instance

nova.tests.api_unittest.raw_to_httpresponse(s)
translate a raw tornado http response into an httplib.HTTPResponse

The api_integration Module

class nova.tests.api_integration.APIIntegrationTests(methodName='runTest')

Bases: unittest.TestCase

test_001_get_all_images()
nova.tests.api_integration.get_connection()

The cloud_unittest Module

class nova.tests.cloud_unittest.CloudTestCase(methodName='runTest')

Bases: nova.test.BaseTestCase

setUp()
tearDown()
test_console_output()
test_instance_update_state()
test_run_instances()

The network_unittest Module

class nova.tests.network_unittest.FakeDNSMasq

Bases: object

issue_ip(mac, ip, hostname, interface)
release_ip(mac, ip, hostname, interface)
class nova.tests.network_unittest.NetworkTestCase(methodName='runTest')

Bases: nova.test.TrialTestCase

setUp()
tearDown()
test_allocate_deallocate_ip()
test_deallocate_before_issued()
test_public_network_allocation()
test_range_allocation()
test_release_before_deallocate()
test_subnet_edge()
test_too_many_addresses()

Here, we test that a proper NoMoreAddresses exception is raised.

However, the number of available IP addresses depends on the test environment’s setup.

Network size is set in test fixture’s setUp method.

There are FLAGS.cnt_vpn_clients addresses reserved for VPN (NUM_RESERVED_VPN_IPS)

And there are NUM_STATIC_IPS that are always reserved by Nova for the necessary services (gateway, CloudPipe, etc)

So we should get flags.network_size - (NUM_STATIC_IPS +
NUM_PREALLOCATED_IPS + NUM_RESERVED_VPN_IPS)

usable addresses

nova.tests.network_unittest.binpath(script)
nova.tests.network_unittest.is_in_project(address, project_id)