Add admin actions extension

The optional os-admin-actions extension adds new wsgi_actions to the
volumes/action resource and a new snapshots/action endpoint.

With this extension both controllers will support an os-reset_status
action to force a database update of a volume or snapshot that is stuck
in a failed/incorrect status. The os-reset_status action works
similarly to the compute api's os-reset_state action for instances.

The os-force_delete action behaves similarly to the "cinder-manage
volume delete" command and allows operators/admins to retry the delete
operation after it has gone into an error_deleting status with an admin
api call.

The os-admin-actions extension is enabled by default, but limited to the
admin api by the default policy.json rules. Individual admin actions
can be disabled with policy rules as well.

Example of os-reset_status action on a volume:

curl http://localhost:8776/v1/${PROJECT_ID}/volumes/${VOLUME_ID}/action \
    -H "x-auth-token: ${ADMIN_AUTH_TOKEN}" \
    -H 'content-type: application/json' \
    -d '{"os-reset_status": {"status": "error"}}'

The new admin only api can assist deployers who encounter bugs or
operational issues that result in failed actions.

It can also be used by future storage backends to support async callback
style status updates from long running actions or operations which have
encountered an error will be retried.

Also updates the api.openstack.wsgi.ControllerMetaclass to support
sub-classing wsgi.Controllers that define wsgi_actions.

Partial fix for bug #1039706

Change-Id: If795599d5150dea362279d75a75276f3166d0149
This commit is contained in:
Clay Gerrard
2012-09-14 16:15:35 +00:00
parent d41b93267f
commit 4ebec87730
14 changed files with 398 additions and 17 deletions

View File

@@ -1070,6 +1070,9 @@ class ControllerMetaclass(type):
# Find all actions
actions = {}
extensions = []
# start with wsgi actions from base classes
for base in bases:
actions.update(getattr(base, 'wsgi_actions', {}))
for key, value in cls_dict.items():
if not callable(value):
continue