1

I have been reading up on deploying an OpenStack cluster in order to create a large number of instances. I haven't been able to find a script/blog/template guide on how to spin up 100+ instances at once. Is there a way to do this within Horizon? Use case is a lab environment.

Thanks, NP

2
  • When you create instances, you set a quantity Nov 24, 2015 at 1:44
  • Install dev stack and start there Nov 24, 2015 at 1:45

2 Answers 2

1

You can use heat to create large number of instances.

How to use heat? I start from the cli.

Heat use template file. I create template file to create 3 instances:

heat_template_version: 2013-05-23

parameters:
  image_name: 
    type: string 
    label: Image Name 
    default: centos7
  network_id:
    type: string
    default: 80bcc12b-b546-47be-8a24-0c0e278e57dd

resources: 
  my_instance1: 
    type: OS::Nova::Server 
    properties: 
      image: { get_param: image_name } 
      flavor: min 
      networks:
        - network : { get_param : network_id }
  my_instance2: 
    type: OS::Nova::Server 
    properties: 
      image: { get_param: image_name } 
      flavor: min
      networks:
        - network : { get_param : network_id }
  my_instance3: 
    type: OS::Nova::Server 
    properties: 
      image: { get_param: image_name } 
      flavor: min
      networks:
        - network : { get_param : network_id }

I save this file as template.yaml.

I use here flavor min, image centos7 and network id 80bcc12b-b546-47be-8a24-0c0e278e57dd.

Now I create 3 instances. I exec

# heat stack-create --template-file template.yaml test 
+--------------------------------------+------------+--------------------+----------------------+
| id                                   | stack_name | stack_status       | creation_time        |
+--------------------------------------+------------+--------------------+----------------------+
| e39c8d65-b135-4d75-a800-2c35715ce792 | test       | CREATE_IN_PROGRESS | 2015-12-31T20:39:23Z |
+--------------------------------------+------------+--------------------+----------------------+

# heat stack-list
+--------------------------------------+------------+-----------------+----------------------+
| id                                   | stack_name | stack_status    | creation_time        |
+--------------------------------------+------------+-----------------+----------------------+
| e39c8d65-b135-4d75-a800-2c35715ce792 | test       | CREATE_COMPLETE | 2015-12-31T20:39:23Z |
+--------------------------------------+------------+-----------------+----------------------+

Stack test was created. Next images was created:

# nova list
+--------------------------------------+--------------------------------+---------+------------+-------------+-------------------+
| ID                                   | Name                           | Status  | Task State | Power State | Networks          |
+--------------------------------------+--------------------------------+---------+------------+-------------+-------------------+
| 81b3ef22-f993-4ba0-bc9d-804afdf2ab5d | test-my_instance1-u3qmm73wlmtd | ACTIVE  | -          | Running     | net1=192.168.0.18 |
| a6bf0400-8ec9-4d7e-867b-5e3238f48943 | test-my_instance2-5275ytbk33dj | ACTIVE  | -          | Running     | net1=192.168.0.17 |
| 7f52fdb1-7414-45bd-aa9e-293d45ee22c4 | test-my_instance3-i2mynv5p6tq5 | ACTIVE  | -          | Running     | net1=192.168.0.19 |
+--------------------------------------+--------------------------------+---------+------------+-------------+-------------------+

You can change template file and add more instances. All instances will be created by 1 call: use heat stack-create.

Now remove instances you can use heat stack-delete call:

 # heat stack-delete test
 +--------------------------------------+------------+--------------------+----------------------+
 | id                                   | stack_name | stack_status       | creation_time        |
 +--------------------------------------+------------+--------------------+----------------------+
 | e39c8d65-b135-4d75-a800-2c35715ce792 | test       | DELETE_IN_PROGRESS | 2015-12-31T20:39:23Z |
 +--------------------------------------+------------+--------------------+----------------------+

It's from cli. How we can use dashboard?

You can open http://ip_address/dashboard/project/stacks/ page.

Stack page was open. Launch stack button click: select template form was opened. Select template source: direct input. Into the template data set content of the template.json file. Press next button, into the next page enter the stack name, admin password and press launch button. New heat stack will be created. It's the same as heat stack-create call.

1

You can accomplish this directly from Horizon. When launching a new instance, there is a count parameter, just be certain your project quotas allow you the necessary resources. By the way, I would not recommend to create 100 instances at once. I would rather prefer to create them incrementally.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .