From ab2920726c0e2633c033a31a324f30a97fdce6bd Mon Sep 17 00:00:00 2001 From: Andrew Laski Date: Thu, 21 Feb 2013 17:30:06 -0500 Subject: Rework instance actions to work with cells In a cells setup an instance action is recorded at the global cell level while events try to get recorded in a child cell compute node or scheduler. The event recording fails because it can't find an action to link to. This patch adds the recording of actions at the child cell level, and changes the API extension to query the db in a child cell for the record of actions and events. This does not address the fact that an action is recorded at the global cell level. Bug 1132935 Change-Id: I5831f146397e7afa2d93d26c5d6f9abb9bc6670d --- nova/api/openstack/compute/contrib/instance_actions.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/instance_actions.py b/nova/api/openstack/compute/contrib/instance_actions.py index ecacde7bf..4eaa9a1ee 100644 --- a/nova/api/openstack/compute/contrib/instance_actions.py +++ b/nova/api/openstack/compute/contrib/instance_actions.py @@ -19,7 +19,6 @@ from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova.api.openstack import xmlutil from nova import compute -from nova import db authorize_actions = extensions.extension_authorizer('compute', 'instance_actions') @@ -67,6 +66,7 @@ class InstanceActionsController(wsgi.Controller): def __init__(self): super(InstanceActionsController, self).__init__() self.compute_api = compute.API() + self.action_api = compute.InstanceActionAPI() def _format_action(self, action_raw): action = {} @@ -86,7 +86,7 @@ class InstanceActionsController(wsgi.Controller): context = req.environ["nova.context"] instance = self.compute_api.get(context, server_id) authorize_actions(context, target=instance) - actions_raw = db.actions_get(context, server_id) + actions_raw = self.action_api.actions_get(context, instance) actions = [self._format_action(action) for action in actions_raw] return {'instanceActions': actions} @@ -96,14 +96,16 @@ class InstanceActionsController(wsgi.Controller): context = req.environ['nova.context'] instance = self.compute_api.get(context, server_id) authorize_actions(context, target=instance) - action = db.action_get_by_request_id(context, server_id, id) + action = self.action_api.action_get_by_request_id(context, instance, + id) if action is None: raise exc.HTTPNotFound() action_id = action['id'] action = self._format_action(action) if authorize_events(context): - events_raw = db.action_events_get(context, action_id) + events_raw = self.action_api.action_events_get(context, instance, + action_id) action['events'] = [self._format_event(evt) for evt in events_raw] return {'instanceAction': action} -- cgit