Use parameter constraints for image, key and flavor
authorSteven Hardy <shardy@redhat.com>
Thu, 23 Oct 2014 15:42:45 +0000 (16:42 +0100)
committerSteven Hardy <shardy@redhat.com>
Thu, 23 Oct 2014 17:42:50 +0000 (18:42 +0100)
If you don't have (or provide) the wrong image, KeyName,
or flavor, we fail at some later point (not always early,
depending on what's wrong).

Since Icehouse, Heat has had a "custom constraints" method
of dynamically validating parameter values, by comparing the
value provided with a list from the underlying service.

Despite the name, there's nothing "custom" about the constraints,
these ones are included in Heat by default (though they are pluggable,
which is where the name comes from..)

See the docs for more info:
http://docs.openstack.org/developer/heat/template_guide/hot_spec.html#custom-constraint

Note, I've not considered network validation here, this could
possibly be added in a subsequent patch.

These constraints are evaluated via any of the following:
- heat template-validate -f <template>
- heat stack-preview <arguments given to create>
- heat stack-create <arguments, fails fast before creating anything>
- heat stack-update <arguments, fails fast before updating anything>

Change-Id: I3a6374ce5421575cdde893c62aa97c750a07acd8

compute.yaml
controller.yaml
overcloud-source.yaml
overcloud-without-mergepy.yaml

index 350b5ec..9995149 100644 (file)
@@ -73,6 +73,8 @@ parameters:
     description: Flavor for the nova compute node
     type: string
     default: baremetal
+    constraints:
+      - custom_constraint: nova.flavor
   GlanceHost:
     type: string
     default: ''  # Has to be here because of the ignored empty value bug
@@ -87,6 +89,8 @@ parameters:
   Image:
     type: string
     default: overcloud-compute
+    constraints:
+      - custom_constraint: glance.image
   ImageUpdatePolicy:
     default: 'REBUILD_PRESERVE_EPHEMERAL'
     description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt.
@@ -95,6 +99,8 @@ parameters:
     description: Name of an existing EC2 KeyPair to enable SSH access to the instances
     type: string
     default: default
+    constraints:
+      - custom_constraint: nova.keypair
   KeystoneHost:
     type: string
     default: ''
index 885d089..3cc27ac 100644 (file)
@@ -97,6 +97,8 @@ parameters:
     default: baremetal
     description: Flavor for control nodes to request when deploying.
     type: string
+    constraints:
+      - custom_constraint: nova.flavor
   GlanceNotifierStrategy:
     description: Strategy to use for Glance notification queue
     type: string
@@ -131,6 +133,8 @@ parameters:
   Image:
     type: string
     default: overcloud-control
+    constraints:
+      - custom_constraint: glance.image
   ImageUpdatePolicy:
     default: 'REBUILD_PRESERVE_EPHEMERAL'
     description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt.
@@ -139,6 +143,8 @@ parameters:
     default: default
     description: Name of an existing EC2 KeyPair to enable SSH access to the instances
     type: string
+    constraints:
+      - custom_constraint: nova.keypair
   KeystoneCACertificate:
     default: ''
     description: Keystone self-signed certificate authority certificate.
index 5530006..0832e7c 100644 (file)
@@ -58,6 +58,8 @@ parameters:
   controllerImage:
     type: string
     default: overcloud-control
+    constraints:
+      - custom_constraint: glance.image
   ControlVirtualInterface:
     default: 'br-ex'
     description: Interface where virtual ip will be assigned.
@@ -160,6 +162,8 @@ parameters:
     default: default
     description: Name of an existing EC2 KeyPair to enable SSH access to the instances
     type: string
+    constraints:
+      - custom_constraint: nova.keypair
   KeystoneCACertificate:
     default: ''
     description: Keystone self-signed certificate authority certificate.
@@ -288,6 +292,8 @@ parameters:
   NovaImage:
     type: string
     default: overcloud-compute
+    constraints:
+      - custom_constraint: glance.image
   NovaPassword:
     default: unset
     description: The password for the nova service account, used by nova-api.
@@ -300,10 +306,14 @@ parameters:
     default: baremetal
     description: Flavor for compute nodes to request when deploying.
     type: string
+    constraints:
+      - custom_constraint: nova.flavor
   OvercloudControlFlavor:
     default: baremetal
     description: Flavor for control nodes to request when deploying.
     type: string
+    constraints:
+      - custom_constraint: nova.flavor
   PublicVirtualFixedIPs:
     default: []
     description: >
index cb4f25c..bba63f5 100644 (file)
@@ -59,6 +59,8 @@ parameters:
     default: default
     description: Name of an existing EC2 KeyPair to enable SSH access to the instances
     type: string
+    constraints:
+      - custom_constraint: nova.keypair
   NeutronBridgeMappings:
     description: >
       The OVS logical->physical bridge mappings to use. See the Neutron
@@ -185,10 +187,14 @@ parameters:
   controllerImage:
     type: string
     default: overcloud-control
+    constraints:
+      - custom_constraint: glance.image
   OvercloudControlFlavor:
     default: baremetal
     description: Flavor for control nodes to request when deploying.
     type: string
+    constraints:
+      - custom_constraint: nova.flavor
   ControlVirtualInterface:
     default: 'br-ex'
     description: Interface where virtual ip will be assigned.
@@ -393,10 +399,14 @@ parameters:
   NovaImage:
     type: string
     default: overcloud-compute
+    constraints:
+      - custom_constraint: glance.image
   OvercloudComputeFlavor:
     description: Use this flavor
     type: string
     default: baremetal
+    constraints:
+      - custom_constraint: nova.flavor
 
 
 resources: