支持 Tacker TOSCA 中的持久块存储

包含您的 Launchpad 蓝图的 URL

https://blueprints.launchpad.net/tacker/+spec/persistent-block-storage

本规范描述了 Cinder 卷的 TOSCA 模板,并将新的 TOSCA 属性映射到 Heat 的 Cinder 卷。

问题描述

目前 Tacker 在其 TOSCA 模板中暴露的存储相关属性不多。VDU disk_size 可能是唯一的属性。我们不支持将持久虚拟存储(如 Cinder 卷)附加到 Tacker VDU。有时,VDU 也需要“从卷启动”功能。

背景技术

现在在 TOSCA 模板中,它仅支持使用卷大小创建 VDU,不支持从卷启动以及指定在删除 VDU 时是否删除创建的卷。

Heat 介绍

Heat 现在支持块存储。用法如下

  1. 创建一个新的块存储卷

resources:
  my_new_volume:
    type: OS::Cinder::Volume
    properties:
      size: 10
  1. 从现有镜像创建一个可启动卷

resources:
  my_new_bootable_volume:
    type: OS::Cinder::Volume
    properties:
      size: 10
      image: ubuntu-trusty-x86_64
  1. 从另一个现有卷创建新卷

resources:
  another_volume:
    type: OS::Cinder::Volume
    properties:
      source_volid: 2fff50ab-1a9c-4d45-ae60-1d054d6bc868
  1. 从另一个现有卷快照创建新卷

resources:
  another_volume:
    type: OS::Cinder::Volume
    properties:
      snapshot_id: 2fff50ab-1a9c-4d45-ae60-1d054d6bc868
  1. 从另一个现有卷备份创建新卷

resources:
  another_volume:
    type: OS::Cinder::Volume
    properties:
      backup_id: 2fff50ab-1a9c-4d45-ae60-1d054d6bc868
  1. 创建一个新卷,并创建一个附加了此卷的实例

resources:
  new_volume:
    type: OS::Cinder::Volume
    properties:
      size: 1

  new_instance:
    type: OS::Nova::Server
    properties:
      flavor: m1.small
      image: ubuntu-trusty-x86_64

  volume_attachment:
    type: OS::Cinder::VolumeAttachment
    properties:
      volume_id: { get_resource: new_volume }
      instance_uuid: { get_resource: new_instance }

7. 从卷启动实例,并指定在删除实例时是否删除卷

resources:
  bootable_volume:
    type: OS::Cinder::Volume
    properties:
      size: 10
      image: ubuntu-trusty-x86_64

  instance:
    type: OS::Nova::Server
    properties:
      flavor: m1.small
      networks:
        - network: private
      block_device_mapping:
        - device_name: vda
          volume_id: { get_resource: bootable_volume }
          delete_on_termination: false

提议的变更

1. 在 TOSCA 模板中附加卷。在这种情况下,实例从镜像启动,并附加了一个新创建的卷。

我们引入了两个新节点,分别命名为 VB 和 CB。VB 定义了一个块存储,而 CB 描述了 VDU 和 VB 之间的关系。当 VDU 被删除时,VB 将被删除。一个 TOSCA 模板可以支持多个 VB 和 CB。

topology_template:
  node_templates:
    VDU1:
      type: tosca.nodes.nfv.VDU.Tacker
      properties:
        image: centos
        flavor: centos

    CP1:
      type: tosca.nodes.nfv.CP.Tacker
      requirements:
        - virtualLink:
            node: VL1
        - virtualBinding:
            node: VDU1

    VL1:
      type: tosca.nodes.nfv.VL

    VB1:
      type: tosca.nodes.BlockStorage
      properties:
        size: 10 GB

    CB1:
      type: tosca.nodes.BlockStorageAttachment
      properties:
        location: /dev/vdb
      requirements:
        - virtualBinding:
            node: VDU1
        - virtualAttachment:
            node: VB1

2. 从卷启动的 TOSCA。在这种情况下,实例从卷启动。该卷可以从许多不同的材料创建,例如从镜像创建。

与 1 类似,我们引入一个名为 VB 的节点来定义块存储。在 VDU 节点的 requirement 部分,我们使用 local_storage 来定义启动卷。可以配置 ‘delete_on_termination’ 来确定在删除 VDU 时是否删除卷。

topology_template:
  node_templates:
    VDU1:
      type: tosca.nodes.nfv.VDU.Tacker
      properties:
        flavor: centos
      requirements:
        - local_storage:
            node: VB1
            relationship:
              type: tosca.relationships.AttachesTo
              location: /dev/vdb
              delete_on_termination: false

    CP1:
      type: tosca.nodes.nfv.CP.Tacker
      requirements:
        - virtualLink:
            node: VL1
        - virtualBinding:
            node: VDU1

    VL1:
      type: tosca.nodes.nfv.VL

    VB1:
      type: tosca.nodes.BlockStorage
      properties:
        size: 10 GB
        image: ubuntu-trusty-x86_64

3. VDU 扩展场景。当前 nova/cinder 实现中,一个卷只能附加到一个实例。在 tacker vnf 扩展场景中,一个 VDU 可能有许多实例化的实例。因此,在 heat 中,我们需要为每个实例创建多个卷。不幸的是,heat 不支持它。

因此,我们应该验证 tosca 模板是否没有扩展策略,当存在块存储时。

备选方案

REST API 影响

安全影响

通知影响

其他最终用户影响

性能影响

其他部署者影响

开发人员影响

实现

负责人

主要负责人

周志红<zhouzhihong@cmss.chinamobile.com>

其他贡献者

Yan Xing an<yanxingan@cmss.chinamobile.com>

工作项

  1. 添加块存储的 tosca 模板示例

  2. 添加将 tosca 模板转换为 HOT 的代码

  3. UT 测试用例

  4. FT 测试用例

  5. devref 文档

依赖项

测试

文档影响

参考资料