This Page

Psst... hey. You're reading the latest content, but it might be out of sync with code. You can read Nova 2011.2 docs or all OpenStack docs too.

The nova.api.openstack.common Module

class nova.api.openstack.common.MetadataHeadersSerializer

Bases: nova.api.openstack.wsgi.ResponseHeadersSerializer

delete(response, data)
class nova.api.openstack.common.MetadataXMLDeserializer(metadata=None)

Bases: nova.api.openstack.wsgi.XMLDeserializer

create(datastring)
extract_metadata(metadata_node)

Marshal the metadata attribute of a parsed request

update(datastring)
update_all(datastring)
class nova.api.openstack.common.MetadataXMLSerializer(xmlns='http://docs.openstack.org/compute/api/v1.1')

Bases: nova.api.openstack.wsgi.XMLDictSerializer

create(metadata_dict)
default(*args, **kwargs)
index(metadata_dict)
meta_list_to_xml(xml_doc, meta_items)
show(meta_item_dict)
update(meta_item_dict)
update_all(metadata_dict)
nova.api.openstack.common.check_img_metadata_quota_limit(context, metadata)
nova.api.openstack.common.check_snapshots_enabled(f)
nova.api.openstack.common.get_id_from_href(href)

Return the id or uuid portion of a url.

Given: ‘http://www.foo.com/bar/123?q=4‘ Returns: ‘123’

Given: ‘http://www.foo.com/bar/abc123?q=4‘ Returns: ‘abc123’

nova.api.openstack.common.get_pagination_params(request)

Return marker, limit tuple from request.

Parameters:requestwsgi.Request possibly containing ‘marker’ and ‘limit’ GET variables. ‘marker’ is the id of the last element the client has seen, and ‘limit’ is the maximum number of items to return. If ‘limit’ is not specified, 0, or > max_limit, we default to max_limit. Negative values for either marker or limit will cause exc.HTTPBadRequest() exceptions to be raised.
nova.api.openstack.common.get_version_from_href(href)

Returns the api version in the href.

Returns the api version in the href. If no version is found, 1.0 is returned

Given: ‘http://www.nova.com/123‘ Returns: ‘1.0’

Given: ‘http://www.nova.com/v1.1‘ Returns: ‘1.1’

nova.api.openstack.common.limited(items, request, max_limit=1000)

Return a slice of items according to requested offset and limit.

@param items: A sliceable entity @param request: wsgi.Request possibly containing ‘offset’ and ‘limit’

GET variables. ‘offset’ is where to start in the list, and ‘limit’ is the maximum number of items to return. If ‘limit’ is not specified, 0, or > max_limit, we default to max_limit. Negative values for either offset or limit will cause exc.HTTPBadRequest() exceptions to be raised.

@kwarg max_limit: The maximum number of items to return from ‘items’

nova.api.openstack.common.limited_by_marker(items, request, max_limit=1000)

Return a slice of items according to the requested marker and limit.

nova.api.openstack.common.remove_version_from_href(href)

Removes the first api version from the href.

Given: ‘http://www.nova.com/v1.1/123‘ Returns: ‘http://www.nova.com/123

Given: ‘http://www.nova.com/v1.1‘ Returns: ‘http://www.nova.com

nova.api.openstack.common.status_from_state(vm_state, task_state='default')

Given vm_state and task_state, return a status string.

nova.api.openstack.common.vm_state_from_status(status)

Map the server status string to a vm state.