summaryrefslogtreecommitdiffstats
path: root/nova/db
diff options
context:
space:
mode:
authorAndrew Laski <andrew.laski@rackspace.com>2012-12-12 10:35:11 -0500
committerAndrew Laski <andrew.laski@rackspace.com>2013-02-13 14:53:43 -0500
commit9ed8d398c2232722c44ca06ea545f679d4514d43 (patch)
treede4c904d49f537ce2f8982b296461b342479b84b /nova/db
parent787e334a105c47bb387dc51c8798b4ac8e1d7bc0 (diff)
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
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/api.py7
-rw-r--r--nova/db/sqlalchemy/api.py10
2 files changed, 7 insertions, 10 deletions
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