SSH over IPv4 when using a storage network

A storage network can be configured to connect
VMs in scenario tests to their shares. When
using a storage network, we don't need to force
the private network that we use to SSH to the
VM to be on a particular IP version.

We need the private network subnet to be of
a particular IP version only when there is
no storage network, and we're connecting to
shares over the same network as SSH.

Change-Id: If1d581730c42b060e74600ef2a05298921b1a3c6
Signed-off-by: Goutham Pacha Ravi <gouthampravi@gmail.com>
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index de5cf58..7993693 100644
--- a/manila_tempest_tests/config.py
+++ b/manila_tempest_tests/config.py
@@ -290,5 +290,11 @@
                help="Default size in GB for shares created by share tests."),
     cfg.BoolOpt("run_ipv6_tests",
                 default=False,
-                help="Enable or disable running IPv6 tests."),
+                help="Enable or disable running IPv6 NFS scenario tests. "
+                     "These tests validate that IPv6 export locations work, "
+                     "and that access can be provided to IPv6 clients. When "
+                     "you do not specify a storage_network, the tests will "
+                     "attempt to create an IPv6 subnet on the project network "
+                     "they create for ping and SSH to the client test VM "
+                     "where data path testing is performed."),
 ]
diff --git a/manila_tempest_tests/tests/scenario/manager_share.py b/manila_tempest_tests/tests/scenario/manager_share.py
index 06bf6c2..bb7da5c 100644
--- a/manila_tempest_tests/tests/scenario/manager_share.py
+++ b/manila_tempest_tests/tests/scenario/manager_share.py
@@ -98,17 +98,6 @@
                                             flavor=self.flavor_ref,
                                             ssh_user=self.ssh_user))
 
-        self.security_group = self._create_security_group()
-        self.network = self._create_network(namestart="manila-share")
-        self.subnet = self._create_subnet(
-            network=self.network,
-            namestart="manila-share-sub",
-            ip_version=self.ip_version,
-            use_default_subnetpool=self.ipv6_enabled)
-        router = self._get_router()
-        self._create_router_interface(subnet_id=self.subnet['id'],
-                                      router_id=router['id'])
-
         self.storage_network = (
             self._get_network_by_name_or_id(CONF.share.storage_network)
             if CONF.share.storage_network else None
@@ -117,6 +106,24 @@
             self.storage_network['name'] if self.storage_network else None
         )
 
+        # Tests need to be able to ssh into the VM - so we need
+        # a security group, and a tenant private network
+        self.security_group = self._create_security_group()
+        self.network = self._create_network(namestart="manila-share")
+        # When not using a "storage network" to connect shares to VMs,
+        # we need the subnet to match the IP version we're testing
+        subnet_ip_params = {} if self.storage_network else {
+            'ip_version': self.ip_version,
+            'use_default_subnetpool': self.ipv6_enabled
+        }
+        self.subnet = self._create_subnet(
+            network=self.network,
+            namestart="manila-share-sub",
+            **subnet_ip_params)
+        router = self._get_router()
+        self._create_router_interface(subnet_id=self.subnet['id'],
+                                      router_id=router['id'])
+
         if CONF.share.multitenancy_enabled:
             # Skip if DHSS=False
             self.share_network = self.create_share_network()