Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Openstack 带或不带卷类型的煤渣卷热模板_Openstack_Openstack Heat_Openstack Cinder - Fatal编程技术网

Openstack 带或不带卷类型的煤渣卷热模板

Openstack 带或不带卷类型的煤渣卷热模板,openstack,openstack-heat,openstack-cinder,Openstack,Openstack Heat,Openstack Cinder,我正在尝试为Openstack volume编写一个热模板,需要将volume_类型作为参数。我还需要支持一种情况,即没有给出参数,并且默认为Cinder默认体积类型 type: OS::Cinder::Volume properties: name: test size: 1 volume_type: { if: ["voltype_given" , {get_param:[typename]} , null] } 第一次尝试是将null传递给卷类型,希望它给

我正在尝试为Openstack volume编写一个热模板,需要将volume_类型作为参数。我还需要支持一种情况,即没有给出参数,并且默认为Cinder默认体积类型

type: OS::Cinder::Volume
properties:
  name: test
  size: 1
  volume_type: { if: ["voltype_given" , {get_param:[typename]} , null] }
第一次尝试是将null传递给卷类型,希望它给出默认卷类型。但是,无论我传递什么(null,~,default,“”),似乎都无法获取默认卷类型

type: OS::Cinder::Volume
properties:
  name: test
  size: 1
  volume_type: { if: ["voltype_given" , {get_param:[typename]} , null] }
当您定义了“volume\u type”属性时,是否有办法获取默认卷类型

或者,是否有任何方法将“volume\u type”属性本身置于条件的后面?我试了好几种方法,但没有成功。比如:

type: OS::Cinder::Volume
properties:
  if: ["voltype_given" , [ volume_type: {get_param:[typename]} ] , ""]
  name: test
  size: 1

错误:TypeError::resources.kk-test-vol::'If'对象不可编辑

您可以这样做吗

---
parameters:
  typename:
    type: string

conditions:

  use_default_type: {equals: [{get_param: typename}, '']}

resources:
  MyVolumeWithDefault:
    condition: use_default_type
    type: OS::Cinder::Volume
    properties:
      name: test
      size: 1

  MyVolumeWithExplicit:
    condition: {not: use_default_type}
    type: OS::Cinder::Volume
    properties:
      name: test
      size: 1
      volume_type: {get_param: typename}

  # e.g. if you need to refer to the volume from another resource
  MyVolumeAttachment:
    type: OS::Cinder::VolumeAttachment
    properties:
      instance_uid: some-instance-uuid
      volume_id:
        if:
          - use_default_type
          - get_resource: MyVolumeWithDefault
          - get_resource: MyVolumeWithExplicit