启用 Blazar 为 VNF 预留资源

https://blueprints.launchpad.net/tacker/+spec/reservation-vnfm

本提案旨在支持 VNFD 中 VDU 的 reservation_id。该规范参考了 ETSI 标准中计算资源预留的管理 [1]

问题描述

目前 Tacker 不支持资源预留。然而在电信行业,VNF 稳定运行通常需要系统资源预留。VNF 可以在有限的基础设施资源条件下运行。在这种情况下,资源预留对于即将到来的扩展、维护工作、灾难恢复 [2] 非常有用。

例如,某些 VNFs 具有不同的优先级,在有限的基础设施资源上部署,并且由于特定时期内需求增加,更高优先级的 VNF 的扩展将是预期的。更高优先级 VNF 的操作员需要为其 VNF 预留资源,以防止所有资源被其他 VNFs 消耗。

NFV 中预留功能的架构在 “Management of resource reservations” ETSI GS NFV-IFA010 [1] 中有规定。根据该标准,MANO 中的每个组件应支持以下功能。

  • NFVO

    • 决定是否以及何时需要资源预留

    • 向 VIM 请求预留

    • 将 VIM 提供的预留标识符告知 VNFM

  • VNFM

    • 使用预留标识符请求预留资源

  • VIM

    • 提供资源预留接口

Blazar 项目 [3] 实现了计算资源预留接口,现在可用。Blazar 支持 Host ReservationInstance Reservation。要使用 Host Reservation,用户在创建实例时指定 --hint reservation=<reservation_id> 参数 [4]。要使用 Instance Reservation,用户使用 Blazar 创建的 flavor 和 server_group_id [5]。但是,Tacker 不支持指定此参数,本规范计划支持它。

此外,如果 VNF 使用预留资源部署,对于上述情况,预计 VNF 将在预留开始时扩展,并在预留结束时缩小。本规范还计划支持这些扩展或缩小操作,而无需人工干预。

提议的变更

  • 在 node 类型的 properties 下添加一个新的 section ‘reservation_metadata’ tosca.nodes.nfv.VDU.Tacker

    tacker_nfv_defs.yamltacker_defs.yaml 的更改如下。

    node_types:
      tosca.nodes.nfv.VDU.Tacker:
        derived_from: tosca.nodes.nfv.VDU
        ...
        properties:
          ...
          reservation_metadata:
            required: false
            type: tosca.datatypes.tacker.VduReservationMetadata
    
    datatypes:
      ...
      tosca.datatypes.tacker.VduReservationMetadata:
       properties:
         resource_type:
           type: string
           required: true
           constraints:
             - valid_values: [ physical_host, virtual_instance ]
         id:
           type: string
           required: true
    

    操作员应包含 reservation_metadata 并根据 Blazar 服务预留的资源指定参数 resource_typeid。参数 resource_type 可以是两种类型 physical_hostvirtual_instance。在 Blazar 中创建 lease 时,需要指定要预留的资源类型。如果 resource_typevirtual_instance,则在 lease 创建成功后,响应中会返回 server_group_id,并且应在上面的 id 参数中指定此 server_group_id。 同样,如果 resource_typephysical_host,则应在上面的 id 参数中指定 reservation.id。此 id 参数将用于指示 Nova 如何调度 VDU

    以下 VNFD 模板示例显示了 virtual_instance resource_type 的预留

    :caption: Example VNFD with reservation for `virtual_instance`
              resource_type
    tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
    description: VDU with a reserved `virtual_instance`
    node_templates:
      - VDU_RSV:
        type: tosca.node.nfv.VDU.Tacker
        properties:
          ...
          reservation_metadata:
            resource_type: virtual_instance
            id: { get_input: server_group_id }
    
    :caption: Example parameter file
    topology_template:
      inputs:
        server_group_id:
          type: string
          description: server group id
    

    上述 VNFD 模板将被转换为 Heat Orchestration Template,如下所示

    heat_template_version: 2013-05-23
    resources:
      VDU_RSV:
        type: OS::Nova::Server
        ...
        scheduler_hints: { group: <server_group_id> }
    

    另一方面,physical_host 的预留示例如下

    :caption: Example VNFD with reservation for `physical_host`
              resource_type
    tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
    description: VDU with a reserved `physical_host`
    node_templates:
      - VDU_RSV:
        type: tosca.node.nfv.VDU.Tacker
        properties:
          ...
          reservation_metadata:
            resource_type: physical_host
            id: { get_input: reservation_id }
    
    :caption: Example parameter file
    topology_template:
      inputs:
        reservation_id:
          type: string
          description: reservation id
    

    上述 VNFD 模板将被转换为 Heat Orchestration Template,如下所示

    heat_template_version: 2013-05-23
    resources:
      VDU_RSV:
        type: OS::Nova::Server
        ...
        scheduler_hints: { reservation: <reservation_id> }
    
  • 添加一个新的 policy “tosca.policies.tacker.Reservation”

    在此 policy 中,您可以指定在 Blazar 触发 lease 开始、lease 结束前和 lease 结束事件时要执行的操作。

    对于上述用例,仅需要支持扩展和缩小操作,即可以在 start_actionsbefore_end_actionsend_actions 参数中指定 tosca.policies.tacker.Scaling 类型的 policy。但是,如果我们发现新的用例,将来可能需要其他操作。

    我们计划将扩展作为 lease 开始的 start_actions 操作执行,并将缩小作为 lease 结束前的 before_end_actions 操作执行,如下所示的 VNFD 样本所示。在本示例中,VNF 在预留开始时扩展,这意味着 VNF 在预留开始之前已创建。因此,不允许在 VNF 创建时使用预留资源创建 VDU。为了解决此问题,VNF 将在开始时使用没有 VDU 的 VDU_RSV 创建,并且 scaling policy 中的 default_instancesmin_instances 参数指定为 0。如果 VNF 在预留开始之前需要 VDU,则必须指定其他 VDU(如样本中的 VDU_NO_RSV)。

    以下是包含 reservation 触发 policy 的 VNFD 示例

    :caption: Example VNFD with reservation policy
    tosca_definitions_version: tosca_simple_profile_for_nfv_1_0_0
    description: VDU with a reserved resource
    node_templates:
      - VDU_RSV:
        type: tosca.node.nfv.VDU.Tacker
        properties:
          ...
          reservation_medata:
            resource_type: { get_input: physical_host }
            id: { get_input: reservation_id }
      - VDU_NO_RSV:
        type: tosca.node.nfv.VDU.Tacker
          ...
    
    policies:
      - RSV:
        type: tosca.policies.tacker.Reservation
        properties:
          lease_id: { get_input: lease_id }
          start_actions: [SP_RSV]
          before_end_actions: [SP_RSV]
          end_actions: noop
      - SP_RSV:
          type: tosca.policies.tacker.Scaling
          properties:
            increment: 5
            min_instances: 0
            max_instances: 5
            default_instances: 0
            targets: [VDU_RSV]
    

    上述 reservation policy 将被转换为 Heat Orchestration Template,如下所示。

    description: 'VNF TOSCA template with reservation_id input parameters
    parameters: {}
    resources:
      start_actions:
        type: OS::Aodh::EventAlarm
        properties:
          alarm_actions: ['http://hostname:9890/v1.0/vnfs/61b705ca-6dcc-4178-8402-bb4b85882760/start_actions/SP_RSV-out/eqmz4otj']
          event_type: lease.event.start_lease
          query:
          - {field: traits.lease_id, op: eq, value: 1933495b-0066-4243-aa48-d1fdd895fd5c}
      before_end_actions:
        type: OS::Aodh::EventAlarm
        properties:
          alarm_actions: ['http://hostname:9890/v1.0/vnfs/61b705ca-6dcc-4178-8402-bb4b85882760/before_end_actions/SP_RS-in/rfcz0v6y']
          event_type: lease.event.before_end_lease
          query:
          - {field: traits.lease_id, op: eq, value: 1933495b-0066-4243-aa48-d1fdd895fd5c}
      end_actions:
        type: OS::Aodh::EventAlarm
        properties:
          alarm_actions: ['http://hostname:9890/v1.0/vnfs/61b705ca-6dcc-4178-8402-bb4b85882760/end_actions/noop/eqmz4otj']
          event_type: lease.event.end_lease
          query:
          - {field: traits.lease_id, op: eq, value: 1933495b-0066-4243-aa48-d1fdd895fd5c}
      SP_RSV_scale_out:
        type: OS::Heat::ScalingPolicy
        properties:
          auto_scaling_group_id: {get_resource: SP_RSV_group}
          adjustment_type: change_in_capacity
          scaling_adjustment: 1
          cooldown: 120
      SP_RSV_group:
        type: OS::Heat::AutoScalingGroup
        properties:
          min_size: 1
          desired_capacity: 1
          cooldown: 120
          resource: {type: SP_RSV_res.yaml}
          max_size: 3
      SP_RSV_scale_in:
        type: OS::Heat::ScalingPolicy
        properties:
          auto_scaling_group_id: {get_resource: SP_RSV_group}
          adjustment_type: change_in_capacity
          scaling_adjustment: -1
          cooldown: 120
    
  • 创建和处理警报 (tacker->heat->aodh->tacker)

    如果在 VNFD 模板中指定了 policy tosca.policies.tacker.Reservation,tacker 将该 policy 转换为 heat 模板,该模板将在 Aodh 服务中创建警报。当 Blazar 触发 start_leasebefore_end_leaseend_lease 事件时,这些事件将在 lease 的生命周期中被 Aodh 服务接收,然后 Aodh 服务将引发警报,这些警报将由 Tacker 服务处理。我们计划重用现有的 AlarmReceiver 中间件来处理 tosca.policies.tacker.Reservation policy 的警报。

    注意

    需要配置 Ceilometer 以启用事件警报 [6]

备选方案

reservation_metadata property 转换为 schedular_hints.reservationscheduler_hints.group 的另一种方法是更新 heat-translator。但是,VDU 中的 reservation_metadata property 是 NFV 的一部分,将此类逻辑引入 heat-translator 不是一个好的方法。

数据模型影响

REST API 影响

安全影响

通知影响

其他最终用户影响

性能影响

其他部署者影响

开发人员影响

实现

负责人

主要负责人

nirajsingh <niraj.singh@nttdata.com>

其他贡献者

Hiroyuki Jo <jo.hiroyuki@lab.ntt.co.jp>

工作项

  • 将新的 property reservation_metadata 添加到 tosca.nodes.nfv.VDU.Tacker。

  • Tosca Parser: 添加一个新的 policy 类型和属性,如 ‘start_actions’、‘before_end_actions’ 和 ‘end_actions’ 用于解析 tosca 模板的 reservation policy。

  • heat-translator: 将 tosca.policies.tacker.Reservation 转换为 Heat Orchestration Template。

  • 编写单元/功能测试用例

  • 添加发布和安装文档

依赖项

  • 为了实现此功能,tacker 之外的其他项目中需要进行许多更改,如 Work Items 部分中所列。

测试

添加功能测试以测试此功能。您需要创建 lease,使用 lease id 和 reservation id 创建 vnfd 模板,从 vnfd 模板创建 vnf,最后检查是否在 lease 的生命周期内接收到 Blazar 触发的每个事件的警报。

文档影响

  • 添加文档以说明如何使用预留功能

  • 更新安装指南。Blazar、Aodh 和 Ceilometer 服务需要使用此功能。

参考资料