From ee65c76a278dd2fa95d8f799f656ace40c777b30 Mon Sep 17 00:00:00 2001 From: Jan Provaznik Date: Mon, 20 Nov 2017 20:36:59 +0100 Subject: [PATCH] Add a StorageNFS network for use by Manila/Ganesha This change adds a StorageNFS network. It's required by https://review.openstack.org/#/c/471245 which implements NFS Ganesha backend for Manila service. To define and enable the StorageNFS network, deploy using network_data_ganesha.yaml instead of network_data.yaml. Besides the former adding the StorageNFS network, these are otherwise identical. If enabled it's also necessary to add StorageNFSIpSubnet and StorageNFSNetworkVlanID heat parameters into network templates. Co-Authored-By: Dan Sneddon Change-Id: If31722d669efe91082c93ecb815e6c41676480c8 Partially-Implements: blueprint nfs-ganesha --- .../net-config-multinode-os-net-config.yaml | 4 + ci/common/net-config-multinode.yaml | 4 + network/service_net_map.j2.yaml | 1 + network_data_ganesha.yaml | 102 ++++++++++++++++++ tools/yaml-validate.py | 19 ++++ 5 files changed, 130 insertions(+) create mode 100644 network_data_ganesha.yaml diff --git a/ci/common/net-config-multinode-os-net-config.yaml b/ci/common/net-config-multinode-os-net-config.yaml index f72bc8938f..315594e7ea 100644 --- a/ci/common/net-config-multinode-os-net-config.yaml +++ b/ci/common/net-config-multinode-os-net-config.yaml @@ -25,6 +25,10 @@ parameters: default: '' description: IP address/subnet on the storage_mgmt network type: string + StorageNFSIpSubnet: + default: '' + description: IP address/subnet on the storage_nfs network + type: string TenantIpSubnet: default: '' description: IP address/subnet on the tenant network diff --git a/ci/common/net-config-multinode.yaml b/ci/common/net-config-multinode.yaml index 02b9507aaf..5cbf20e85e 100644 --- a/ci/common/net-config-multinode.yaml +++ b/ci/common/net-config-multinode.yaml @@ -25,6 +25,10 @@ parameters: default: '' description: IP address/subnet on the storage_mgmt network type: string + StorageNFSIpSubnet: + default: '' + description: IP address/subnet on the storage_nfs network + type: string TenantIpSubnet: default: '' description: IP address/subnet on the tenant network diff --git a/network/service_net_map.j2.yaml b/network/service_net_map.j2.yaml index 7d736d2e1b..32c4a8b963 100644 --- a/network/service_net_map.j2.yaml +++ b/network/service_net_map.j2.yaml @@ -63,6 +63,7 @@ parameters: RabbitmqNetwork: internal_api QdrNetwork: internal_api RedisNetwork: internal_api + GaneshaNetwork: storage_nfs MysqlNetwork: internal_api CephClusterNetwork: storage_mgmt CephMonNetwork: storage diff --git a/network_data_ganesha.yaml b/network_data_ganesha.yaml new file mode 100644 index 0000000000..8e2df2b9b5 --- /dev/null +++ b/network_data_ganesha.yaml @@ -0,0 +1,102 @@ +# Like network_data.yaml but adds and enables StorageNFS network, +# used by manila with ceph-NFS back end. +# +## List of networks, used for j2 templating of enabled networks +# +# Supported values: +# +# name: Name of the network (mandatory) +# name_lower: lowercase version of name used for filenames +# (optional, defaults to name.lower()) +# enabled: Is the network enabled (optional, defaults to true) +# vlan: vlan for the network (optional) +# vip: Enable creation of a virtual IP on this network +# ip_subnet: IP/CIDR, e.g. '192.168.24.0/24' or '2001:db8:fd00:1000::/64' +# (optional, may use parameter defaults instead) +# allocation_pools: IP range list e.g. [{'start':'10.0.0.4', 'end':'10.0.0.250'}] +# gateway_ip: gateway for the network (optional, may use parameter defaults) +# ipv6_subnet: Optional, sets default IPv6 subnet if IPv4 is already defined. +# ipv6_allocation_pools: Set default IPv6 allocation pools if IPv4 allocation pools +# are already defined. +# ipv6_gateway: Set an IPv6 gateway if IPv4 gateway already defined. +# ipv6: If ip_subnet not defined, this specifies that the network is IPv6-only. +# NOTE: IP-related values set parameter defaults in templates, may be overridden, +# either by operators, or e.g in environments/network-isolation-v6.yaml where we +# set some default IPv6 addresses. +# compat_name: for existing stack you may need to override the default +# transformation for the resource's name. +# +# Example: +# - name Example +# vip: false +# ip_subnet: '10.0.2.0/24' +# allocation_pools: [{'start': '10.0.2.4', 'end': '10.0.2.250'}] +# gateway_ip: '10.0.2.254' +# +# To support backward compatility, two versions of the network definitions will +# be created, network/.yaml and network/_v6.yaml. Only +# one of these files may be used in the deployment at a time, since the +# parameters used for configuration are the same in both files. In the +# future, this behavior may be changed to create only one file for custom +# networks. You may specify IPv6 addresses for ip_subnet, allocation_pools, +# and gateway_ip if no IPv4 addresses are used for a custom network, or set +# ipv6: true, and the network/.yaml file will be configured as IPv6. +# +# For configuring both IPv4 and IPv6 on the same interface, use two separate +# networks, and then assign both IPs in the custom NIC configuration templates. + +- name: External + vip: true + name_lower: external + ip_subnet: '10.0.0.0/24' + allocation_pools: [{'start': '10.0.0.4', 'end': '10.0.0.250'}] + gateway_ip: '10.0.0.1' + ipv6_subnet: '2001:db8:fd00:1000::/64' + ipv6_allocation_pools: [{'start': '2001:db8:fd00:1000::10', 'end': '2001:db8:fd00:1000:ffff:ffff:ffff:fffe'}] + gateway_ipv6: '2001:db8:fd00:1000::1' +- name: InternalApi + name_lower: internal_api + vip: true + ip_subnet: '172.16.2.0/24' + allocation_pools: [{'start': '172.16.2.4', 'end': '172.16.2.250'}] + ipv6_subnet: 'fd00:fd00:fd00:2000::/64' + ipv6_allocation_pools: [{'start': 'fd00:fd00:fd00:2000::10', 'end': 'fd00:fd00:fd00:2000:ffff:ffff:ffff:fffe'}] +- name: Storage + vip: true + name_lower: storage + ip_subnet: '172.16.1.0/24' + allocation_pools: [{'start': '172.16.1.4', 'end': '172.16.1.250'}] + ipv6_subnet: 'fd00:fd00:fd00:3000::/64' + ipv6_allocation_pools: [{'start': 'fd00:fd00:fd00:3000::10', 'end': 'fd00:fd00:fd00:3000:ffff:ffff:ffff:fffe'}] +- name: StorageMgmt + name_lower: storage_mgmt + vip: true + ip_subnet: '172.16.3.0/24' + allocation_pools: [{'start': '172.16.3.4', 'end': '172.16.3.250'}] + ipv6_subnet: 'fd00:fd00:fd00:4000::/64' + ipv6_allocation_pools: [{'start': 'fd00:fd00:fd00:4000::10', 'end': 'fd00:fd00:fd00:4000:ffff:ffff:ffff:fffe'}] +- name: Tenant + vip: false # Tenant network does not use VIPs + name_lower: tenant + ip_subnet: '172.16.0.0/24' + allocation_pools: [{'start': '172.16.0.4', 'end': '172.16.0.250'}] + ipv6_subnet: 'fd00:fd00:fd00:5000::/64' + ipv6_allocation_pools: [{'start': 'fd00:fd00:fd00:5000::10', 'end': 'fd00:fd00:fd00:5000:ffff:ffff:ffff:fffe'}] +- name: Management + # Management network is enabled by default for backwards-compatibility, but + # is not included in any roles by default. Add to role definitions to use. + enabled: true + vip: false # Management network does not use VIPs + name_lower: management + ip_subnet: '10.0.1.0/24' + allocation_pools: [{'start': '10.0.1.4', 'end': '10.0.1.250'}] + ipv6_subnet: 'fd00:fd00:fd00:6000::/64' + ipv6_allocation_pools: [{'start': 'fd00:fd00:fd00:6000::10', 'end': 'fd00:fd00:fd00:6000:ffff:ffff:ffff:fffe'}] +- name: StorageNFS + enabled: true + vip: true + name_lower: storage_nfs + ip_subnet: '172.16.4.0/24' + allocation_pools: [{'start': '172.16.4.4', 'end': '172.16.4.250'}] + ipv6_subnet: 'fd00:fd00:fd00:7000::/64' + ipv6_allocation_pools: [{'start': 'fd00:fd00:fd00:7000::10', 'end': 'fd00:fd00:fd00:7000:ffff:ffff:ffff:fffe'}] diff --git a/tools/yaml-validate.py b/tools/yaml-validate.py index 97f6b98a80..29a41b9ccb 100755 --- a/tools/yaml-validate.py +++ b/tools/yaml-validate.py @@ -708,6 +708,9 @@ def validate(filename, param_map): if filename.startswith('./roles/ControllerNoCeph.yaml'): retval = validate_controller_no_ceph_role(filename, tpl) + if filename.startswith('./network_data_'): + retval = validate_network_data_file(filename) + except Exception: print(traceback.format_exc()) return 1 @@ -754,6 +757,22 @@ def validate_upgrade_tasks(upgrade_tasks): 'step|int == \' condition (%s)' % (task_name, task)) return 0 +def validate_network_data_file(data_file_path): + try: + data_file = yaml.load(open(data_file_path).read()) + base_file_path = os.path.dirname(data_file_path) + "/network_data.yaml" + base_file = yaml.load(open(base_file_path).read()) + for n in base_file: + if n not in data_file: + print('ERROR: The following network from network_data.yaml is ' + 'missing or differs in %s : %s' + % (data_file_path, n)) + return 1 + except Exception: + print(traceback.format_exc()) + return 1 + return 0 + def parse_args(): p = argparse.ArgumentParser()