Fix Share Migration improper behavior for drivers

Tempest tests were not appropriate for driver-assisted migration,
so this was fixed.

Also, improved docstrings and fixed workflow for drivers when
implementing 2-phase migration to be accurate with tempest and
handle AZs, which were previously locked to the source share's
AZ.

Driver-assisted migration now creates an additional
share instance to better handle and support driver methods.

Updated allow_access and deny_access APIs to allow users to mount
migrating shares before issuing 'migration-complete'.

APIImpact

Closes-bug: #1594922
Change-Id: If4bfaf7e9d963b83c13a6fea241c2eda14f7f409
diff --git a/manila_tempest_tests/utils.py b/manila_tempest_tests/utils.py
index dea51ab..277130e 100644
--- a/manila_tempest_tests/utils.py
+++ b/manila_tempest_tests/utils.py
@@ -100,3 +100,18 @@
     TEST_NET_3 = '203.0.113.'
     final_octet = six.text_type(random.randint(0, 255))
     return TEST_NET_3 + final_octet
+
+
+def choose_matching_backend(share, pools, share_type):
+    extra_specs = {}
+    # fix extra specs with string values instead of boolean
+    for k, v in share_type['extra_specs'].items():
+        extra_specs[k] = (True if six.text_type(v).lower() == 'true'
+                          else False if six.text_type(v).lower() == 'false'
+                          else v)
+    selected_pool = next(
+        (x for x in pools if (x['name'] != share['host'] and all(
+            y in x['capabilities'].items() for y in extra_specs.items()))),
+        None)
+
+    return selected_pool