diff options
| author | Andrew Laski <andrew.laski@rackspace.com> | 2013-02-21 17:30:06 -0500 |
|---|---|---|
| committer | Andrew Laski <andrew.laski@rackspace.com> | 2013-02-25 19:33:02 -0500 |
| commit | ab2920726c0e2633c033a31a324f30a97fdce6bd (patch) | |
| tree | 2c93e8a84654049f3420b19a537a0bd392f68001 /nova/api | |
| parent | 73a58f9cc85bf8d7fc745d4260577d764e8bc81c (diff) | |
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
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/instance_actions.py | 10 |
1 files changed, 6 insertions, 4 deletions
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} |
