4.11. 使用共享文件系统服务


Red Hat OpenStack Services on OpenShift (RHOSO)中的共享文件系统服务(manila)提供了一个自助服务 API 来创建和管理文件共享。文件共享(或"共享")是为从多个客户端进行并发读写访问而构建的。这使得共享文件系统服务在需要 ReadWriteMany 持久性存储的云环境中至关重要。

RHOSO 中的文件共享需要网络访问。在采用后,确保 Red Hat OpenStack Platform (RHOSP) 17.1 环境中的网络与您的新云的网络计划匹配。这样可确保租户工作负载在采用过程中保持连接到存储。共享文件系统服务 control plane 服务不在数据路径中。关闭 API、调度程序和共享管理器服务不会影响对现有共享文件系统的访问。

通常,存储和存储设备管理是独立的网络。共享文件系统服务只需要访问存储设备管理网络。例如,如果您在部署中使用了 Red Hat Ceph Storage 集群,"storage"网络指的是 Red Hat Ceph Storage 集群的公共网络,并且共享文件系统服务的共享管理器服务需要能够访问它。

共享文件系统服务支持以下存储网络场景:

  • 您可以直接控制相应文件共享的网络。
  • RHOSO 管理员配置存储网络。

4.11.1. 准备共享文件系统服务配置的指南

要在 control plane 上部署共享文件系统服务(manila),您必须从 Red Hat OpenStack Platform 17.1 部署中复制原始配置文件。您必须检查文件中的内容,以确保您在 OpenShift (RHOSO) 18.0 上为 Red Hat OpenStack Services 采用正确的配置。并非所有内容都需要引入新的云环境。

查看以下准则,以准备您的共享文件系统服务配置文件进行采用:

  • 共享文件系统服务 operator 设置以下配置,并可以忽略:

    • 与数据库相关的配置([database])
    • 服务身份验证(auth_strategy,[keystone_authtoken])
    • 消息总线配置(transport_urlcontrol_exchange)
    • 默认粘贴配置(api_paste_config)
    • Inter-service communication configuration ([neutron], [nova], [cinder], [glance] [oslo_messagingvdsm])
  • 忽略 osapi_share_listen 配置。在 OpenShift 上的 Red Hat OpenStack Services (RHOSO) 18.0 中,您依赖 Red Hat OpenShift Container Platform (RHOCP)路由和入口。
  • 检查策略覆盖。在 RHOSO 18.0 中,共享文件系统服务附带安全默认的基于角色的访问控制(RBAC),且可能不需要覆盖。
  • 如果需要自定义策略,则必须将其作为 ConfigMap 提供。以下示例 spec 演示了如何使用名为 policy.yaml 的文件设置名为 manila-policyConfigMap

      spec:
        manila:
          enabled: true
          template:
            manilaAPI:
              customServiceConfig: |
                 [oslo_policy]
                 policy_file=/etc/manila/policy.yaml
            extraMounts:
            - extraVol:
              - extraVolType: Undefined
                mounts:
                - mountPath: /etc/manila/
                  name: policy
                  readOnly: true
                propagation:
                - ManilaAPI
                volumes:
                - name: policy
                  projected:
                    sources:
                    - configMap:
                        name: manila-policy
                        items:
                          - key: policy
                            path: policy.yaml
    Copy to Clipboard Toggle word wrap
  • [DEFAULT] 部分下的 host 选项的值必须是 hostgroup
  • 要运行共享文件系统服务 API 服务,您必须将 enabled_share_protocols 选项添加到 manila: template: manilaAPIcustomServiceConfig 部分。
  • 如果您有调度程序覆盖,请将它们添加到 manila: template: manilaScheduler 中的 customServiceConfig 部分。
  • 如果您使用 RHOSP 17.1 配置多个存储后端驱动程序,则需要在部署 RHOSO 18.0 时分割它们。每个存储后端驱动程序都需要使用自己的 manila-share 服务实例。
  • 如果存储后端驱动程序需要自定义容器镜像,请在 Red Hat Ecosystem Catalog 中找到它,并创建或修改 OpenStackVersion 自定义资源(CR),以使用相同的自定义名称来指定 自定义镜像

    以下示例显示了 OpenStackControlPlane CR 中的 manila spec,其中包含多个存储后端驱动程序,其中只有一个使用自定义容器镜像:

      spec:
        manila:
          enabled: true
          template:
            manilaAPI:
              customServiceConfig: |
                [DEFAULT]
                enabled_share_protocols = nfs
              replicas: 3
            manilaScheduler:
              replicas: 3
            manilaShares:
             netapp:
               customServiceConfig: |
                 [DEFAULT]
                 debug = true
                 enabled_share_backends = netapp
                 host = hostgroup
                 [netapp]
                 driver_handles_share_servers = False
                 share_backend_name = netapp
                 share_driver = manila.share.drivers.netapp.common.NetAppDriver
                 netapp_storage_family = ontap_cluster
                 netapp_transport_type = http
               replicas: 1
             pure:
                customServiceConfig: |
                 [DEFAULT]
                 debug = true
                 enabled_share_backends=pure-1
                 host = hostgroup
                 [pure-1]
                 driver_handles_share_servers = False
                 share_backend_name = pure-1
                 share_driver = manila.share.drivers.purestorage.flashblade.FlashBladeShareDriver
                 flashblade_mgmt_vip = 203.0.113.15
                 flashblade_data_vip = 203.0.10.14
                replicas: 1
    Copy to Clipboard Toggle word wrap

    以下示例显示了定义自定义容器镜像的 OpenStackVersion CR:

    apiVersion: core.openstack.org/v1beta1
    kind: OpenStackVersion
    metadata:
      name: openstack
    spec:
      customContainerImages:
        cinderVolumeImages:
          pure: registry.connect.redhat.com/purestorage/openstack-manila-share-pure-rhosp-18-0
    Copy to Clipboard Toggle word wrap

    OpenStackVersion CR 的名称必须与 OpenStackControlPlane CR 的名称匹配。

  • 如果您提供敏感信息,如密码、主机名和用户名,请使用 RHOCP secret 和 customServiceConfigSecrets 密钥。您可以在任意服务中使用 customConfigSecrets。如果您使用需要凭证的第三方存储,请使用 customServiceConfigSecrets 密钥在 manila CR/patch 文件中创建一个 secret。例如:

    1. 创建包含 secret 的文件,如 netapp_secrets.conf

      $ cat << __EOF__ > ~/netapp_secrets.conf
      
      [netapp]
      netapp_server_hostname = 203.0.113.10
      netapp_login = fancy_netapp_user
      netapp_password = secret_netapp_password
      netapp_vserver = mydatavserver
      __EOF__
      Copy to Clipboard Toggle word wrap
      $ oc create secret generic osp-secret-manila-netapp --from-file=~/<secret>
      Copy to Clipboard Toggle word wrap
      • <secret > 替换为包含 secret 的文件名称,如 netapp_secrets.conf
    2. 将 secret 添加到 customServiceConfigSecrets 部分中的任何共享文件系统服务文件中。以下示例将 osp-secret-manila-netapp secret 添加到 manilaShares 服务中:

        spec:
          manila:
            enabled: true
            template:
              < . . . >
              manilaShares:
               netapp:
                 customServiceConfig: |
                   [DEFAULT]
                   debug = true
                   enabled_share_backends = netapp
                   host = hostgroup
                   [netapp]
                   driver_handles_share_servers = False
                   share_backend_name = netapp
                   share_driver = manila.share.drivers.netapp.common.NetAppDriver
                   netapp_storage_family = ontap_cluster
                   netapp_transport_type = http
                 customServiceConfigSecrets:
                   - osp-secret-manila-netapp
                 replicas: 1
          < . . . >
      Copy to Clipboard Toggle word wrap

4.11.2. 在 control plane 上部署共享文件系统服务

从 Red Hat OpenStack Platform (RHOSP) 17.1 部署中复制共享文件系统服务(manila)配置,然后在 control plane 上部署共享文件系统服务。

先决条件

  • 共享文件系统服务 systemd 服务(如 apicron调度程序 )会停止。如需更多信息,请参阅 停止 Red Hat OpenStack Platform 服务
  • 如果部署通过 NFS 将 CephFS 用作存储后端,则调整 Pacemaker 排序和并置限制。如需更多信息,请参阅 停止 Red Hat OpenStack Platform 服务
  • 共享文件系统服务 Pacemaker 服务 Pacemaker 服务(openstack-manila-share)已停止。如需更多信息,请参阅 停止 Red Hat OpenStack Platform 服务
  • 数据库迁移已完成。如需更多信息,请参阅将 数据库迁移到 MariaDB 实例
  • 部署 manila-share 服务的 Red Hat OpenShift Container Platform (RHOCP)节点可以访问存储系统所在的管理网络。
  • 如果部署使用 NFS 作为存储后端,则可通过 Ceph 编排器在 Red Hat Ceph Storage 集群上部署一个新的集群的 Ceph NFS 服务。有关更多信息,请参阅创建 Ceph NFS 集群
  • 在采用共享文件系统服务(keystone)和 memcached 等服务之前,可以使用 Identity 服务(keystone)和 memcached 等服务。
  • 如果您通过设置 driver_handles_share_servers=True 来启用租户驱动的网络,则会部署 Networking 服务(neutron)。
  • CONTROLLER1_SSH 环境变量已定义,并指向 RHOSP 控制器节点。将以下示例值替换为您的环境的正确值:

    $ CONTROLLER1_SSH="ssh -i <path to SSH key> root@<node IP>"
    Copy to Clipboard Toggle word wrap

    流程

    1. 从 RHOSP 17.1 复制配置文件以供参考:

      $ CONTROLLER1_SSH cat /var/lib/config-data/puppet-generated/manila/etc/manila/manila.conf | awk '!/^ *#/ && NF' > ~/manila.conf
      Copy to Clipboard Toggle word wrap
    2. 查看配置文件以获取从 RHOSP 17.1 开始进行的配置更改。有关在 OpenShift 上为 Red Hat OpenStack Services (RHOSO)准备此文件的更多信息 ,请参阅指南准备共享文件系统服务配置
    3. OpenStackControlPlane CR 创建补丁文件,以部署共享文件系统服务。以下 manila.patch 文件示例使用原生 CephFS:

      $ cat << __EOF__ > ~/manila.patch
      spec:
        manila:
          enabled: true
          apiOverride:
            route: {}
          template:
            databaseInstance: openstack
            databaseAccount: manila
            secret: osp-secret
            manilaAPI:
              replicas: 3
              customServiceConfig: |
                [DEFAULT]
                enabled_share_protocols = cephfs
              override:
                service:
                  internal:
                    metadata:
                      annotations:
                        metallb.universe.tf/address-pool: internalapi
                        metallb.universe.tf/allow-shared-ip: internalapi
                        metallb.universe.tf/loadBalancerIPs: 172.17.0.80 
      1
      
                    spec:
                      type: LoadBalancer
            manilaScheduler:
              replicas: 3
            manilaShares:
              cephfs:
                replicas: 1
                customServiceConfig: |
                  [DEFAULT]
                  enabled_share_backends = tripleo_ceph
                  host = hostgroup
                  [cephfs]
                  driver_handles_share_servers=False
                  share_backend_name=cephfs 
      2
      
                  share_driver=manila.share.drivers.cephfs.driver.CephFSDriver
                  cephfs_conf_path=/etc/ceph/ceph.conf
                  cephfs_auth_id=openstack
                  cephfs_cluster_name=ceph
                  cephfs_volume_mode=0755
                  cephfs_protocol_helper_type=CEPHFS
                networkAttachments: 
      3
      
                    - storage
            extraMounts: 
      4
      
            - name: v1
              region: r1
              extraVol:
                - propagation:
                  - ManilaShare
                extraVolType: Ceph
                volumes:
                - name: ceph
                  secret:
                    secretName: ceph-conf-files
                mounts:
                - name: ceph
                  mountPath: "/etc/ceph"
                  readOnly: true
      __EOF__
      Copy to Clipboard Toggle word wrap
      1
      如果使用 IPv6,请将负载均衡器 IP 更改为环境中的负载均衡器 IP,如 metallb.universe.tf/loadBalancerIPs: fd00:bbbb::80
      2
      确保后端的名称(share_backend_name)与在 RHOSP 17.1 中相同。
      3
      确保在 networkAttachments 部分中指定适当的存储管理网络。例如,使用 CephFS 后端驱动程序的 manilaShares 实例连接到 存储网络
      4
      如果需要向任意服务添加额外的文件,您可以使用 extraMounts。例如,在使用 Red Hat Ceph Storage 时,您可以添加共享文件系统服务 Ceph 用户的 keyring 文件和 ceph.conf 配置文件。

      以下示例补丁文件通过 NFS 使用 CephFS:

      $ cat << __EOF__ > ~/manila.patch
      spec:
        manila:
          enabled: true
          apiOverride:
            route: {}
          template:
            databaseInstance: openstack
            secret: osp-secret
            manilaAPI:
              replicas: 3
              customServiceConfig: |
                [DEFAULT]
                enabled_share_protocols = cephfs
              override:
                service:
                  internal:
                    metadata:
                      annotations:
                        metallb.universe.tf/address-pool: internalapi
                        metallb.universe.tf/allow-shared-ip: internalapi
                        metallb.universe.tf/loadBalancerIPs: 172.17.0.80
                    spec:
                      type: LoadBalancer
            manilaScheduler:
              replicas: 3
            manilaShares:
              cephfs:
                replicas: 1
                customServiceConfig: |
                  [DEFAULT]
                  enabled_share_backends = cephfs
                  host = hostgroup
                  [cephfs]
                  driver_handles_share_servers=False
                  share_backend_name=tripleo_ceph
                  share_driver=manila.share.drivers.cephfs.driver.CephFSDriver
                  cephfs_conf_path=/etc/ceph/ceph.conf
                  cephfs_auth_id=openstack
                  cephfs_cluster_name=ceph
                  cephfs_protocol_helper_type=NFS
                  cephfs_nfs_cluster_id=cephfs
                  cephfs_ganesha_server_ip=172.17.5.47
                networkAttachments:
                    - storage
      __EOF__
      Copy to Clipboard Toggle word wrap
  • 在通过 NFS 将 manilaShares 服务用于 CephFS 之前,请确保创建了集群的 Ceph NFS 服务。服务的名称必须是 cephfs_nfs_cluster_idcephfs_nfs_cluster_id 选项使用在 Red Hat Ceph Storage 上创建的 NFS 集群的名称进行设置。
  • cephfs_ganesha_server_ip 选项从 RHOSP 17.1 环境中的配置保留。

    1. OpenStackControlPlane CR 进行补丁:

      $ oc patch openstackcontrolplane openstack --type=merge --patch-file=~/<manila.patch>
      Copy to Clipboard Toggle word wrap
  • <manila.patch > 替换为您的补丁文件的名称。

验证

  1. 检查生成的共享文件系统服务 pod:

    $ oc get pods -l service=manila
    Copy to Clipboard Toggle word wrap
  2. 检查共享文件系统服务(keystone)中是否已注册了共享文件系统服务(keystone):

    $ openstack service list | grep manila
    Copy to Clipboard Toggle word wrap
    $ openstack endpoint list | grep manila
    
    | 1164c70045d34b959e889846f9959c0e | regionOne | manila       | share        | True    | internal  | http://manila-internal.openstack.svc:8786/v1/%(project_id)s        |
    | 63e89296522d4b28a9af56586641590c | regionOne | manilav2     | sharev2      | True    | public    | https://manila-public-openstack.apps-crc.testing/v2                |
    | af36c57adcdf4d50b10f484b616764cc | regionOne | manila       | share        | True    | public    | https://manila-public-openstack.apps-crc.testing/v1/%(project_id)s |
    | d655b4390d7544a29ce4ea356cc2b547 | regionOne | manilav2     | sharev2      | True    | internal  | http://manila-internal.openstack.svc:8786/v2                       |
    Copy to Clipboard Toggle word wrap
  3. 测试服务的健康状况:

    $ openstack share service list
    $ openstack share pool list --detail
    Copy to Clipboard Toggle word wrap
  4. 检查现有工作负载:

    $ openstack share list
    $ openstack share snapshot list
    Copy to Clipboard Toggle word wrap
重要

本节中的内容 作为技术预览提供,因此不受红帽完全支持。它只应用于测试,不应部署在生产环境中。如需更多信息,请参阅 技术预览

如果您的部署通过 NFS 使用 CephFS,则必须停用 Red Hat OpenStack Platform (RHOSP)独立 NFS 服务。由于将来的软件升级不支持之前的 NFS 服务,因此请确保停用周期较短。

先决条件

  • 您可以通过查询共享文件系统服务 API 来识别现有共享的新导出位置。
  • 您卸载并重新挂载每个客户端上的共享文件系统,以使用之前的 NFS 服务器停止。
  • 如果您使用共享文件系统服务与 Red Hat OpenShift Container Platform (RHOCP)的共享文件系统服务 CSI 插件共享,您可以通过缩减应用程序 pod 并扩展它们来迁移共享。
注意

创建新工作负载的客户端无法使用通过以前的 NFS 服务导出的共享。共享文件系统服务不再与之前的 NFS 服务通信,且无法在之前的 NFS 服务中应用或更改导出规则。

流程

  1. manila-share 服务配置中删除 cephfs_ganesha_server_ip 选项:

    注意

    这会重启 manila-share 进程,并从所有共享中删除应用到之前 NFS 服务的导出位置。

    $ cat << __EOF__ > ~/manila.patch
    spec:
      manila:
        enabled: true
        apiOverride:
          route: {}
        template:
          manilaShares:
            cephfs:
              replicas: 1
              customServiceConfig: |
                [DEFAULT]
                enabled_share_backends = cephfs
                host = hostgroup
                [cephfs]
                driver_handles_share_servers=False
                share_backend_name=cephfs
                share_driver=manila.share.drivers.cephfs.driver.CephFSDriver
                cephfs_conf_path=/etc/ceph/ceph.conf
                cephfs_auth_id=openstack
                cephfs_cluster_name=ceph
                cephfs_protocol_helper_type=NFS
                cephfs_nfs_cluster_id=cephfs
              networkAttachments:
                  - storage
    __EOF__
    Copy to Clipboard Toggle word wrap
  2. OpenStackControlPlane 自定义资源进行补丁:

    $ oc patch openstackcontrolplane openstack --type=merge --patch-file=~/<manila.patch>
    Copy to Clipboard Toggle word wrap
    • <manila.patch > 替换为您的补丁文件的名称。
  3. 通过禁用和删除与服务关联的 Pacemaker 资源,从 RHOSP control plane 节点清理独立 ceph-nfs 服务:

    重要

    您可以延迟此步骤,直到 RHOSO 18.0 正常运行为止。在这个时间中,您无法弃用 Controller 节点。

    $ sudo pcs resource disable ceph-nfs
    $ sudo pcs resource disable ip-<VIP>
    $ sudo pcs resource unmanage ceph-nfs
    $ sudo pcs resource unmanage ip-<VIP>
    Copy to Clipboard Toggle word wrap
    • <VIP > 替换为分配给环境中 ceph-nfs 服务的 IP 地址。
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat