|
|
(34 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
− | == Mistral DSL specification == | + | == This Wiki is no longer maintained == |
− | ==== Version 0.1 ====
| |
− | === Main objects ===
| |
| | | |
− | | + | Please see the [https://docs.openstack.org/mistral/latest/user/wf_lang_v2.html Mistral Workflow language documentation]. |
− | * '''Service'''
| |
− | * '''Action'''
| |
− | * '''Workflow'''
| |
− | * '''Task'''
| |
− | * '''Event'''
| |
− | | |
− | === Service ===
| |
− | | |
− | Provides some specific functionality. For example, Nova service provides functionality for VMs management in OpenStack.
| |
− | | |
− | ==== Attributes ====
| |
− | | |
− | * '''name''' - string without space, mandatory attribute
| |
− | * '''type''' - currently we support the following types: RESTAPI, OPENSTACKSERVICE, OSLO_RPC, this is a mandatory attribute
| |
− | * '''parameters''' - dictionary depending on type of the service, this parameter can be optional. For example for REST API it should contain url of the service, method of authentication etc.
| |
− | * '''actions''' - list of actions provided by this service
| |
− | | |
− | ==== YAML example: ====
| |
− | | |
− | Service:
| |
− | name: Nova
| |
− | type: REST_API
| |
− | parameters:
| |
− | key:value
| |
− | actions:
| |
− | create-vm:
| |
− | ......
| |
− | delete-vm:
| |
− | .....
| |
− | | |
− | === Action ===
| |
− | | |
− | A function provided by services. For example Nova service provides the following actions: create-vm, shutdown-vm
| |
− | | |
− | ==== Attributes ====
| |
− | | |
− | name - string without space, mandatory attribute
| |
− | parameters - dictionary, which structured is defined by service type. For REST service it contains url and method.
| |
− | task-parameters - dictionary containing parameters which should or could be specified in task
| |
− | ==== YAML example: ====
| |
− | | |
− | create-vm:
| |
− | parameters:
| |
− | url: servers
| |
− | task-parameters:
| |
− | name:
| |
− | optional: False
| |
− | | |
− | === Workflow ===
| |
− | | |
− | ==== Attributes ====
| |
− | | |
− | name - string without space, mandatory attribute
| |
− | tasks - list of task in this workflow, each task represent some step in worflow
| |
− | events - list of events in workflow, e.g. timer or periodic events
| |
− | | |
− | ==== YAML example: ====
| |
− | | |
− | Workflow:
| |
− | tasks:
| |
− | create-vms:
| |
− | .....
| |
− | attache-volumes:
| |
− | .....
| |
− | | |
− | === Task ===
| |
− | | |
− | Represents a step in workflow, for example attaching volume
| |
− | | |
− | ==== Attributes ====
| |
− | | |
− | * '''name''' - string without space, mandatory attribute
| |
− | * '''action''' - name of action to perform
| |
− | * '''dependsOn''' - list of tasks which should be execute before this tasks, this is optional parameter
| |
− | * '''parameters''' - list of parameters
| |
− | | |
− | YAML example:
| |
− | | |
− | create-vms:
| |
− | action: Nova:create-vm
| |
− | parameters:
| |
− | image_id: 1234
| |
− | flavor_id: 42
| |
− | | |
− | === Events ===
| |
− | | |
− | By event it is possible to invoke specific task.
| |
− | | |
− | ==== Attributes ====
| |
− | | |
− | name - string without space, mandatory attribute
| |
− | type - can be PERIODIC, TIMER, CEILOMETER_ALARM
| |
− | tasks - list of tasks which should be execute on event
| |
− | parameters - list of parameters, defined by task
| |
− | | |
− | ==== YAML example: ====
| |
− | | |
− | backup-vm:
| |
− | type: periodic
| |
− | tasks: [create_backup, delete_old_backup]
| |
− | parameters:
| |
− | time: 1 0 * * *
| |
− | | |
− | === Full YAML example: ===
| |
− | | |
− | Services:
| |
− | MyRest:
| |
− | type: REST_API
| |
− | parameters:
| |
− | baseUrl: http://some_host
| |
− | actions:
| |
− | create-vm:
| |
− | parameters:
| |
− | url: /service/action/execute
| |
− | method: GET
| |
− | task-parameters:
| |
− | flavor_id:
| |
− | image_id:
| |
− | | |
− | backup-vm:
| |
− | parameters:
| |
− | url: url_for_backup
| |
− | method: GET
| |
− | task-parameters:
| |
− | server_id:
| |
− | | |
− | attach-volume:
| |
− | parameters:
| |
− | url: url_for_attach
| |
− | method: GET
| |
− | task-parameters:
| |
− | size:
| |
− | mnt_path:
| |
− | | |
− | format-volume:
| |
− | parameters:
| |
− | url: url_for_format
| |
− | method: GET
| |
− | task-parameters:
| |
− | volume_id:
| |
− | server_id:
| |
− | | |
− | Workflow:
| |
− | tasks:
| |
− | create-vms:
| |
− | action: MyRest:create-vm
| |
− | parameters:
| |
− | image_id: 1234
| |
− | flavor_id: 42
| |
− | | |
− | attach-volumes:
| |
− | dependsOn: [create-vms]
| |
− | action: MyRest:attach-volume
| |
− | parameters:
| |
− | size:
| |
− | mnt_path:
| |
− | | |
− | format-volumes:
| |
− | dependsOn: [attach-volumes]
| |
− | action: MyRest:format-volume
| |
− | parameters:
| |
− | server_id:
| |
− | | |
− | backup-vms:
| |
− | dependsOn: [create-vms]
| |
− | action: MyRest:backup-vm
| |
− | parameters:
| |
− | server_id:
| |
− | | |
− | events:
| |
− | create-vms:
| |
− | type: periodic
| |
− | tasks: create-vms
| |
− | parameters:
| |
− | cron-pattern: "*/5 * * * *"
| |