zoukankan      html  css  js  c++  java
  • 如何区分 OpenStack Neutron Extension 和 Plugin

    Neutron 里面的 extension 和 plugin 是非常相似的两个概念,我花了好久才貌似搞懂了两者的区别,还不一定完全正确。

    在OpenStack 的官网wiki中,可以找到它们两个的定义:

    Plugin:

    Neutron exposes a logical API to define network connectivity between devices from other OpenStack services (e.g., vNICs from Nova VMs). The logical connectivity described using the API must be translated into actually configuration on virtual and/or physical switches. This is where a Neutron plugin comes in. The Neutron plugin is able to talk to one or more types of switches and dynamically reconfigures the switches based on API calls.

    Extension:

    API Extensions allow a plugin to extend the Neutron API in order to expose more information. This information could be required to implement advanced functionality that is specific to a particular plugin, or to expose a capability before it has been incorporated into an official Neutron API.

    具体链接在这里:https://wiki.openstack.org/wiki/NeutronDevelopment

    由上述定义,再结合 Neutron 源代码中的一些文件可以看出,其实一个官方的核心插件(Core Plugin)只包括三种资源:Network, Subnet 以及 Port。插件必须能够与一些交换机沟通,实现逻辑上的二层和三层网络。而当我们需要在Neutron中加入更多的网络资源,例如 Router, Load Balancer, Gateway, VPN, Security Group 等的时候,extension 就出场了。这些额外的资源都可以在 extension 中进行定义,例如我在之前的文章中提到的RESOURCE_ATTRIBUTE_MAP等。

    在官网中,我们还可以看到,extension还分三种:

    Resource extensions introduce a new "entity" to the API. In Neutron, current entities are "networks" and "ports".
    Action extensions tend to be "verbs" that act on a resource. For example, in Nova, there is a "server" resource, and a "rebuild" action on that server resource: http://docs.openstack.org/cactus/openstack-compute/developer/openstack-compute-api-1.1/content/Rebuild_Server-d1e3538.html#d2278e1430 . Core Neutron API doesn't really use "actions" as part of the core API, but extensions certainly could.
    Request extensions allow one to add new values to existing requests objects. For example, if you were doing a POST to create a server, but wanted to add a new 'widgetType' attribute for the server object.

    可以看到,第一种 Resource extensions 就是我们说的在需要加入更多新资源的时候可以用到。

    第二种 Action extensions 就是在我们需要加入新动作的时候可以用到。比如说我有一个 Gateway 资源,希望可以把它和许多 Network 关联起来,这个操作可能就不存在于传统的CRUD中,那我就需要定义一个新的 Action Extension。

    第三种我也不是特别理解,可能是说Request Extension是可以用来处理已经存在的资源的一些新增属性。例如 Network 资源多出来一个 priority 属性,传统的CRUD只针对 Network 原有的属性,不会去涉及到 priority 的值,那我就需要针对 priority 属性定义一个新的 Request Extension。

    所以根据上面的描述,在我们要开发 Neutron 的时候,第一个要决定的事情就是我到底要写一个 Extension 还是 Plugin?如果我需要新增一些资源,那毫无疑问必须上 Extension; 如果我要实现一个新的与交换机沟通的方法,那就需要实现一组新的 Plugin。

    ----------------------------------------------------------------
    作者:好大一片云
    博客地址:http://www.cnblogs.com/zhutianshi/
    转载声明:可以转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明,谢谢合作!
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
  • 相关阅读:
    Dell FC Switch zone configuration
    RMAN参考使用手册[转载]
    CentOS下SVN简介、下载、安装
    教你制作启动U盘 用U盘装系统(转载)
    RMAN简明使用手册[转载]
    控制文件和重做日志文件(1)[转载)
    RMAN快速入门指南[转载]
    Dell服务转移
    BE Learing 8 异常及解决办法
    10g rman备份恢复案例[转载]
  • 原文地址:https://www.cnblogs.com/zhutianshi/p/3902315.html
Copyright © 2011-2022 走看看