summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-openstack/recipes-devtools/python/python-heat/autoscaling_example.template66
-rw-r--r--meta-openstack/recipes-devtools/python/python-heat/one_vm_example.template63
-rw-r--r--meta-openstack/recipes-devtools/python/python-heat/two_vms_example.template74
-rw-r--r--meta-openstack/recipes-devtools/python/python-heat_git.bb10
4 files changed, 211 insertions, 2 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-heat/autoscaling_example.template b/meta-openstack/recipes-devtools/python/python-heat/autoscaling_example.template
new file mode 100644
index 0000000..6391187
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-heat/autoscaling_example.template
@@ -0,0 +1,66 @@
1heat_template_version: 2014-05-06
2description: AutoScaling
3parameters:
4 instance_type:
5 type: string
6 description: Type of the instance to be created.
7 default: m1.tiny
8 constraints:
9 - allowed_values: [m1.tiny, m1.small, m1.medium, m1.large]
10 description:
11 Value must be one of 'm1.tiny', 'm1.small', 'm1.medium' or 'm1.large'.
12 image_id:
13 type: string
14 description: ID of the image to use for the instance to be created.
15 default: myfirstimage
16resources:
17 web_server_group_launch_conf:
18 type: AWS::AutoScaling::LaunchConfiguration
19 properties:
20 ImageId: { get_param: image_id }
21 InstanceType: { get_param: instance_type }
22 server_group:
23 type: AWS::AutoScaling::AutoScalingGroup
24 properties:
25 AvailabilityZones: ["RegionOne"]
26 MinSize: '1'
27 MaxSize: '3'
28 LaunchConfigurationName: {get_resource: web_server_group_launch_conf}
29 web_server_scaleup_policy:
30 type: AWS::AutoScaling::ScalingPolicy
31 properties:
32 AdjustmentType: ChangeInCapacity
33 AutoScalingGroupName: {get_resource: server_group}
34 Cooldown: 60
35 ScalingAdjustment: 1
36 web_server_scaledown_policy:
37 type: AWS::AutoScaling::ScalingPolicy
38 properties:
39 AdjustmentType: ChangeInCapacity
40 AutoScalingGroupName: {get_resource: server_group}
41 Cooldown: 60
42 ScalingAdjustment: -1
43 cpu_alarm_high:
44 type: OS::Ceilometer::Alarm
45 properties:
46 description: Scale-up if the average CPU > 80% for 5 minute
47 meter_name: cpu_util
48 statistic: avg
49 period: '300'
50 evaluation_periods: '1'
51 threshold: '80'
52 alarm_actions:
53 - {get_attr: [web_server_scaleup_policy, AlarmUrl]}
54 comparison_operator: gt
55 cpu_alarm_low:
56 type: OS::Ceilometer::Alarm
57 properties:
58 description: Scale-down if the average CPU < 45% for 2 minutes
59 meter_name: cpu_util
60 statistic: avg
61 period: '120'
62 evaluation_periods: '1'
63 threshold: '45'
64 alarm_actions:
65 - {get_attr: [web_server_scaledown_policy, AlarmUrl]}
66 comparison_operator: lt
diff --git a/meta-openstack/recipes-devtools/python/python-heat/one_vm_example.template b/meta-openstack/recipes-devtools/python/python-heat/one_vm_example.template
new file mode 100644
index 0000000..07d6e6d
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-heat/one_vm_example.template
@@ -0,0 +1,63 @@
1heat_template_version: 2014-05-06
2description: Template to deploy one VM
3parameters:
4 vm_type:
5 type: string
6 description: Type of the instance to be created.
7 default: m1.tiny
8 constraints:
9 - allowed_values: [m1.tiny, m1.small, m1.medium, m1.large]
10 description:
11 Value must be one of 'm1.tiny', 'm1.small', 'm1.medium' or 'm1.large'.
12 image_id:
13 type: string
14 description: ID of the image to use for VM to be created.
15 default: myfirstimage
16 vol_1_size:
17 type: number
18 description: Size of the volume to be created.
19 default: 1
20 constraints:
21 - range: { min: 1, max: 1024 }
22 description: must be between 1 and 1024 Gb.
23 vol_1_type:
24 type: string
25 description: Cinder backend type
26 default: lvm_iscsi
27 constraints:
28 - allowed_values: [lvm_iscsi, nfs, glusterfs, cephrbd]
29 description:
30 Value must be one of 'lvm_iscsi', 'nfs', 'glusterfs' or 'cephrbd'.
31 vol_2_id:
32 type: string
33 description: Cinder existing volume id
34resources:
35 vm_1:
36 type: OS::Nova::Server
37 properties:
38 image: { get_param: image_id }
39 flavor: { get_param: vm_type }
40 vol_1:
41 type: OS::Cinder::Volume
42 properties:
43 size: { get_param: vol_1_size }
44 volume_type: { get_param: vol_1_type }
45 vol_1_attachment:
46 type: OS::Cinder::VolumeAttachment
47 properties:
48 volume_id: { get_resource: vol_1 }
49 instance_uuid: { get_resource: vm_1 }
50 mountpoint: /dev/vdb
51 vol_2_attachment:
52 type: OS::Cinder::VolumeAttachment
53 properties:
54 volume_id: { get_param: vol_2_id }
55 instance_uuid: { get_resource: vm_1 }
56 mountpoint: /dev/vdc
57outputs:
58 vm_1_instance_ip:
59 description: Public IP address of VM 1.
60 value: { get_attr: [vm_1, first_address] }
61 vm_1_show:
62 description: Show details of VM 1.
63 value: { get_attr: [vm_1, show] }
diff --git a/meta-openstack/recipes-devtools/python/python-heat/two_vms_example.template b/meta-openstack/recipes-devtools/python/python-heat/two_vms_example.template
new file mode 100644
index 0000000..9690e5a
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-heat/two_vms_example.template
@@ -0,0 +1,74 @@
1heat_template_version: 2014-05-06
2description: Template to deploy two VMs
3parameters:
4 vm_type:
5 type: string
6 description: Type of the instance to be created.
7 default: m1.tiny
8 constraints:
9 - allowed_values: [m1.tiny, m1.small, m1.medium, m1.large]
10 description:
11 Value must be one of 'm1.tiny', 'm1.small', 'm1.medium' or 'm1.large'.
12 image_id:
13 type: string
14 description: ID of the image to use for 2 VMs to be created.
15 default: myfirstimage
16 vol_1_size:
17 type: number
18 description: Size of the volume to be created.
19 default: 1
20 constraints:
21 - range: { min: 1, max: 1024 }
22 description: must be between 1 and 1024 Gb.
23 vol_1_type:
24 type: string
25 description: Cinder backend type
26 default: lvm_iscsi
27 constraints:
28 - allowed_values: [lvm_iscsi, nfs, glusterfs, cephrbd]
29 description:
30 Value must be one of 'lvm_iscsi', 'nfs', 'glusterfs' or 'cephrbd'.
31 vol_2_id:
32 type: string
33 description: Cinder existing volume id
34resources:
35 vm_1:
36 type: OS::Nova::Server
37 properties:
38 image: { get_param: image_id }
39 flavor: { get_param: vm_type }
40 vm_2:
41 type: OS::Nova::Server
42 properties:
43 image: { get_param: image_id }
44 flavor: { get_param: vm_type }
45 vol_1:
46 type: OS::Cinder::Volume
47 properties:
48 size: { get_param: vol_1_size }
49 volume_type: { get_param: vol_1_type }
50 vol_1_attachment:
51 type: OS::Cinder::VolumeAttachment
52 properties:
53 volume_id: { get_resource: vol_1 }
54 instance_uuid: { get_resource: vm_1 }
55 mountpoint: /dev/vdb
56 vol_2_attachment:
57 type: OS::Cinder::VolumeAttachment
58 properties:
59 volume_id: { get_param: vol_2_id }
60 instance_uuid: { get_resource: vm_1 }
61 mountpoint: /dev/vdc
62outputs:
63 vm_1_instance_ip:
64 description: Public IP address of VM 1.
65 value: { get_attr: [vm_1, first_address] }
66 vm_1_show:
67 description: Show details of VM 1.
68 value: { get_attr: [vm_1, show] }
69 vm_2_instance_ip:
70 description: Public IP address of VM 2.
71 value: { get_attr: [vm_2, first_address] }
72 vm_2_show:
73 description: Show details of VM 2.
74 value: { get_attr: [vm_2, show] }
diff --git a/meta-openstack/recipes-devtools/python/python-heat_git.bb b/meta-openstack/recipes-devtools/python/python-heat_git.bb
index 6f785df..4d8b832 100644
--- a/meta-openstack/recipes-devtools/python/python-heat_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-heat_git.bb
@@ -10,6 +10,9 @@ SRCNAME = "heat"
10SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/icehouse \ 10SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/icehouse \
11 file://heat.conf \ 11 file://heat.conf \
12 file://heat.init \ 12 file://heat.init \
13 file://autoscaling_example.template \
14 file://one_vm_example.template \
15 file://two_vms_example.template \
13" 16"
14 17
15SRCREV="69145518cb9a20d401c4213a030c39caaad1c326" 18SRCREV="69145518cb9a20d401c4213a030c39caaad1c326"
@@ -25,6 +28,7 @@ do_install_append() {
25 install -m 600 ${TEMPLATE_CONF_DIR}/*.json ${HEAT_CONF_DIR} 28 install -m 600 ${TEMPLATE_CONF_DIR}/*.json ${HEAT_CONF_DIR}
26 install -d ${HEAT_CONF_DIR}/templates 29 install -d ${HEAT_CONF_DIR}/templates
27 install -m 600 ${TEMPLATE_CONF_DIR}/templates/* ${HEAT_CONF_DIR}/templates 30 install -m 600 ${TEMPLATE_CONF_DIR}/templates/* ${HEAT_CONF_DIR}/templates
31 install -m 600 ${WORKDIR}/*.template ${HEAT_CONF_DIR}/templates
28 install -d ${HEAT_CONF_DIR}/environment.d 32 install -d ${HEAT_CONF_DIR}/environment.d
29 install -m 600 ${TEMPLATE_CONF_DIR}/environment.d/* ${HEAT_CONF_DIR}/environment.d 33 install -m 600 ${TEMPLATE_CONF_DIR}/environment.d/* ${HEAT_CONF_DIR}/environment.d
30 install -m 664 ${TEMPLATE_CONF_DIR}/api-paste.ini ${HEAT_CONF_DIR} 34 install -m 664 ${TEMPLATE_CONF_DIR}/api-paste.ini ${HEAT_CONF_DIR}
@@ -82,7 +86,7 @@ pkg_postinst_${SRCNAME}-setup () {
82 86
83inherit setuptools identity hosts update-rc.d default_configs 87inherit setuptools identity hosts update-rc.d default_configs
84 88
85PACKAGES += "${SRCNAME}-tests ${SRCNAME}-common ${SRCNAME}-api ${SRCNAME}-api-cfn ${SRCNAME}-engine" 89PACKAGES += "${SRCNAME}-tests ${SRCNAME}-templates ${SRCNAME}-common ${SRCNAME}-api ${SRCNAME}-api-cfn ${SRCNAME}-engine"
86PACKAGES += "${SRCNAME}-setup" 90PACKAGES += "${SRCNAME}-setup"
87 91
88ALLOW_EMPTY_${SRCNAME}-setup = "1" 92ALLOW_EMPTY_${SRCNAME}-setup = "1"
@@ -91,6 +95,8 @@ FILES_${PN} = "${libdir}/*"
91 95
92FILES_${SRCNAME}-tests = "${sysconfdir}/${SRCNAME}/run_tests.sh" 96FILES_${SRCNAME}-tests = "${sysconfdir}/${SRCNAME}/run_tests.sh"
93 97
98FILES_${SRCNAME}-templates = "${sysconfdir}/${SRCNAME}/templates/*"
99
94FILES_${SRCNAME}-common = "${sysconfdir}/${SRCNAME}/* \ 100FILES_${SRCNAME}-common = "${sysconfdir}/${SRCNAME}/* \
95" 101"
96 102
@@ -157,7 +163,7 @@ RDEPENDS_${PN} += " \
157 python-pbr \ 163 python-pbr \
158 " 164 "
159 165
160RDEPENDS_${SRCNAME}-engine = "${PN} ${SRCNAME}-common postgresql postgresql-client python-psycopg2 tgt" 166RDEPENDS_${SRCNAME}-engine = "${PN} ${SRCNAME}-templates ${SRCNAME}-common postgresql postgresql-client python-psycopg2 tgt"
161RDEPENDS_${SRCNAME}-api = "${SRCNAME}-engine" 167RDEPENDS_${SRCNAME}-api = "${SRCNAME}-engine"
162RDEPENDS_${SRCNAME}-api-cfn = "${SRCNAME}-engine" 168RDEPENDS_${SRCNAME}-api-cfn = "${SRCNAME}-engine"
163RDEPENDS_${SRCNAME}-setup = "postgresql sudo ${SRCNAME}-engine" 169RDEPENDS_${SRCNAME}-setup = "postgresql sudo ${SRCNAME}-engine"