From 9ed8d398c2232722c44ca06ea545f679d4514d43 Mon Sep 17 00:00:00 2001 From: Andrew Laski Date: Wed, 12 Dec 2012 10:35:11 -0500 Subject: API extension for accessing instance_actions Adds a new API extension for accessing the recorded actions and events on an instance. Usage is documented with api samples. Additionally it modified the db api to retrieve actions by request_id since the api does not return the db id. This extension is the first consumer of that method so there's no issue of changing behaviour elsewhere. Blueprint instance-actions DocImpact Change-Id: I74109586cc762a7f51d2b114896cf071ee0671cb --- nova/db/api.py | 7 ++++--- nova/db/sqlalchemy/api.py | 10 +++------- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'nova/db') diff --git a/nova/db/api.py b/nova/db/api.py index ffd153a46..b07cd6b8b 100644 --- a/nova/db/api.py +++ b/nova/db/api.py @@ -1630,9 +1630,9 @@ def actions_get(context, uuid): return IMPL.actions_get(context, uuid) -def action_get_by_id(context, uuid, action_id): - """Get the action by id and given instance.""" - return IMPL.action_get_by_id(context, uuid, action_id) +def action_get_by_request_id(context, uuid, request_id): + """Get the action by request_id and given instance.""" + return IMPL.action_get_by_request_id(context, uuid, request_id) def action_event_start(context, values): @@ -1646,6 +1646,7 @@ def action_event_finish(context, values): def action_events_get(context, action_id): + """Get the events by action id.""" return IMPL.action_events_get(context, action_id) diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index d0a58e44f..81d26d2d8 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -4586,13 +4586,9 @@ def actions_get(context, instance_uuid): return actions -def action_get_by_id(context, instance_uuid, action_id): - """Get the action by id and given instance.""" - action = model_query(context, models.InstanceAction).\ - filter_by(instance_uuid=instance_uuid).\ - filter_by(id=action_id).\ - first() - +def action_get_by_request_id(context, instance_uuid, request_id): + """Get the action by request_id and given instance.""" + action = _action_get_by_request_id(context, instance_uuid, request_id) return action -- cgit