Event trigger
DISCLAIMER: There is an issue on the HA mode of the event trigger. This function is still actively developed, the event trigger service is not reliable at the moment.
The workflows created in Mistral can be executed following an event triggered on the CERN Cloud Service like the creation of a machine. To be able to use this mode, the user needs to understand how the notifications work in an OpenStack based cloud.
The notifications are triggered by the services when some actions have been completed, then these notifications are collected into a queue by using different exchange, topic and event values.
Create a event trigger
As a prerequisite, you need to have a workflow defined previously, we'll use as an example the one defined in the quickstart guide
In this example we are creating an event trigger for a cinder notification when a volume gets created.
$ openstack workflow show echo
+------------+--------------------------------------+
| Field | Value |
+------------+--------------------------------------+
| ID | 65778b18-25a2-4709-87ce-f0d8d5bd50aa |
| Name | echo |
| Project ID | 01763ecd-a327-4d54-b045-3d46ca62f082 |
| Tags | <none> |
| Input | data |
| Scope | private |
| Created at | 2018-02-15 12:19:35 |
| Updated at | None |
+------------+--------------------------------------+
$ openstack event trigger create first_event_trigger 65778b18-25a2-4709-87ce-f0d8d5bd50aa cinder notifications.info volume.create.end '{"data":"my first cron trigger"}'
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| ID | f95624ba-438c-407b-8697-9beb19ab2c13 |
| Name | first_event_trigger |
| Workflow ID | 65778b18-25a2-4709-87ce-f0d8d5bd50aa |
| Params | {} |
| Exchange | cinder |
| Topic | notifications.info |
| Event | volume.create.end |
| Created at | 2018-02-15 14:02:54 |
| Updated at | None |
+-------------+--------------------------------------+
List event triggers
You can see the available event triggers by executing
$ openstack event trigger list
+--------------------------------------+---------------------+--------------------------------------+--------+----------+--------------------+-------------------+---------------------+------------+
| ID | Name | Workflow ID | Params | Exchange | Topic | Event | Created at | Updated at |
+--------------------------------------+---------------------+--------------------------------------+--------+----------+--------------------+-------------------+---------------------+------------+
| f95624ba-438c-407b-8697-9beb19ab2c13 | first_event_trigger | 65778b18-25a2-4709-87ce-f0d8d5bd50aa | {} | cinder | notifications.info | volume.create.end | 2018-02-15 14:02:54 | None |
+--------------------------------------+---------------------+--------------------------------------+--------+----------+--------------------+-------------------+---------------------+------------+
Once the notification arrives it will fire the workflow configured with the input specified on creation. You can see the result of the execution on the 'openstack workflow execution list' command
Delete event trigger
You can delete the event trigger by running:
$ openstack event trigger delete f95624ba-438c-407b-8697-9beb19ab2c13
Request to delete event trigger f95624ba-438c-407b-8697-9beb19ab2c13 has been accepted.