译文: Manila Admin Reference (Mitaka版本)

来源:互联网 发布:构建中小企业网络v6.0 编辑:程序博客网 时间:2024/06/03 22:58

一边理解一边翻译了一下Openstack Manila Admin Reference. 这个文档主要是关于如何配置和部署Manila. 斜体字为译者注释的内容. 为了便于理解和查询, 有些名词保留使用英文.

官方文档地址: http://docs.openstack.org/developer/manila/adminref/index.html

原文目录如下:

Contents
  • Introduction to Manila Shared Filesystem Management Service
  • Quick startPrerequisites
  • Steps to perform
    • Installation of manila binaries
    • Installation of manila client
    • Registration in keystone
    • Preparation of external files
    • Basic configuration of manila
    • Database setup
    • Running manila services
    • Creation of pilot share
  • Configure multiple back ends
  • Enable multiple back ends
  • Manila Network Plugins
    • What is a network plugin in Manila?
    • When to use a network plugin?
    • What network plugins are available?
    • Approaches for setup of network plugins
    • Example of network plugin configuration

1. Introduction to Manila Shared Filesystem Management Service

Manila是Openstack提供文件共享服务的项目. 为了管理Openstack文件共享服务, 理解以下概念会很有帮助, 如share networks, shares, 多租户 (multi-tenancy) 和后端存储 (backends). 配置manila服务时, 至少配置一个后端存储. manila可以运行在单个或者多个节点上.

2. Quick start

本文档描述了如何在Openstack Mitaka版本安装manila服务. 注意, 这个过程和之前的版本不同, 且很可能在后续版本中发生变化.

Manila包括以下几个主要的服务, 类似于Openstack cinder项目:

  • manila-api
  • manila-data
  • manila-scheduler
  • manila-share

manila-api和manila-scheduler的安装过程类似于大部分的openstack组件部署. 但是manila-share的部署方式与所使用的后端存储有关, 可能有所不同. 这个文档只包含一种简单的情况, 即只配置了通用驱动 (Generic driver), 它使用cinder作为它的后端存储.

注意, 根据是否有share servers, manila-share有两种运行模式. 大部分情况下, share servers是虚拟机, 这些虚拟机通过不同的网络文件系统提供 (export) 文件共享. 这个文档中给出了使用通用驱动的例子, 它通过neutron提供的网络资源管理share servers.

Note

Manila支持任何的网络架构. 一个驱动管理它自己的share servers时, 它可以使用任何提供了网络资源的网络插件 (network plug-ins). Manila包含支持neutron和nova-network的插件, 还有一个支持单一网络的StandaloneNetworkPlugin. 当一个驱动不管理share servers时, 相应地, 它就不需要网络插件.

安装manila前必需的组件:

  • MySQL database
  • RabbitMQ message bus
  • OpenStack keystone
  • Git

对于通用驱动, 需要以下组件:

  • OpenStack cinder
  • OpenStack glance
  • OpenStack neutron
  • OpenStack nova

3. Steps to perform

3.1 通过源码安装manila服务

Manila可以通过发行包 (yum) 或者源码来安装. 我们使用git仓库的源码安装.
下载源码:

$ git clone -b stable/mitaka https://github.com/openstack/manila

执行安装脚本:

$ sudo python setup.py install

上述操作将安装manila和依赖的包, 包括以下这些组件:

  • manila-all
  • manila-api
  • manila-data
  • manila-manage
  • manila-scheduler
  • manila-share

3.2 安装manila client

为了发送请求给manila, 我们需要安装manila client, 它用来发送manila请求.
通过pip安装manila client:

$ sudo pip install python-manilaclient>=1.8.1

Note

支持Mitaka版本的最老的manila client版本是1.8.1

3.3 在keystone中注册manila服务

像其它的Openstack项目一样, manila需要在keystone中注册. 以下是注册步骤, 类似cinder:
(1) 创建manila服务用户:

$ openstack user create --name manila --password %PASSWORD%

(2) 给manila用户增加admin角色:

$ openstack role add --user manila --project service admin

Note

project名可能不同, 但是必须和其它服务, 如”cinder”, “nova”服务一致.

(3) 创建manila服务:

$ openstack service create \    --name manila \    --description "OpenStack Shared Filesystems"\    share$ openstack service create \    --name manilav2 \    --description "OpenStack Shared Filesystems"\    sharev2

结果:

+-------------+----------------------------------+|   Property  |              Value               |+-------------+----------------------------------+| description |   OpenStack Shared Filesystems   ||   enabled   |               True               ||      id     | 4c13e9ff7ec04f4e95a26f72ecdf9919 ||     name    |              manila              ||     type    |              share               |+-------------+----------------------------------++-------------+----------------------------------+|   Property  |              Value               |+-------------+----------------------------------+| description | OpenStack Shared Filesystems V2  ||   enabled   |               True               ||      id     | 2840d1e7b033437f8776a7bd5045b28d ||     name    |             manilav2             ||     type    |             sharev2              |+-------------+----------------------------------+

(4) 创建使用manila服务的API端口:

$ openstack endpoint create \    --region RegionOne \    --publicurl http://%controller%:8786/v1/%\(tenant_id\)s \    --internalurl http://%controller%:8786/v1/%\(tenant_id\)s \    --adminurl http://%controller%:8786/v1/%\(tenant_id\)s \    share$ openstack endpoint create \    --region RegionOne \    --publicurl http://%controller%:8786/v2/%\(tenant_id\)s \    --internalurl http://%controller%:8786/v2/%\(tenant_id\)s \    --adminurl http://%controller%:8786/v2/%\(tenant_id\)s \    sharev2

结果:

+----------------------------------+-----------+--------------+----------------+----------------------------------------------------+| ID                               | Region    | Service Name | Service Type   | PublicURL                                          |+----------------------------------+-----------+--------------+----------------+----------------------------------------------------+| 3933b186baec48b9bc647877ee685d0f | RegionOne | Manila       | share          | http://%controller%:8786/v1/%\(tenant_id\)s        || de06e6d76b534fac854dba8d740a1741 | RegionOne | Manilav2     | sharev2        | http://%controller%:8786/v2/%\(tenant_id\)s        |+----------------------------------+-----------+--------------+----------------+----------------------------------------------------+

Note

端口”8786”是manila的默认端口. 可以修改, 但是同时也要修改manila配置文件的”osapi_share_listen_port”, 它的默认值也是”8786”.

3.4 Preparation of external files

%git_dir%/etc/manila目录复制以下文件到/etc/manila目录 (%git_dir%是之前下载manila源码的目录) :

policy.jsonapi-paste.inirootwrap.confrootwrap.d/share.filters

使用tox生成一个示例配置文件:

$ tox -e genconfig

译者注:
如果没有tox, 需要安装:

pip install tox

执行tox -e genconfig需要一些软件包:

yum install -y postgresql-devel* libxml2-devel.x86_64 libxslt-devel.x86_64 gcc

上一步操作将生成最新的配置文件:

‘%git_dir%/etc/manila/manila.conf.sample’

拷贝该配置文件, 去除文件后缀:

$ cp %git_dir%/etc/manila/manila.conf.sample /etc/manila/manila.conf

Note

manila配置文件可能放在别的地方. 默认位置是/etc/manila/manila.conf.

3.5 manila基本配置

在示例中, 我们使用通用驱动 (使用cinder作为它的后端存储) 配置了一个后端存储, 并将它配置为driver_handles_share_servers=True, 即这个通用驱动将负责管理它的share servers. 下面是配置文件的示例, 列出了一些关键的配置组.

[keystone_authtoken]signing_dir = /var/cache/manilaadmin_password = %password_we_used_with_user_creation_operation%admin_user = manilaadmin_tenant_name = %service_project_name_we_used_with_user_creation_operation%auth_protocol = httpauth_port = 35357auth_host = %address_of_machine_with_keystone_endpoint%[DATABASE]# Set up MySQL connection. In following  ‘foo’ is username,# ‘bar’ is password and ‘quuz’ is host name or address:connection = mysql+pymysql://foo:bar@quuz/manila?charset=utf8[oslo_concurrency]# Following opt defines directory to be used for lock files creation.# Should be owned by user that runs manila-share processes.# Defaults to env var ‘OSLO_LOCK_PATH’. It is used by manila-share services# and is required to be set up. Make sure this dir is created and owned# by user that run manila-share services.lock_path = /etc/manila/custom_manila_lock_path[DEFAULT]# Set pretty logging output. Not required, but may be useful.logging_exception_prefix = %(color)s%(asctime)s.%(msecs)d TRACE %(name)s ^[[01;35m%(instance)s^[[00mlogging_debug_format_suffix = ^[[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d^[[00mlogging_default_format_string = %(asctime)s.%(msecs)d %(color)s%(levelname)s %(name)s [^[[00;36m-%(color)s] ^[[01;35m%(instance)s%(color)s%(message)s^[[00mlogging_context_format_string = %(asctime)s.%(msecs)d %(color)s%(levelname)s %(name)s [^[[01;36m%(request_id)s ^[[00;36m%(user_id)s %(project_id)s%(color)s] ^[[01;35m%(instance)s%(color)s%(message)s^[[00m# Set auth strategy for usage of keystoneauth_strategy = keystone# Set message bus credsrabbit_userid = %rabbit_username%rabbit_password = %rabbit_user_password%rabbit_hosts = %address_of_machine_with_rabbit%rpc_backend = rabbit# Following opt is used for definition of share backends that should be enabled.# Values are conf groupnames that contain per manila-share service opts.enabled_share_backends = london# Enable protocols ‘NFS’ and ‘CIFS’ as those are the only supported# by Generic driver that we are configuring in this set up.# All available values are (‘NFS’, ‘CIFS’, ‘GlusterFS’, ‘HDFS’, 'CEPHFS')enabled_share_protocols = NFS,CIFS# Manila requires ‘share-type’ for share creation.# So, set here name of some share-type that will be used by default.default_share_type = default_share_type # 默认的share type的名字state_path = /opt/stack/data/manilaosapi_share_extension = manila.api.contrib.standard_extensionsrootwrap_config = /etc/manila/rootwrap.confapi_paste_config = /etc/manila/api-paste.inishare_name_template = share-%s# Set scheduler driver with usage of filters. Recommended.scheduler_driver = manila.scheduler.drivers.filter.FilterScheduler# Set following opt toTrueto get more info in logging.debug = True[nova]# Only needed by generic or windows drivers, the only drivers# as of Mitaka that require it.username = novapassword = %password%project_domain_id = defaultproject_name = serviceuser_domain_id = defaultauth_url = http://127.0.0.1:5000auth_type = password[neutron]# Only needed when the networking drivers use nova and "generic" driver,# as used in this example.username = neutronpassword = %password%project_domain_id = defaultproject_name = serviceuser_domain_id = defaultauth_url = http://127.0.0.1:5000auth_type = password[cinder]# Only needed by generic or windows drivers, the only drivers# as of Mitaka that require it.username = cinderpassword = %password%project_domain_id = defaultproject_name = serviceuser_domain_id = defaultauth_url = http://127.0.0.1:5000auth_type = password[london]# This is custom opt group that is used for storing opts of share-service.# This one is used only when enabled using opt `enabled_share_backends`# from DEFAULT group.# Set usage of Generic driver which uses cinder as backend.share_driver = manila.share.drivers.generic.GenericShareDriver# Generic driver supports both driver modes - with and without handling# of share servers. So, we need to define explicitly which one we are# enabling using this driver.driver_handles_share_servers = True# Generic driver uses a glance image for building service VMs in nova.# The following options specify the image to use.# We use the latest build of [1].# [1] https://github.com/openstack/manila-image-elementsservice_instance_password = manilaservice_instance_user = manilaservice_image_name = manila-service-image# These will be used for keypair creation and inserted into service VMs.path_to_private_key = /home/stack/.ssh/id_rsapath_to_public_key = /home/stack/.ssh/id_rsa.pub# Custom name for share backend.share_backend_name = LONDON

3.6 数据库配置

为manila创建数据库:

$ mysql -u%DATABASE_USER% -p%DATABASE_PASSWORD% -h%MYSQL_HOST% -e "DROP DATABASE IF EXISTS manila;"$ mysql -u%DATABASE_USER% -p%DATABASE_PASSWORD% -h%MYSQL_HOST% -e "CREATE DATABASE manila CHARACTER SET utf8;"

创建manila的数据库表:

$ manila-manage db sync

下面是Mitaka版本的manila数据库表:

+--------------------------------------------+| Tables_in_manila                           |+--------------------------------------------+| alembic_version                            || availability_zones                         || cgsnapshot_members                         || cgsnapshots                                || consistency_group_share_type_mappings      || consistency_groups                         || drivers_private_data                       || network_allocations                        || project_user_quotas                        || quota_classes                              || quota_usages                               || quotas                                     || reservations                               || security_services                          || services                                   || share_access_map                           || share_instance_access_map                  || share_instance_export_locations            || share_instance_export_locations_metadata   || share_instances                            || share_metadata                             || share_network_security_service_association || share_networks                             || share_server_backend_details               || share_servers                              || share_snapshot_instances                   || share_snapshots                            || share_type_extra_specs                     || share_type_projects                        || share_types                                || shares                                     |+--------------------------------------------+

3.7 运行manila服务

首先运行manila-api服务:

$ manila-api --config-file /etc/manila/manila.conf & echo $! >/opt/stack/status/stack/m-api.pid; fg || echo "m-api failed to start" | tee "/opt/stack/status/stack/m-api.failure"

在运行manila-share服务之前, 创建一个默认的share type:

$ manila type-create default_share_type True

其中, default_share_type是我们定义的share type名, True是必须的extra-spec driver_handles_share_servers的值. 以上是创建share type的必要参数.
结果:

+----------------------+-------------------------------------+| Property             | Value                               |+----------------------+-------------------------------------+| required_extra_specs | driver_handles_share_servers : True || Name                 | default_share_type                  || Visibility           | public                              || is_default           | -                                   || ID                   | %some_id%                           || optional_extra_specs | snapshot_support : True             |+----------------------+-------------------------------------+

manila-api服务可能需要重启来更新默认share type的信息. 重启后manila-api后, 通过以下指令查看share type列表:

$ manila type-list

结果:

+-----------+--------------------+------------+------------+-------------------------------------+-------------------------+| ID        | Name               | visibility | is_default | required_extra_specs                | optional_extra_specs    |+-----------+--------------------+------------+------------+-------------------------------------+-------------------------+| %some_id% | default_share_type | public     | YES        | driver_handles_share_servers : True | snapshot_support : True |+-----------+--------------------+------------+------------+-------------------------------------+-------------------------+

增加额外的extra specs可以使用以下指令:

$ manila type-key default_share_type set key=value

以下指令可以查看extra specs:

$ manila extra-specs-list

运行manila-scheduler:

manila-scheduler --config-file /etc/manila/manila.conf & echo $! >/opt/stack/status/stack/m-sch.pid; fg || echo "m-sch failed to start" | tee "/opt/stack/status/stack/m-sch.failure"

运行manila-share:

manila-share --config-file /etc/manila/manila.conf & echo $! >/opt/stack/status/stack/m-shr.pid; fg || echo "m-shr failed to start" | tee "/opt/stack/status/stack/m-shr.failure"

运行manila-data:

manila-data --config-file /etc/manila/manila.conf & echo $! >/opt/stack/status/stack/m-dat.pid; fg || echo "m-dat failed to start" | tee "/opt/stack/status/stack/m-dat.failure"

3.8 尝试创建共享

在这一步, 我们假设以下服务已经运行:

  • keystone
  • nova (used by Generic driver, not strict dependency of manila)
  • neutron (default network backend for Generic driver, used when driver handles share servers)
  • cinder (used by Generic driver)

为了使用一个自己管理share servers的驱动, 首先我们必须创建一个share network, 它包括创建share server时需要的网络信息. 在我们的例子中, 我们使用neutron:

$ neutron net-list

记录一个上述操作返回的neutron网络和它对应的子网.

Note

Some configurations of the Generic driver may require this network be attached to a public router. It is so by default. So, if you use the default configuration of Generic driver, make sure the network is attached to a public router.

然后使用上述neutron网络ID和它子网ID定义一个share network:

$ manila share-network-create \    --name test_share_network \    --neutron-net-id %id_of_neutron_network% \    --neutron-subnet-id %id_of_network_subnet%

现在我们可以创建一个share:

$ manila create NFS 1 --name testshare --share-network test_share_network

上述指令会让manila去调度(schedule)创建一个share. 一旦创建完毕, 用户就可以挂载它. 我们给所有的IP地址赋予读写这个share的权限:

$ manila access-allow testshare ip 0.0.0.0/0 --access-level rw

查看share的位置:

# manila share-export-location-list testshare+--------------------------------------+--------------------------------------------------------+-----------+| ID                                   | Path                                                   | Preferred |+--------------------------------------+--------------------------------------------------------+-----------+| 6921e862-88bc-49a5-a2df-efeed9acd583 | 10.0.0.3:/share-e1c2d35e-fe67-4028-ad7a-45f668732b1d   | False     || b6bd76ce-12a2-42a9-a30a-8a43b503867d | 10.254.0.3:/share-e1c2d35e-fe67-4028-ad7a-45f668732b1d | False     |+--------------------------------------+--------------------------------------------------------+-----------+

4. Configure multiple back ends

管理员可以通过配置, 让manila通过多个存储后端来提供shares. 每一个存储后端都有该存储供应商提供的manila驱动API.

每个存储后端都有一个对应的配置组, 配置组里的share_backend_name定义了存储后端的名字.

管理员可以为share type明确地指定所对应的存储后端. 为share type设定extra spec share_backend_name, 其值为这个存储后端在配置文件中给出的名字. 当manila-scheduler收到分配请求时, 查看请求中的share type及其extr spec信息, 它会选择可以满足这个share type要求的存储后端 (假设所有其它的调度条件都满足).

manila.conf文件的enabled_share_backends对应着多个后端存储. 每个enabled_share_backends的值都是一个后端存储, 都对应着一个配置组.

以下示例配置了五个后端存储:

[DEFAULT]enabled_share_backends=backendEMC1,backendEMC2,backendGeneric1,backendGeneric2,backendNetApp[backendEMC1]share_driver=manila.share.drivers.emc.driver.EMCShareDrivershare_backend_name=backendEMC1emc_share_backend=vnxemc_nas_server=1.1.1.1emc_nas_password=passwordemc_nas_login=useremc_nas_server_container=server_2emc_nas_pool_name="Pool 1"[backendEMC2]share_driver=manila.share.drivers.emc.driver.EMCShareDrivershare_backend_name=backendEMC2emc_share_backend=vnxemc_nas_server=1.1.1.1emc_nas_password=passwordemc_nas_login=useremc_nas_server_container=server_3emc_nas_pool_name="Pool 2"[backendGeneric1]share_driver=manila.share.drivers.generic.GenericShareDrivershare_backend_name=one_name_for_two_backendsservice_instance_user=ubuntu_userservice_instance_password=ubuntu_user_passwordservice_image_name=ubuntu_image_namepath_to_private_key=/home/foouser/.ssh/id_rsapath_to_public_key=/home/foouser/.ssh/id_rsa.pub[backendGeneric2]share_driver=manila.share.drivers.generic.GenericShareDrivershare_backend_name=one_name_for_two_backendsservice_instance_user=centos_userservice_instance_password=centos_user_passwordservice_image_name=centos_image_namepath_to_private_key=/home/baruser/.ssh/id_rsapath_to_public_key=/home/baruser/.ssh/id_rsa.pub[backendNetApp]share_driver = manila.share.drivers.netapp.common.NetAppDriverdriver_handles_share_servers = Trueshare_backend_name=backendNetAppnetapp_login=usernetapp_password=passwordnetapp_server_hostname=1.1.1.1netapp_root_volume_aggregate=aggr01

5. Manila Network Plugins

manila架构为网络资源分配定义了一个抽象层, 它提供了很多网络插件, 允许管理员从各式的选项中选择如何为租户的网络存储分配网络资源. 这个章节描述了如何配置和使用网络插件.

5.1 What is a network plugin in Manila?

网络插件是一个使用了特定组件 (如Neutron或Nova network) 的python类, 它为manila-share服务提供了网络资源.

5.2 When to use a network plugin?

manila驱动可能配置在一种或者两种模式: 它自己管理share servers的生命周期, 或者它仅仅只是提供事先已经配置好的share server上的存储资源. 配置文件里的driver_handles_share_servers选项决定了驱动使用的模式. 只有当驱动自己来管理share servers时, 网络插件才有用.

Note

不是所有的驱动都支持两种模式. 每一个驱动必须给出它所支持的模式.

driver_handles_share_servers=True时, 会调用驱动使用share network的信息来创建share servers. 这个信息会被提供给其中一个可用的网络插件, 这个网络插件会保存, 创建和删除包括IP地址, 网络接口在内的网络资源.

作为一个例外, 任何使用Nova来创建share servers的驱动必须在网络插件上使用一些wrapper, 因为Nova为它的虚拟机管理网络资源的创建. 在Manila的Kilo版本, only the Generic driver uses Nova with the help of its own network helpers, which serve the same needs but are related only to this share driver.

5.3 What network plugins are available?

Manila包括三种不同的网络插件和五种python类:

(1) 针对Neutron的网络插件.

它支持任何Neutron支持的网络隔离. 由驱动决定支持的网络隔离类型, 至少一种:

  • (1.1) manila.network.neutron.neutron_network_plugin.NeutronNetworkPlugin.
    这是默认的网络插件. 它要求定义share network时提供neutron_net_idneutron_subnet_id, 这个share network将被用于创建share servers. 用户可能定义任意数量的share network, 对应到租户环境的不同的网段.
  • (1.2) manila.network.neutron.neutron_network_plugin.NeutronSingleNetworkPlugin.
    这是前一种情况的简化版. 它从manila配置文件中接收neutron_net_idneutron_subnet_id, 所有的share servers都创建在一个网络.
  • (1.3) manila.network.neutron.neutron_network_plugin.NeutronBindNetworkPlugin.
    This driver waits for active binding and fails if a Neutron port can’t be bound or an error occurs. This plugin is useful for agent based binding (like OVS with docker driver) and fabric binding where real HW reconfiguration is taking place. The existing NeutronBindSingleNetworkPlugin is a combination of (1.2) and (1.3).

When only a single network is needed, the NeutronSingleNetworkPlugin (1.2) is a simple solution. Otherwise NeutronNetworkPlugin (1.1) should be chosen.

(2) 针对Nova network的网络插件.

它支持flat networks 或 VLAN-segmented 网络.

  • (2.1) manila.network.nova_network_plugin.NovaNetworkPlugin.
    这个插件适用于当配置了Nova network而不是Neutron. 它要求nova_net_id参数.
  • (2.2) manila.network.nova_network_plugin.NovaSingleNetworkPlugin.
    这个插件与(2.1)只有一个地方不同. 它从配置文件中获得nova_net_id, 所有的share servers都创建在一个网络.

When only a single network is needed, the NovaSingleNetworkPlugin (2.2) is a simple solution. Otherwise NovaNetworkPlugin (1.1) should be chosen.

(3) 针对Openstack网络服务以外的网络的网络插件


  • (3.1) manila.network.standalone_network_plugin.StandaloneNetworkPlugin.
    这个插件使用了一个事先存在的, 可被manila-share主机使用的网络. 这个网络可能被Openstack管理, 或者使用其它方式独立创建. 这个插件支持任何类型的网络, flat或segmented. 综上, 这种情况完全由驱动来决定支持的网络类型 (配置网络插件的目的就是选择网络类型, 这种情况下网络类型就完全由驱动决定了).

Note

这些网络插件在Kilo版本被引入. 在Juno版本, 只有NeutronNetworkPlugin可用. (1.2), (2.2)和(3.1)三种情况都忽视了用户在share_network的配置, 总是从一个单独的网络提供IP.

5.4 Approaches for setup of network plugins

每一个manila-share服务可能有它自己的网络插件, 或者是和其它服务共用的网络插件. 所有关于网络插件的配置选项可以按优先级以三种方式设定:

(1) 使用一个单独的配置组.
这种情况必须在manila-share服务 (也就是对应的backend) 的配置组中定义配置选项network_config_group. 该选项的值也就是网络插件的配置信息所在的配置组的组名. 优先级最高. 章节5.5有示例.
(2) 在manila-share服务的配置组里定义. 第二优先级.
(3) 在[DEFAULT]配置组里定义. 优先级最低.

启用某一个网络插件, 必须设定配置选项network_api_class, 其值为章节”5.3 What network plugins are available?”中的那五种网络插件中的一种. This option can be defined in any of the approaches above along with options for the network plugin itself.

5.5 Example of network plugin configuration

以下示例配置了三种manila-share服务, 它们使用了不同的方式来配置网络插件.
如前面所述, Kilo版本有五种网络插件, 其中的三种, (1.2), (2.2) 和 (3.1)需要配置选项. 下面给出的例子使用了网络插件(1.2) NeutronSingleNetworkPlugin.

配置文件如下:

[DEFAULT]enabled_share_backends = SHARE_BACKEND_1,SHARE_BACKEND_2,SHARE_BACKEND_3network_api_class = manila.network.neutron.neutron_network_plugin.NeutronSingleNetworkPlugin # 即(1.2)所对应的python类neutron_net_id = neutron_net_id_DEFAULTneutron_subnet_id = neutron_subnet_id_DEFAULT[NETWORK_PLUGIN]neutron_net_id = neutron_net_id_NETWORK_PLUGINneutron_subnet_id = neutron_subnet_id_NETWORK_PLUGIN[SHARE_BACKEND_1]# This share backend is enabled for handling of share servers using opts# for network plugin defined in separate config group called `NETWORK_PLUGIN`.network_config_group = NETWORK_PLUGINdriver_handles_share_servers = True[SHARE_BACKEND_2]# This share backend is enabled for handling of share servers using opts# defined in its own config group.driver_handles_share_servers = Trueneutron_net_id = neutron_net_id_SHARE_BACKEND_2neutron_subnet_id = neutron_subnet_id_SHARE_BACKEND_2[SHARE_BACKEND_3]# This share backend is enabled for handling of share servers using opts# defined in config group [DEFAULT].driver_handles_share_servers = True

Here is a list of neutron_net_id and neutron_subnet_id values for our manila-share services:
三个manila-share服务的neutron_net_idneutron_subnet_id值如下:

[SHARE_BACKEND_1] # 使用第一优先级neutron_net_id=neutron_net_id_NETWORK_PLUGINneutron_subnet_id=neutron_subnet_id_NETWORK_PLUGIN[SHARE_BACKEND_2] # 使用第二优先级neutron_net_id=neutron_net_idSHARE_BACKEND_2neutron_subnet_id=neutron_subnet_id_SHARE_BACKEND_2[SHARE_BACKEND_3] # 使用最低优先级neutron_net_id=neutron_net_id_DEFAULTneutron_subnet_id=neutron_subnet_id_DEFAULT

所有manila-share服务的network_api_class选项的值使用[DEFAULT]中的值, 因为在别的位置没有定义这个值.

Note

不推荐使用最低优先级的方式, 如果选择了这种方式manila-share日志会产生警告. 推荐使用第一和第二优先级的方式.

1 0