【问题标题】:Openstack flavor validation in heat templateheat 模板中的 Openstack 风味验证
【发布时间】:2017-11-22 03:54:12
【问题描述】:

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

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)。我想在热模板中验证这些单独的值与传递的味道。

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

谢谢, 拉玛克里希纳

【问题讨论】:

    标签: openstack openstack-heat


    【解决方案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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多