7.5. 连接到共享网络以访问共享
当 driver_handles_share_servers 参数等于 false 时,共享将导出到管理员提供的共享提供商网络。作为最终用户,您必须将客户端(如 Compute 实例)连接到共享提供商网络,以访问您的共享。
在本例中,共享提供商网络名为 StorageNFS。当 director 通过 NFS 后端使用 CephFS 部署共享文件系统服务时,StorageNFS 会被配置。按照类似的步骤连接到您的云管理员提供的网络。
注意
在示例中,客户端的 IP 地址系列版本不重要。此流程中的步骤使用 IPv4 地址,但步骤与 IPv6 相同。
流程
为 StorageNFS 端口创建一个安全组,允许数据包出口端口,但不允许入口数据包从未建立的连接中:
(user) $ openstack security group create no-ingress -f yaml created_at: '2018-09-19T08:19:58Z' description: no-ingress id: 66f67c24-cd8b-45e2-b60f-9eaedc79e3c5 name: no-ingress project_id: 1e021e8b322a40968484e1af538b8b63 revision_number: 2 rules: 'created_at=''2018-09-19T08:19:58Z'', direction=''egress'', ethertype=''IPv4'', id=''6c7f643f-3715-4df5-9fef-0850fb6eaaf2'', updated_at=''2018-09-19T08:19:58Z'' created_at=''2018-09-19T08:19:58Z'', direction=''egress'', ethertype=''IPv6'', id=''a8ca1ac2-fbe5-40e9-ab67-3e55b7a8632a'', updated_at=''2018-09-19T08:19:58Z''' updated_at: '2018-09-19T08:19:58Z'在 StorageNFS 网络中创建一个端口,其安全性由
no-ingress安全组强制使用。(user) $ openstack port create nfs-port0 --network StorageNFS --security-group no-ingress -f yaml admin_state_up: UP allowed_address_pairs: '' binding_host_id: null binding_profile: null binding_vif_details: null binding_vif_type: null binding_vnic_type: normal created_at: '2018-09-19T08:03:02Z' data_plane_status: null description: '' device_id: '' device_owner: '' dns_assignment: null dns_name: null extra_dhcp_opts: '' fixed_ips: ip_address='172.17.5.160', subnet_id='7bc188ae-aab3-425b-a894-863e4b664192' id: 7a91cbbc-8821-4d20-a24c-99c07178e5f7 ip_address: null mac_address: fa:16:3e:be:41:6f name: nfs-port0 network_id: cb2cbc5f-ea92-4c2d-beb8-d9b10e10efae option_name: null option_value: null port_security_enabled: true project_id: 1e021e8b322a40968484e1af538b8b63 qos_policy_id: null revision_number: 6 security_group_ids: 66f67c24-cd8b-45e2-b60f-9eaedc79e3c5 status: DOWN subnet_id: null tags: '' trunk_details: null updated_at: '2018-09-19T08:03:03Z'注意StorageNFSSubnet将 IP 地址 172.17.5.160 分配给nfs-port0。将
nfs-port0添加到 Compute 实例。(user) $ openstack server add port instance0 nfs-port0 (user) $ openstack server list -f yaml - Flavor: m1.micro ID: 0b878c11-e791-434b-ab63-274ecfc957e8 Image: manila-test Name: demo-instance0 Networks: demo-network=172.20.0.4, 10.0.0.53; StorageNFS=172.17.5.160 Status: ACTIVE除了其专用和浮动地址外,计算实例还在 StorageNFS 网络上为具有 IP 地址 172.17.5.160 的端口分配,当向该地址授予相关共享的访问权限时,可以使用该端口挂载 NFS 共享。
注意您可能需要调整计算实例上的网络配置,再重启 Compute 实例的服务来激活具有此地址的接口。