aboutsummaryrefslogtreecommitdiffstats
path: root/meta-openstack/Documentation/README.heat
blob: 35782915883624e378adc348ae4f058b2c047519 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
Summary
=======

This document is not intended to provide detail of how Heat in general
works, but rather it describes how Heat is tested to ensure that Heat
is working correctly.


Heat Overview
=============

Heat is template-driven orchestration engine which enables you to orchestrate
multiple composite cloud applications.  Heat stack is a set of resources
(including nova compute VMs, cinder volumes, neutron IPs...) which are described
by heat orchestration template (a.k.a HOT) file.

Heat interacts with Ceilometer to provide autoscaling feature in which when
resources within a stack reach certain watermark (e.g. cpu utilization hits 70%)
then Heat can add or remove resources into or out of that stack to handle
the changing demands.


Test Steps
==========

Please note: the following commands/steps are carried on Controller
node, unless otherwise explicitly indicated.

    $ Start Controller and Compute node
    $ . /etc/nova/openrc
    $ glance image-create --name myfirstimage --is-public true --container-format bare --disk-format qcow2 --file /root/images/cirros-*-x86_64-disk.img
    $ glance image-list
+--------------------------------------+--------------+-------------+------------------+---------+--------+
| ID                                   | Name         | Disk Format | Container Format | Size    | Status |
+--------------------------------------+--------------+-------------+------------------+---------+--------+
| a71b84d3-e656-43f5-afdc-ac67cf4f398a | myfirstimage | qcow2       | bare             | 9761280 | active |
+--------------------------------------+--------------+-------------+------------------+---------+--------+

    $ neutron net-create mynetwork
    $ neutron net-list
+--------------------------------------+-----------+---------+
| id                                   | name      | subnets |
+--------------------------------------+-----------+---------+
| 8c9c8a6f-d90f-479f-82b0-7f6e963b39d7 | mynetwork |         |
+--------------------------------------+-----------+---------+

    $ /etc/cinder/add-cinder-volume-types.sh
    $ cinder create --volume_type nfs --display_name nfs_vol_1 3
    $ cinder create --volume_type glusterfs --display_name glusterfs_vol_1 2
    $ cinder list
+--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+
|                  ID                  |   Status  |   Display Name  | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+
| 1d283cf7-2258-4038-a31b-5cb5fba995f3 | available |    nfs_vol_1    |  3   |     nfs     |  false   |             |
| c46276fb-e3df-4093-b759-2ce03c4cefd5 | available | glusterfs_vol_1 |  2   |  glusterfs  |  false   |             |
+--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+

    *** The below test steps are for testing lifecycle management ***

    $ heat stack-create -f /etc/heat/templates/two_vms_example.template -P "vol_2_id=c46276fb-e3df-4093-b759-2ce03c4cefd5" mystack
    $ Keep running "heat stack-list" until seeing
+--------------------------------------+------------+-----------------+----------------------+
| id                                   | stack_name | stack_status    | creation_time        |
+--------------------------------------+------------+-----------------+----------------------+
| 8d79a777-2e09-4d06-a04e-8430df341514 | mystack    | CREATE_COMPLETE | 2014-05-08T16:36:22Z |
+--------------------------------------+------------+-----------------+----------------------+

    $ nova list
+--------------------------------------+---------------------------+--------+------------+-------------+----------+
| ID                                   | Name                      | Status | Task State | Power State | Networks |
+--------------------------------------+---------------------------+--------+------------+-------------+----------+
| e58da67a-9a22-4db2-9d1e-0a1810df2f2e | mystack-vm_1-j5tq5m2ppk3z | ACTIVE | -          | Running     |          |
| fe1b693e-db8c-4d74-b840-7dae8acef0c1 | mystack-vm_2-oiu6mzg3jjv2 | ACTIVE | -          | Running     |          |
+--------------------------------------+---------------------------+--------+------------+-------------+----------+

(Should see 2 VMs: vm_1 and vm_2 as defined in two_vms_example.template)

    $ cinder list
+--------------------------------------+-----------+----------------------------+------+-------------+----------+--------------------------------------+
|                  ID                  |   Status  |        Display Name        | Size | Volume Type | Bootable |             Attached to              |
+--------------------------------------+-----------+----------------------------+------+-------------+----------+--------------------------------------+
| 1d283cf7-2258-4038-a31b-5cb5fba995f3 | available |         nfs_vol_1          |  3   |     nfs     |  false   |                                      |
| 58b55eb9-e619-4c2e-bfd8-ebc349aff02b |   in-use  | mystack-vol_1-5xk2zotoxidr |  1   |  lvm_iscsi  |  false   | e58da67a-9a22-4db2-9d1e-0a1810df2f2e |
| c46276fb-e3df-4093-b759-2ce03c4cefd5 |   in-use  |      glusterfs_vol_1       |  2   |  glusterfs  |  false   | e58da67a-9a22-4db2-9d1e-0a1810df2f2e |
+--------------------------------------+-----------+----------------------------+------+-------------+----------+--------------------------------------+

(2 Cinder volumes are attached to vm_1)

    $ From Dashboard, log into vm_1, and run "cat /proc/partitions"
(Should see partitions vdb of 1G and vdc of 2G)

    $ heat stack-show 8d79a777-2e09-4d06-a04e-8430df341514

(Command should return lot of info)

    $ heat resource-list mystack
+------------------+------------------------------+-----------------+----------------------+
| resource_name    | resource_type                | resource_status | updated_time         |
+------------------+------------------------------+-----------------+----------------------+
| vol_1            | OS::Cinder::Volume           | CREATE_COMPLETE | 2014-05-08T16:36:24Z |
| vm_2             | OS::Nova::Server             | CREATE_COMPLETE | 2014-05-08T16:36:56Z |
| vm_1             | OS::Nova::Server             | CREATE_COMPLETE | 2014-05-08T16:37:26Z |
| vol_2_attachment | OS::Cinder::VolumeAttachment | CREATE_COMPLETE | 2014-05-08T16:37:28Z |
| vol_1_attachment | OS::Cinder::VolumeAttachment | CREATE_COMPLETE | 2014-05-08T16:37:31Z |
+------------------+------------------------------+-----------------+----------------------+

(Should see all 5 resources defined in two_vms_example.template)

    $ heat resource-show mystack vm_1
+------------------------+------------------------------------------------------------------------------------------------------------------------------------+
| Property               | Value                                                                                                                              |
+------------------------+------------------------------------------------------------------------------------------------------------------------------------+
| description            |                                                                                                                                    |
| links                  | http://128.224.149.168:8004/v1/088d10de18a84442a7a03497e834e2af/stacks/mystack/8d79a777-2e09-4d06-a04e-8430df341514/resources/vm_1 |
|                        | http://128.224.149.168:8004/v1/088d10de18a84442a7a03497e834e2af/stacks/mystack/8d79a777-2e09-4d06-a04e-8430df341514                |
| logical_resource_id    | vm_1                                                                                                                               |
| physical_resource_id   | e58da67a-9a22-4db2-9d1e-0a1810df2f2e                                                                                               |
| required_by            | vol_1_attachment                                                                                                                   |
|                        | vol_2_attachment                                                                                                                   |
| resource_name          | vm_1                                                                                                                               |
| resource_status        | CREATE_COMPLETE                                                                                                                    |
| resource_status_reason | state changed                                                                                                                      |
| resource_type          | OS::Nova::Server                                                                                                                   |
| updated_time           | 2014-05-08T16:37:26Z                                                                                                               |
+------------------------+------------------------------------------------------------------------------------------------------------------------------------+

    $ heat template-show mystack

(The content of this command should be the same as content of two_vms_example.template)

    $ heat event-list mystack
+------------------+-----+------------------------+--------------------+----------------------+
| resource_name    | id  | resource_status_reason | resource_status    | event_time           |
+------------------+-----+------------------------+--------------------+----------------------+
| vm_1             | 700 | state changed          | CREATE_IN_PROGRESS | 2014-05-08T16:36:22Z |
| vm_1             | 704 | state changed          | CREATE_COMPLETE    | 2014-05-08T16:37:26Z |
| vm_2             | 699 | state changed          | CREATE_IN_PROGRESS | 2014-05-08T16:36:22Z |
| vm_2             | 703 | state changed          | CREATE_COMPLETE    | 2014-05-08T16:36:56Z |
| vol_1            | 701 | state changed          | CREATE_IN_PROGRESS | 2014-05-08T16:36:22Z |
| vol_1            | 702 | state changed          | CREATE_COMPLETE    | 2014-05-08T16:36:24Z |
| vol_1_attachment | 706 | state changed          | CREATE_IN_PROGRESS | 2014-05-08T16:37:27Z |
| vol_1_attachment | 708 | state changed          | CREATE_COMPLETE    | 2014-05-08T16:37:31Z |
| vol_2_attachment | 705 | state changed          | CREATE_IN_PROGRESS | 2014-05-08T16:37:26Z |
| vol_2_attachment | 707 | state changed          | CREATE_COMPLETE    | 2014-05-08T16:37:28Z |
+------------------+-----+------------------------+--------------------+----------------------+

    $ heat action-suspend mystack
    $ Keep running "heat stack-list" until seeing
+--------------------------------------+------------+------------------+----------------------+
| id                                   | stack_name | stack_status     | creation_time        |
+--------------------------------------+------------+------------------+----------------------+
| 8d79a777-2e09-4d06-a04e-8430df341514 | mystack    | SUSPEND_COMPLETE | 2014-05-08T16:36:22Z |
+--------------------------------------+------------+------------------+----------------------+

    $ nova list
+--------------------------------------+---------------------------+-----------+------------+-------------+----------+
| ID                                   | Name                      | Status    | Task State | Power State | Networks |
+--------------------------------------+---------------------------+-----------+------------+-------------+----------+
| e58da67a-9a22-4db2-9d1e-0a1810df2f2e | mystack-vm_1-j5tq5m2ppk3z | SUSPENDED | -          | Shutdown    |          |
| fe1b693e-db8c-4d74-b840-7dae8acef0c1 | mystack-vm_2-oiu6mzg3jjv2 | SUSPENDED | -          | Shutdown    |          |
+--------------------------------------+---------------------------+-----------+------------+-------------+----------+

(2 VMs are in suspeded mode)

    $ Wait for 2 minutes
    $ heat action-resume mystack
    $ Keep running "heat stack-list" until seeing
+--------------------------------------+------------+-----------------+----------------------+
| id                                   | stack_name | stack_status    | creation_time        |
+--------------------------------------+------------+-----------------+----------------------+
| 8d79a777-2e09-4d06-a04e-8430df341514 | mystack    | RESUME_COMPLETE | 2014-05-08T16:36:22Z |
+--------------------------------------+------------+-----------------+----------------------+

    $ nova list
+--------------------------------------+---------------------------+--------+------------+-------------+----------+
| ID                                   | Name                      | Status | Task State | Power State | Networks |
+--------------------------------------+---------------------------+--------+------------+-------------+----------+
| e58da67a-9a22-4db2-9d1e-0a1810df2f2e | mystack-vm_1-j5tq5m2ppk3z | ACTIVE | -          | Running     |          |
| fe1b693e-db8c-4d74-b840-7dae8acef0c1 | mystack-vm_2-oiu6mzg3jjv2 | ACTIVE | -          | Running     |          |
+--------------------------------------+---------------------------+--------+------------+-------------+----------+

    $ nova show e58da67a-9a22-4db2-9d1e-0a1810df2f2e | grep flavor
| flavor                               | m1.tiny (1)

(Should see m1.tiny flavour for vm_2 by default)

    $ heat stack-update -f /etc/heat/templates/two_vms_example.template -P "vol_2_id=c46276fb-e3df-4093-b759-2ce03c4cefd5;vm_type=m1.small" mystack
(Update vm_2 flavour from m1.tiny to m1.small)

    $ Keep running "heat stack-list" until seeing
+--------------------------------------+------------+-----------------+----------------------+
| id                                   | stack_name | stack_status    | creation_time        |
+--------------------------------------+------------+-----------------+----------------------+
| 8d79a777-2e09-4d06-a04e-8430df341514 | mystack    | UPDATE_COMPLETE | 2014-05-08T16:36:22Z |
+--------------------------------------+------------+-----------------+----------------------+

    $ nova list
+--------------------------------------+---------------------------+--------+------------+-------------+----------+
| ID                                   | Name                      | Status | Task State | Power State | Networks |
+--------------------------------------+---------------------------+--------+------------+-------------+----------+
| e58da67a-9a22-4db2-9d1e-0a1810df2f2e | mystack-vm_1-j5tq5m2ppk3z | ACTIVE | -          | Running     |          |
| fe1b693e-db8c-4d74-b840-7dae8acef0c1 | mystack-vm_2-oiu6mzg3jjv2 | ACTIVE | -          | Running     |          |
+--------------------------------------+---------------------------+--------+------------+-------------+----------+

    $ nova show e58da67a-9a22-4db2-9d1e-0a1810df2f2e | grep flavor
| flavor                               | m1.small (2)                                             |

(Should see m1.small flavour for vm_2.  This demonstrates that its able to update)

    $ heat stack-create -f /etc/heat/templates/two_vms_example.template -P "vol_2_id=1d283cf7-2258-4038-a31b-5cb5fba995f3" mystack2
    $ Keep running "heat stack-list" until seeing
+--------------------------------------+------------+-----------------+----------------------+
| id                                   | stack_name | stack_status    | creation_time        |
+--------------------------------------+------------+-----------------+----------------------+
| 8d79a777-2e09-4d06-a04e-8430df341514 | mystack    | UPDATE_COMPLETE | 2014-05-08T16:36:22Z |
| 258e05fd-370b-4017-818a-4bb573ac3982 | mystack2   | CREATE_COMPLETE | 2014-05-08T16:46:12Z |
+--------------------------------------+------------+-----------------+----------------------+

    $ nova list
+--------------------------------------+----------------------------+--------+------------+-------------+----------+
| ID                                   | Name                       | Status | Task State | Power State | Networks |
+--------------------------------------+----------------------------+--------+------------+-------------+----------+
| e58da67a-9a22-4db2-9d1e-0a1810df2f2e | mystack-vm_1-j5tq5m2ppk3z  | ACTIVE | -          | Running     |          |
| fe1b693e-db8c-4d74-b840-7dae8acef0c1 | mystack-vm_2-oiu6mzg3jjv2  | ACTIVE | -          | Running     |          |
| 181931ae-4c3b-488d-a7c6-4c4b08f6a35b | mystack2-vm_1-hmy5feakes2q | ACTIVE | -          | Running     |          |
| c80aaea9-276f-4bdb-94d5-9e0c5434f269 | mystack2-vm_2-6b4nzxecda3j | ACTIVE | -          | Running     |          |
+--------------------------------------+----------------------------+--------+------------+-------------+----------+

    $ cinder list
+--------------------------------------+--------+-----------------------------+------+-------------+----------+--------------------------------------+
|                  ID                  | Status |         Display Name        | Size | Volume Type | Bootable |             Attached to              |
+--------------------------------------+--------+-----------------------------+------+-------------+----------+--------------------------------------+
| 1d283cf7-2258-4038-a31b-5cb5fba995f3 | in-use |          nfs_vol_1          |  3   |     nfs     |  false   | 181931ae-4c3b-488d-a7c6-4c4b08f6a35b |
| 2175db16-5569-45eb-af8b-2b967e2b808c | in-use | mystack2-vol_1-ey6udylsdqbo |  1   |  lvm_iscsi  |  false   | 181931ae-4c3b-488d-a7c6-4c4b08f6a35b |
| 58b55eb9-e619-4c2e-bfd8-ebc349aff02b | in-use |  mystack-vol_1-5xk2zotoxidr |  1   |  lvm_iscsi  |  false   | e58da67a-9a22-4db2-9d1e-0a1810df2f2e |
| c46276fb-e3df-4093-b759-2ce03c4cefd5 | in-use |       glusterfs_vol_1       |  2   |  glusterfs  |  false   | e58da67a-9a22-4db2-9d1e-0a1810df2f2e |
+--------------------------------------+--------+-----------------------------+------+-------------+----------+--------------------------------------+

    $ Wait for 5 minutes
    $ heat stack-delete mystack2
    $ heat stack-delete mystack
    $ Keep running "heat stack-list" until seeing
+----+------------+--------------+---------------+
| id | stack_name | stack_status | creation_time |
+----+------------+--------------+---------------+
+----+------------+--------------+---------------+

    $ nova list
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+

    $ cinder list
+--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+
|                  ID                  |   Status  |   Display Name  | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+
| 1d283cf7-2258-4038-a31b-5cb5fba995f3 | available |    nfs_vol_1    |  3   |     nfs     |  false   |             |
| c46276fb-e3df-4093-b759-2ce03c4cefd5 | available | glusterfs_vol_1 |  2   |  glusterfs  |  false   |             |
+--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+

    *** The below test steps are for testing autoscaling ***

    $ By default, Ceilometer data samples are collected every 10 minutes, therefore
      to speed up the test process, change the data simple polling rates at every
      1 minutes.  On Controller node modify /etc/ceilometer/pipeline.yaml to change
      all value "600" to "60".

    *** The following commands are for reseting Ceilometer database ***

    $ /etc/init.d/ceilometer-agent-notification stop
    $ /etc/init.d/ceilometer-agent-central stop
    $ /etc/init.d/ceilometer-alarm-evaluator stop
    $ /etc/init.d/ceilometer-alarm-notifier stop
    $ /etc/init.d/ceilometer-api stop
    $ /etc/init.d/ceilometer-collector stop
    $ sudo -u postgres psql -c "DROP DATABASE ceilometer"
    $ sudo -u postgres psql -c "CREATE DATABASE ceilometer"
    $ ceilometer-dbsync
    $ /etc/init.d/ceilometer-agent-central restart
    $ /etc/init.d/ceilometer-agent-notification restart
    $ /etc/init.d/ceilometer-alarm-evaluator restart
    $ /etc/init.d/ceilometer-alarm-notifier restart
    $ /etc/init.d/ceilometer-api restart
    $ /etc/init.d/ceilometer-collector restart

    $ On Compute node, modify /etc/ceilometer/pipeline.yaml to change all
      value "600" to "60", and run:

        /etc/init.d/ceilometer-agent-compute restart

    $ heat stack-create -f /etc/heat/templates/autoscaling_example.template mystack
    $ Keep running "heat stack-list" until seeing
+--------------------------------------+------------+-----------------+----------------------+
| id                                   | stack_name | stack_status    | creation_time        |
+--------------------------------------+------------+-----------------+----------------------+
| 1905a541-edfa-4a1f-b6f9-eacdf5f62d85 | mystack    | CREATE_COMPLETE | 2014-05-06T22:46:08Z |
+--------------------------------------+------------+-----------------+----------------------+

    $ ceilometer alarm-list
+--------------------------------------+-------------------------------------+-------------------+---------+------------+---------------------------------+------------------+
| Alarm ID                             | Name                                | State             | Enabled | Continuous | Alarm condition                 | Time constraints |
+--------------------------------------+-------------------------------------+-------------------+---------+------------+---------------------------------+------------------+
| 14a1c510-667c-4717-a49d-eba375e48e01 | mystack-cpu_alarm_low-3jmjeyqrwd3k  | insufficient data | True    | False      | cpu_util < 45.0 during 1 x 120s | None             |
| edcc3c0c-84b7-4694-8312-72677bc50efd | mystack-cpu_alarm_high-jiziioj5zt6r | insufficient data | True    | False      | cpu_util > 80.0 during 1 x 300s | None             |
+--------------------------------------+-------------------------------------+-------------------+---------+------------+---------------------------------+------------------+

    $ nova list
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+
| ID                                   | Name                                                          | Status | Task State | Power State | Networks |
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+
| 49201b33-1cd9-4e2f-b182-224f29c2bb7c | mystack-server_group-etzglbdncptt-server_group-0-moxmbfm4pynk | ACTIVE | -          | Running     |          |
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+

    $ Keep running "ceilometer alarm-list" until seeing
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| Alarm ID                             | Name                                | State | Enabled | Continuous | Alarm condition                 | Time constraints |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| 39a9cb57-46f0-4f8a-885d-9a645aa467b1 | mystack-cpu_alarm_low-jrjmwxbhzdd3  | alarm | True    | True       | cpu_util < 15.0 during 1 x 120s | None             |
| 5dd5747e-a7a7-4ccd-994b-b0b8733728de | mystack-cpu_alarm_high-tpgsvsbcskjt | ok    | True    | True       | cpu_util > 80.0 during 1 x 180s | None             |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+

    $ Wait for 5 minutes
    $ ceilometer alarm-list
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| Alarm ID                             | Name                                | State | Enabled | Continuous | Alarm condition                 | Time constraints |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| 39a9cb57-46f0-4f8a-885d-9a645aa467b1 | mystack-cpu_alarm_low-jrjmwxbhzdd3  | alarm | True    | True       | cpu_util < 15.0 during 1 x 120s | None             |
| 5dd5747e-a7a7-4ccd-994b-b0b8733728de | mystack-cpu_alarm_high-tpgsvsbcskjt | ok    | True    | True       | cpu_util > 80.0 during 1 x 180s | None             |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+

    $ On Dashboard, log into 49201b33-1cd9-4e2f-b182-224f29c2bb7c VM console and run

        while [ true ]; do echo "hello world"; done

    $ Keep running "ceilometer alarm-list" until seeing
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| Alarm ID                             | Name                                | State | Enabled | Continuous | Alarm condition                 | Time constraints |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| 14a1c510-667c-4717-a49d-eba375e48e01 | mystack-cpu_alarm_low-3jmjeyqrwd3k  | ok    | True    | False      | cpu_util < 45.0 during 1 x 120s | None             |
| edcc3c0c-84b7-4694-8312-72677bc50efd | mystack-cpu_alarm_high-jiziioj5zt6r | alarm | True    | False      | cpu_util > 80.0 during 1 x 300s | None             |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+

    $ nova list
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+
| ID                                   | Name                                                          | Status | Task State | Power State | Networks |
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+
| 49201b33-1cd9-4e2f-b182-224f29c2bb7c | mystack-server_group-etzglbdncptt-server_group-0-moxmbfm4pynk | ACTIVE | -          | Running     |          |
| a1a21353-3400-46be-b75c-8c6a0a74a1de | mystack-server_group-etzglbdncptt-server_group-1-wzspkkrb4qay | BUILD  | spawning   | NOSTATE     |          |
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+

(Should see that now heat auto scales up by creating another VM)

    $ nova list
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+
| ID                                   | Name                                                          | Status | Task State | Power State | Networks |
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+
| 49201b33-1cd9-4e2f-b182-224f29c2bb7c | mystack-server_group-etzglbdncptt-server_group-0-moxmbfm4pynk | ACTIVE | -          | Running     |          |
| a1a21353-3400-46be-b75c-8c6a0a74a1de | mystack-server_group-etzglbdncptt-server_group-1-wzspkkrb4qay | ACTIVE | -          | Running     |          |
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+

    $ Keep running "ceilometer alarm-list" until seeing
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| Alarm ID                             | Name                                | State | Enabled | Continuous | Alarm condition                 | Time constraints |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| 14a1c510-667c-4717-a49d-eba375e48e01 | mystack-cpu_alarm_low-3jmjeyqrwd3k  | ok    | True    | False      | cpu_util < 45.0 during 1 x 120s | None             |
| edcc3c0c-84b7-4694-8312-72677bc50efd | mystack-cpu_alarm_high-jiziioj5zt6r | ok    | True    | False      | cpu_util > 80.0 during 1 x 300s | None             |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+

(Both alarm should be in "ok" state as average cpu_util for 2 VMs should be around 50%
which is in the range)

    $ On Dashboard, log into the a1a21353-3400-46be-b75c-8c6a0a74a1de VM console and run

        while [ true ]; do echo "hello world"; done

    $ Keep running "ceilometer alarm-list" until seeing
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| Alarm ID                             | Name                                | State | Enabled | Continuous | Alarm condition                 | Time constraints |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| 14a1c510-667c-4717-a49d-eba375e48e01 | mystack-cpu_alarm_low-3jmjeyqrwd3k  | ok    | True    | False      | cpu_util < 45.0 during 1 x 120s | None             |
| edcc3c0c-84b7-4694-8312-72677bc50efd | mystack-cpu_alarm_high-jiziioj5zt6r | alarm | True    | False      | cpu_util > 80.0 during 1 x 300s | None             |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+

    $ nova list
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+
| ID                                   | Name                                                          | Status | Task State | Power State | Networks |
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+
| 49201b33-1cd9-4e2f-b182-224f29c2bb7c | mystack-server_group-etzglbdncptt-server_group-0-moxmbfm4pynk | ACTIVE | -          | Running     |          |
| a1a21353-3400-46be-b75c-8c6a0a74a1de | mystack-server_group-etzglbdncptt-server_group-1-wzspkkrb4qay | ACTIVE | -          | Running     |          |
| 88e88660-acde-4998-a2e3-312efbc72447 | mystack-server_group-etzglbdncptt-server_group-2-jaotqnr5x7xb | BUILD  | spawning   | NOSTATE     |          |
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+

(Should see that now heat auto scales up by creating another VM)

    $ nova list
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+
| ID                                   | Name                                                          | Status | Task State | Power State | Networks |
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+
| 49201b33-1cd9-4e2f-b182-224f29c2bb7c | mystack-server_group-etzglbdncptt-server_group-0-moxmbfm4pynk | ACTIVE | -          | Running     |          |
| a1a21353-3400-46be-b75c-8c6a0a74a1de | mystack-server_group-etzglbdncptt-server_group-1-wzspkkrb4qay | ACTIVE | -          | Running     |          |
| 88e88660-acde-4998-a2e3-312efbc72447 | mystack-server_group-etzglbdncptt-server_group-2-jaotqnr5x7xb | ACTIVE | -          | Running     |          |
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+

    $ Keep running "ceilometer alarm-list" until seeing
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| Alarm ID                             | Name                                | State | Enabled | Continuous | Alarm condition                 | Time constraints |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| 14a1c510-667c-4717-a49d-eba375e48e01 | mystack-cpu_alarm_low-3jmjeyqrwd3k  | ok    | True    | False      | cpu_util < 45.0 during 1 x 120s | None             |
| edcc3c0c-84b7-4694-8312-72677bc50efd | mystack-cpu_alarm_high-jiziioj5zt6r | ok    | True    | False      | cpu_util > 80.0 during 1 x 300s | None             |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+

    $ Wait for 5 minutes
    $ ceilometer alarm-list
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| Alarm ID                             | Name                                | State | Enabled | Continuous | Alarm condition                 | Time constraints |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| 14a1c510-667c-4717-a49d-eba375e48e01 | mystack-cpu_alarm_low-3jmjeyqrwd3k  | ok    | True    | False      | cpu_util < 45.0 during 1 x 120s | None             |
| edcc3c0c-84b7-4694-8312-72677bc50efd | mystack-cpu_alarm_high-jiziioj5zt6r | ok    | True    | False      | cpu_util > 80.0 during 1 x 300s | None             |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+

    $ On Dashboard, log into the a1a21353-3400-46be-b75c-8c6a0a74a1de VM console and
      stop the while loop

    $ Keep running "ceilometer alarm-list" until seeing
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| Alarm ID                             | Name                                | State | Enabled | Continuous | Alarm condition                 | Time constraints |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| 14a1c510-667c-4717-a49d-eba375e48e01 | mystack-cpu_alarm_low-3jmjeyqrwd3k  | alarm | True    | False      | cpu_util < 45.0 during 1 x 120s | None             |
| edcc3c0c-84b7-4694-8312-72677bc50efd | mystack-cpu_alarm_high-jiziioj5zt6r | ok    | True    | False      | cpu_util > 80.0 during 1 x 300s | None             |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+

    $ nova list
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+
| ID                                   | Name                                                          | Status | Task State | Power State | Networks |
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+
| 49201b33-1cd9-4e2f-b182-224f29c2bb7c | mystack-server_group-etzglbdncptt-server_group-0-moxmbfm4pynk | ACTIVE | -          | Running     |          |
| a1a21353-3400-46be-b75c-8c6a0a74a1de | mystack-server_group-etzglbdncptt-server_group-1-wzspkkrb4qay | ACTIVE | -          | Running     |          |
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+

(Heat scales down the VMs by one as cpu_alarm_low is triggered)

    $ Wait for 5 minutes
    $ ceilometer alarm-list
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| Alarm ID                             | Name                                | State | Enabled | Continuous | Alarm condition                 | Time constraints |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| 14a1c510-667c-4717-a49d-eba375e48e01 | mystack-cpu_alarm_low-3jmjeyqrwd3k  | ok    | True    | False      | cpu_util < 45.0 during 1 x 120s | None             |
| edcc3c0c-84b7-4694-8312-72677bc50efd | mystack-cpu_alarm_high-jiziioj5zt6r | ok    | True    | False      | cpu_util > 80.0 during 1 x 300s | None             |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+

    $ On Dashboard, log into the 49201b33-1cd9-4e2f-b182-224f29c2bb7c VM console and
      stop the while loop

    $ Keep running "ceilometer alarm-list" until seeing
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| Alarm ID                             | Name                                | State | Enabled | Continuous | Alarm condition                 | Time constraints |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| 14a1c510-667c-4717-a49d-eba375e48e01 | mystack-cpu_alarm_low-3jmjeyqrwd3k  | alarm | True    | False      | cpu_util < 45.0 during 1 x 120s | None             |
| edcc3c0c-84b7-4694-8312-72677bc50efd | mystack-cpu_alarm_high-jiziioj5zt6r | ok    | True    | False      | cpu_util > 80.0 during 1 x 300s | None             |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+

    $ nova list
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+
| ID                                   | Name                                                          | Status | Task State | Power State | Networks |
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+
| 49201b33-1cd9-4e2f-b182-224f29c2bb7c | mystack-server_group-etzglbdncptt-server_group-0-moxmbfm4pynk | ACTIVE | -          | Running     |          |
+--------------------------------------+---------------------------------------------------------------+--------+------------+-------------+----------+

(Heat scales down the VMs by one as cpu_alarm_low is triggered)

    $ Wait for 5 minutes
    $ ceilometer alarm-list
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| Alarm ID                             | Name                                | State | Enabled | Continuous | Alarm condition                 | Time constraints |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+
| 14a1c510-667c-4717-a49d-eba375e48e01 | mystack-cpu_alarm_low-3jmjeyqrwd3k  | alarm | True    | False      | cpu_util < 45.0 during 1 x 120s | None             |
| edcc3c0c-84b7-4694-8312-72677bc50efd | mystack-cpu_alarm_high-jiziioj5zt6r | ok    | True    | False      | cpu_util > 80.0 during 1 x 300s | None             |
+--------------------------------------+-------------------------------------+-------+---------+------------+---------------------------------+------------------+

    $ heat stack-delete 1905a541-edfa-4a1f-b6f9-eacdf5f62d85
    $ heat stack-list
+----+------------+--------------+---------------+
| id | stack_name | stack_status | creation_time |
+----+------------+--------------+---------------+
+----+------------+--------------+---------------+

    $ nova list
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+

    $ ceilometer alarm-list
+----------+------+-------+---------+------------+-----------------+------------------+
| Alarm ID | Name | State | Enabled | Continuous | Alarm condition | Time constraints |
+----------+------+-------+---------+------------+-----------------+------------------+
+----------+------+-------+---------+------------+-----------------+------------------+


Heat Built-In Unit Tests
=========================

This section describes how to run Heat and Heat client built-in unit
tests which are located at:

    /usr/lib64/python2.7/site-packages/heat/tests
    /usr/lib64/python2.7/site-packages/heatclient/tests

To run heat built-in unit test with nosetests:

    $ cd /usr/lib64/python2.7/site-packages/heat
    $ nosetests -v tests

----------------------------------------------------------------------
Ran 1550 tests in 45.770s

OK

To run heatclient built-in unit test with nosetests:

    $ cd /usr/lib64/python2.7/site-packages/heatclient/tests
    $ python -v -m subunit.run discover . | subunit2pyunit

----------------------------------------------------------------------
Ran 272 tests in 3.368s

OK

Please note that, Python testrunner subunit.run is used instead of
nosetests as nosetests is not compatible with testscenarios test
framework used by some of the heatclient unit tests.