cloudify

Attaching a new volume each time a node group is scaled


Can anyone share any reference template to create a new volume and attach to a new instance each time a deployment for that instance is scaled up?

My template looks like:

node_templates:
  key_pair:
    ...
  vol:
    ...
  node_host:
    ...
    relationships:
      ...
      - key_pair
      - vol
  node:
    ...
    relationships:
      - type: cloudify.relationships.contained_in
        target: node_host
      ...

groups:
  scale_up_group:
    members: [node, node_host, vol]
    policies:
      auto_scale_up:
        type: scale_policy_type
        properties:
          policy_operates_on_group: true
          scale_limit: 6
          scale_direction: '<'
          scale_threshold: 15
          service_selector: cpu.total.user
          cooldown_time: 60
        triggers:
          execute_scale_workflow:
            type: cloudify.policies.triggers.execute_workflow
            parameters:
              workflow: scale
              workflow_parameters:
                delta: 1
                scalable_entity_name: node
                scale_compute: true

Solution

  • Courtesy of Trammell from cloudify-user group:

    node_templates:
      key_pair:
        type: cloudify.openstack.nodes.KeyPair
        ...
    
      floating_ip:
        type: cloudify.openstack.nodes.FloatingIP
        ...
    
      vol:
        type: cloudify.openstack.nodes.Volume
        ...
      node_host:
        type: cloudify.openstack.nodes.Server
        ...
    
        relationships:
          - type: cloudify.openstack.server_connected_to_keypair
            target: keypair
          - type: cloudify.openstack.server_connected_to_floating_ip
            target: floating_ip
          - type: cloudify.relationships.depends_on
            target: vol
    
      node:
        type: custom.node.type
        ...
        relationships:
          - type: cloudify.relationships.contained_in
            target: node_host
          ...
    
    groups:
      scale_vm:
        members: [node, node_host, floating_ip, vol]
    
    
    
      scale_up_group:
        members: [node, node_host, floating_ip, vol]
        policies:
          auto_scale_up:
            type: scale_policy_type
            properties:
              policy_operates_on_group: true
              scale_limit: 6
              scale_direction: '<'
              scale_threshold: 15
              service_selector: cpu.total.user
              cooldown_time: 60
            triggers:
              execute_scale_workflow:
                type: cloudify.policies.triggers.execute_workflow
                parameters:
                  workflow: scale
                  workflow_parameters:
                    delta: 1
                    scalable_entity_name: scale_vm
                    scale_compute: true
    
    policies:
      scale_vm_policy:
        type: cloudify.policies.scaling
        properties:
          default_instances:  1
        targets: [scale_vm]
    

    Ref: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/cloudify-users/TPepGofpSBU