Ejemplo n.º 1
0
 def test_get_by_action(self):
     self.mox.StubOutWithMock(db, 'action_events_get')
     events = [dict(fake_event, id=1234), dict(fake_event, id=5678)]
     db.action_events_get(self.context, 'fake-action').AndReturn(events)
     self.mox.ReplayAll()
     event_list = instance_action.InstanceActionEventList.get_by_action(
         self.context, 'fake-action')
     self.assertEqual(2, len(event_list))
     for index, event in enumerate(event_list):
         self.assertEqual(events[index]['id'], event.id)
Ejemplo n.º 2
0
 def test_get_by_action(self):
     self.mox.StubOutWithMock(db, 'action_events_get')
     events = [dict(fake_event, id=1234),
               dict(fake_event, id=5678)]
     db.action_events_get(self.context, 'fake-action').AndReturn(events)
     self.mox.ReplayAll()
     event_list = instance_action.InstanceActionEventList.get_by_action(
         self.context, 'fake-action')
     self.assertEqual(2, len(event_list))
     for index, event in enumerate(event_list):
         self.assertEqual(events[index]['id'], event.id)
Ejemplo n.º 3
0
    def show(self, req, server_id, id):
        """Return data about the given instance action."""
        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)
        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)
            action['events'] = [self._format_event(evt) for evt in events_raw]
        return {'instanceAction': action}
Ejemplo n.º 4
0
 def get_by_action(cls, context, action_id):
     db_events = db.action_events_get(context, action_id)
     return base.obj_make_list(context, cls(), InstanceActionEvent,
                               db_events)
Ejemplo n.º 5
0
 def get_by_action(cls, context, action_id):
     db_events = db.action_events_get(context, action_id)
     return base.obj_make_list(context, cls(context),
                               objects.InstanceActionEvent, db_events)
Ejemplo n.º 6
0
 def get_by_action(cls, context, action_id):
     db_events = db.action_events_get(context, action_id)
     return _make_list(context, cls(), InstanceActionEvent, db_events)