Ask Your Question
0

Receiving OK from alarm_url of ScalingPolicy but no instance is created/removed

asked 2015-12-10 06:37:24 -0600

serranossi94 gravatar image

I'm practising with some Heat templates and I was trying to scale the AutoScalingGroup manually by sending a POST to the alarm_url of the proper ScalingPolicy. The problem is that I actually receive a 200 OK response from de server but there is no change in the group.

Here is the template I'm using

heat_template_version: 2015-10-15

description: Test with AutoScalingGroup

parameters:
    image:
        type: string
        label: Image used by the instances
        description: Image used by the instances
    flavor:
        type: string
        label: Flavor used by the instances
        description: Flavor used by the instances
    key:
        type: string
        label: SSH key
        description: SSH key
    private_network:
        type: string
        label: Network to connect the instances
        description: Network to connect the instances

resources:
    instance_group:
        type: OS::Heat::AutoScalingGroup
        properties:
            min_size: 1
            max_size: 4
            desired_capacity: 2
            cooldown: 60
            resource:
                type: OS::Nova::Server
                properties:
                    image: {get_param: image}
                    key_name: {get_param: key}
                    flavor: {get_param: flavor}
                    networks:
                        - network: {get_param: private_network}

    scale_up:
        type: OS::Heat::ScalingPolicy
        properties:
            adjustment_type: change_in_capacity
            auto_scaling_group_id: {get_resource: instance_group}
            scaling_adjustment: 1

    scale_down:
        type: OS::Heat::ScalingPolicy
        properties:
            adjustment_type: change_in_capacity
            auto_scaling_group_id: {get_resource: instance_group}
            scaling_adjustment: '-1'

outputs:
    scale_up_url:
        description: Webhook of the Scaling Up Policy
        value: {get_attr: [scale_up, alarm_url]}
    scale_down_url:
        description: Webhook of the Scaling Down Policy
        value: {get_attr: [scale_down, alarm_url]}
edit retag flag offensive close merge delete

Comments

IIRC most of the processing is done asynchronously, so the 200 response doesn't mean a lot (it should really be a 202). Looking at the state/events on both the parent and scaling group stacks will tell you more.

zaneb gravatar imagezaneb ( 2017-03-02 08:29:55 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
-1

answered 2017-03-01 23:18:40 -0600

Jeffrey Guan gravatar image

updated 2017-03-01 23:19:27 -0600

Please be noticed that {"metering.stack": "your stack id"} be added into the servers metadata, otherwise the ceilometer doesn't know what resource is expected to be metered.

In your template, I didn't find the dict: instance_group: type: OS::Heat::AutoScalingGroup properties: min_size: 1 max_size: 4 desired_capacity: 2 cooldown: 60 resource: type: OS::Nova::Server properties: image: {get_param: image} key_name: {get_param: key} flavor: {get_param: flavor} networks: - network: {get_param: private_network}

please add the metadata to OS::Nova::Server properties and have a try. metadata: {"metering.stack": {get_param: "OS::stack_id"}}

example:

instance_group:
    type: OS::Heat::AutoScalingGroup
    properties:
        min_size: 1
        max_size: 4
        desired_capacity: 2
        cooldown: 60
        resource:
            type: OS::Nova::Server
            properties:
                image: {get_param: image}
                key_name: {get_param: key}
                flavor: {get_param: flavor}
                metadata: {"metering.stack": {get_param: "OS::stack_id"}}
                networks:
                    - network: {get_param: private_network}
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-12-10 06:37:24 -0600

Seen: 139 times

Last updated: Mar 01 '17