You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2018/12/13 11:26:14 UTC

[05/45] libcloud git commit: the drs driver does function

the drs driver does function


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/62d9eb66
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/62d9eb66
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/62d9eb66

Branch: refs/heads/trunk
Commit: 62d9eb667e51c65d9b73d516275f000890e8ade0
Parents: adcf3bd
Author: mitch <mi...@itaas.dimensiondata.com>
Authored: Fri Oct 26 21:55:58 2018 -0400
Committer: mitch <mi...@itaas.dimensiondata.com>
Committed: Fri Oct 26 21:55:58 2018 -0400

----------------------------------------------------------------------
 libcloud/base.py               |  7 +++++++
 libcloud/drs/__init__.py       | 19 +++++++++++++++++++
 libcloud/drs/drivers/nttcis.py | 10 ++++++++++
 libcloud/drs/providers.py      |  9 ++++-----
 4 files changed, 40 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/62d9eb66/libcloud/base.py
----------------------------------------------------------------------
diff --git a/libcloud/base.py b/libcloud/base.py
index 94e9f17..dead087 100644
--- a/libcloud/base.py
+++ b/libcloud/base.py
@@ -25,6 +25,9 @@ from libcloud.container.providers import get_driver as get_container_driver
 from libcloud.dns.providers import Provider as DnsProvider
 from libcloud.dns.providers import get_driver as get_dns_driver
 
+from libcloud.drs.providers import Provider as DrsProvider
+from libcloud.drs.providers import get_driver as get_drs_driver
+
 from libcloud.loadbalancer.providers import Provider as LoadBalancerProvider
 from libcloud.loadbalancer.providers import get_driver as \
     get_loadbalancer_driver
@@ -46,6 +49,9 @@ class DriverType(object):
     """ DNS service provider driver """
     DNS = DnsProvider
 
+    """ DRS service provider driver """
+    DRS = DrsProvider
+
     """ Load balancer provider-driver """
     LOADBALANCER = LoadBalancerProvider
 
@@ -58,6 +64,7 @@ DriverTypeFactoryMap = {
     DriverType.COMPUTE: get_compute_driver,
     DriverType.CONTAINER: get_container_driver,
     DriverType.DNS: get_dns_driver,
+    DriverType.DRS: get_drs_driver,
     DriverType.LOADBALANCER: get_loadbalancer_driver,
     DriverType.STORAGE: get_storage_driver
 }

http://git-wip-us.apache.org/repos/asf/libcloud/blob/62d9eb66/libcloud/drs/__init__.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/__init__.py b/libcloud/drs/__init__.py
index e69de29..e27c8d7 100644
--- a/libcloud/drs/__init__.py
+++ b/libcloud/drs/__init__.py
@@ -0,0 +1,19 @@
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+Module for working with DRS/Consistency Groups
+"""
+
+__all__ = [
+    'base',
+    'providers',
+    'types',
+    'drivers'
+]

http://git-wip-us.apache.org/repos/asf/libcloud/blob/62d9eb66/libcloud/drs/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py
index 3467277..8d4cb37 100644
--- a/libcloud/drs/drivers/nttcis.py
+++ b/libcloud/drs/drivers/nttcis.py
@@ -37,3 +37,13 @@ class NttCisDRSDriver(Driver):
                                               api_version=api_version,
                                               region=region,
                                               **kwargs)
+
+    def _ex_connection_class_kwargs(self):
+        """
+            Add the region to the kwargs before the connection is instantiated
+        """
+
+        kwargs = super(NttCisDRSDriver,
+                       self)._ex_connection_class_kwargs()
+        kwargs['region'] = self.selected_region
+        return kwargs

http://git-wip-us.apache.org/repos/asf/libcloud/blob/62d9eb66/libcloud/drs/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/drs/providers.py b/libcloud/drs/providers.py
index d214d17..2a31efa 100644
--- a/libcloud/drs/providers.py
+++ b/libcloud/drs/providers.py
@@ -13,8 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from libcloud.loadbalancer.types import Provider
-from libcloud.loadbalancer.types import OLD_CONSTANT_TO_NEW_MAPPING
+from libcloud.drs.types import Provider
+#from libcloud.drs.types import OLD_CONSTANT_TO_NEW_MAPPING
 from libcloud.common.providers import get_driver as _get_provider_driver
 from libcloud.common.providers import set_driver as _set_provider_driver
 
@@ -31,9 +31,8 @@ DRIVERS = {
 
 
 def get_driver(provider):
-    deprecated_constants = OLD_CONSTANT_TO_NEW_MAPPING
-    return _get_provider_driver(drivers=DRIVERS, provider=provider,
-                                deprecated_constants=deprecated_constants)
+    #deprecated_constants = OLD_CONSTANT_TO_NEW_MAPPING
+    return _get_provider_driver(drivers=DRIVERS, provider=provider)
 
 
 def set_driver(provider, module, klass):