Пример #1
0
 def _notify_node_action(cls, ctx, level, node, action, **kwargs):
     action_name = cls._get_action_name(action.action)
     priority = utils.level_from_number(level).lower()
     publisher = nobj.NotificationPublisher(host=cfg.CONF.host,
                                            binary='senlin-engine')
     publisher.obj_set_defaults()
     phase = kwargs.get('phase')
     event_type = nobj.EventType(object='node',
                                 action=action_name,
                                 phase=phase)
     payload = nobj.NodeActionPayload(node, action)
     notification = nobj.NodeActionNotification(context=ctx,
                                                priority=priority,
                                                publisher=publisher,
                                                event_type=event_type,
                                                payload=payload)
     notification.emit(ctx)
Пример #2
0
    def test_create(self):
        payload = base.NodeActionPayload(node=self.node, action=self.action)

        sot = base.NodeActionNotification(payload=payload)

        self.assertTrue(sot.obj_attr_is_set('payload'))