Ask Your Question
1

Can we assign instance names to autoscaling servers?

asked 2015-06-08 04:43:52 -0500

PainInNetwork gravatar image

updated 2015-06-08 04:44:18 -0500

Hi, I'm using openstack Juno to deploy my cloud environment. the AutoScalinGroup looks like below.

resources:
  asg:
    type: OS::Heat::AutoScalingGroup
    properties:
      resource:
        type: OS::Nova::Server
        properties:
          name: TestServer
          image: TestVM
          flavor: m1.tiny
          config_drive: True
          mgmt_net: mgmt_net
      desired_capacity: 2
      max_size: 5
      min_size: 1

The stack will start with 2 VMs created, and scale up/down when the ceilometer alarms be triggered.

But all the servers be created by AutoScalingGroup will has the identical server name "TestServer", if I remove the "name" attribute from autoscalinggroup, the server name will be changed to "stackname-uuid" style.

Is there any way to assign instance names to autoscaling servers? for example I want the servers has name "TestServer_01", "TestServer_02", ..... according to when it is spawned?

BTW I tried to use %index% in autoscalinggroup, seems it's not allowd there...

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2015-06-10 20:35:17 -0500

don gravatar image

The syntax in the user guide http://docs.openstack.org/hot-reference/content/OS__Heat__ResourceGroup.html worked for me:

resources:
  my_indexed_group:
    type: OS::Heat::ResourceGroup
    properties:
      count: 3
      resource_def:
        type: OS::Nova::Server
        properties:
          # create a unique name for each server
          # using its index in the group
          name: my_server_%index%
          image: CentOS 6.5
          flavor: 4GB Performance
edit flag offensive delete link more

Comments

Thanks for replay @don! The OS::Heat::ResourceGroup has this %index%, but it can not be used in AutoScalingGroup. Is there any way to do the same thing as %index% did in ResourceGroup?

PainInNetwork gravatar imagePainInNetwork ( 2015-06-12 01:52:32 -0500 )edit

I'd like to know the same thing, but thanks for the insight @don!

~RP

rpga95 gravatar imagerpga95 ( 2015-07-23 11:17:20 -0500 )edit

No, it's for ResourceGroup only.

zaneb gravatar imagezaneb ( 2015-07-31 13:17:29 -0500 )edit

did anyone manage to solve this issue?

AB239 gravatar imageAB239 ( 2017-04-06 07:47:29 -0500 )edit
0

answered 2017-04-06 08:35:57 -0500

zaneb gravatar image

There's no way to get names like _01 _02 in an autoscaling group. Autoscaling group members come and go so there's no way to maintain contiguous indices. (Unlike ResourceGroup, which tolerates many inefficiencies to maintain contiguous indices.)

If you leave out the name property of the server altogether, then you will get a name automatically assigned that is the based on the name of the stack, the name of the autoscaling group resource, and the id of the member (which is a random string).

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

2 followers

Stats

Asked: 2015-06-08 04:43:52 -0500

Seen: 2,224 times

Last updated: Apr 06 '17