0

我正在验证用户在热模板中传递的味道。目前,热模板允许我在允许的值中提及风味的名称。下面的小代码片段,

parameters:
flavor_type:  
type: string
        label: Flavor type
        description: Type of instance (flavor) to be used
        constraints:
          - allowed_values: [m1.xlarge ]
            description: Value must be one of m1.xlarge.

当用户使用名称 m1.xlarge 但不使用其他名称传递风味时,此方法有效。

我想允许具有特定大小的自定义风格(RAM - 8、HD - 150、VCPU -8)。我想在热模板中验证这些单独的值与传递的味道。

我觉得这是一个检查口味的有效用例。热模板中有可能吗?

谢谢,拉玛克里希纳

4

1 回答 1

1

Heat Spec 有自定义约束的概念。在https://docs.openstack.org/heat/pike/template_guide/hot_spec.html搜索“自定义约束” 。您可以利用它来验证输入是否是使用该模板的用户可用的风格之一

flavor_type:
  type: string
    label: Flavor type
    description: Type of instance (flavor) to be used
    constraints:
      - custom_constraint: nova.flavor
于 2017-11-21T19:54:12.783 回答