From d8b1d64add50da4a07f838b9730a3044be7a828d Mon Sep 17 00:00:00 2001
From: Tom Barron <tpb@dyncloud.net>
Date: Mon, 18 Dec 2017 19:47:29 -0500
Subject: [PATCH] Manila network plugin address family support

Set NetworkPluginIpv6Enabled if IPv6 networks
have been enabled.  Currently this parameter and
NetworkPluginIPv4Enabled are mutually exclusive so
set the latter false as well.  Default is IPv4
with NetworkPluginIPv4Enabled.

Depends-On: Ic7e5b5351e429755ba48613ab89d1b7e7d6e2d34
Change-Id: Ia895d7190f0fb8e97c87b3178461d9fc26393b9b
---
 .../multiple-nics-ipv6/network-isolation-absolute.yaml    | 2 ++
 .../network/multiple-nics-ipv6/network-isolation.yaml     | 1 +
 environments/network-isolation-v6.j2.yaml                 | 3 +++
 puppet/services/manila-base.yaml                          | 8 ++++++++
 4 files changed, 14 insertions(+)

diff --git a/ci/environments/network/multiple-nics-ipv6/network-isolation-absolute.yaml b/ci/environments/network/multiple-nics-ipv6/network-isolation-absolute.yaml
index e5c8ccf2f7..a0fc4e40a3 100644
--- a/ci/environments/network/multiple-nics-ipv6/network-isolation-absolute.yaml
+++ b/ci/environments/network/multiple-nics-ipv6/network-isolation-absolute.yaml
@@ -33,3 +33,5 @@ parameter_defaults:
   NovaIPv6: True
   RabbitIPv6: True
   MemcachedIPv6: True
+  ManilaIPv6: True
+
diff --git a/ci/environments/network/multiple-nics-ipv6/network-isolation.yaml b/ci/environments/network/multiple-nics-ipv6/network-isolation.yaml
index 08c768550f..4b746dc1cc 100644
--- a/ci/environments/network/multiple-nics-ipv6/network-isolation.yaml
+++ b/ci/environments/network/multiple-nics-ipv6/network-isolation.yaml
@@ -33,3 +33,4 @@ parameter_defaults:
   NovaIPv6: True
   RabbitIPv6: True
   MemcachedIPv6: True
+  ManilaIPv6: True
diff --git a/environments/network-isolation-v6.j2.yaml b/environments/network-isolation-v6.j2.yaml
index fefa20ce0b..8f96576c3d 100644
--- a/environments/network-isolation-v6.j2.yaml
+++ b/environments/network-isolation-v6.j2.yaml
@@ -57,3 +57,6 @@ parameter_defaults:
   MemcachedIPv6: True
   # Enable IPv6 environment for MySQL.
   MysqlIPv6: True
+  # Enable IPv6 environment for Manila
+  ManilaIPv6: True
+
diff --git a/puppet/services/manila-base.yaml b/puppet/services/manila-base.yaml
index 9c51f02f64..664260dccb 100644
--- a/puppet/services/manila-base.yaml
+++ b/puppet/services/manila-base.yaml
@@ -30,6 +30,10 @@ parameters:
     description: Mapping of service endpoint -> protocol. Typically set
                  via parameter_defaults in the resource registry.
     type: json
+  ManilaIPv6:
+    default: False
+    description: Set to True to enable IPv6 access in manila.
+    type: boolean
   Debug:
     default: false
     description: Set to True to enable debugging on all services.
@@ -71,6 +75,7 @@ parameters:
 
 conditions:
   service_debug_unset: {equals : [{get_param: ManilaDebug}, '']}
+  manila_ipv6: {equals : [{get_param: ManilaIPv6}, true]}
 
 outputs:
   role_data:
@@ -100,6 +105,9 @@ outputs:
             query:
               read_default_file: /etc/my.cnf.d/tripleo.cnf
               read_default_group: tripleo
+        manila::network::neutron::network_plugin_ipv6_enabled: {get_param: ManilaIPv6}
+        # Currently the address family parameters are mutually exclusive
+        manila::network::neutron::network_plugin_ipv4_enabled: {if: ["manila_ipv6", false, true]}
       service_config_settings:
         mysql:
           manila::db::mysql::password: {get_param: ManilaPassword}