Jump to: navigation, search

Difference between revisions of "Mistral/DSL"

(Full YAML example:)
(Full YAML example:)
Line 122: Line 122:
 
               flavor_id:
 
               flavor_id:
 
               image_id:
 
               image_id:
 
+
 
 
         backup-vm:
 
         backup-vm:
 
           parameters:
 
           parameters:
Line 129: Line 129:
 
           task-parameters:
 
           task-parameters:
 
               server_id:
 
               server_id:
 
+
 
 
         attach-volume:
 
         attach-volume:
 
           parameters:
 
           parameters:
Line 137: Line 137:
 
               size:
 
               size:
 
               mnt_path:
 
               mnt_path:
 
+
 
 
         format-volume:
 
         format-volume:
 
           parameters:
 
           parameters:
Line 145: Line 145:
 
               volume_id:
 
               volume_id:
 
               server_id:
 
               server_id:
 
+
 
 
   Workflow:
 
   Workflow:
 
     tasks:
 
     tasks:
Line 153: Line 153:
 
             image_id: 1234
 
             image_id: 1234
 
             flavor_id: 42
 
             flavor_id: 42
 
+
 
 
       attach-volumes:
 
       attach-volumes:
 
           dependsOn: [create-vms]
 
           dependsOn: [create-vms]
Line 160: Line 160:
 
             size:
 
             size:
 
             mnt_path:
 
             mnt_path:
 
+
 
 
       format-volumes:
 
       format-volumes:
 
           dependsOn: [attach-volumes]
 
           dependsOn: [attach-volumes]
Line 166: Line 166:
 
           parameters:
 
           parameters:
 
             server_id:
 
             server_id:
 
+
 
 
       backup-vms:
 
       backup-vms:
 
           dependsOn: [create-vms]
 
           dependsOn: [create-vms]
Line 172: Line 172:
 
           parameters:
 
           parameters:
 
             server_id:
 
             server_id:
 
+
 
 
     events:
 
     events:
 
       create-vms:
 
       create-vms:

Revision as of 12:46, 13 January 2014

Mistral DSL specification

Version 0.1

Main objects

  • 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 * * * *"