removing drs componoents
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/d1580f45 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/d1580f45 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/d1580f45 Branch: refs/heads/trunk Commit: d1580f45afed606ee3341e55a632230ed2d20235 Parents: 321a9f2 Author: mitch <[email protected]> Authored: Tue Nov 27 10:42:48 2018 -0500 Committer: mitch <[email protected]> Committed: Tue Nov 27 10:42:48 2018 -0500 ---------------------------------------------------------------------- docs/drs/_supported_methods.rst | 9 - docs/drs/_supported_providers.rst | 9 - docs/drs/drivers/index.rst | 12 - docs/drs/drivers/nttcis.rst | 18 -- docs/drs/index.rst | 15 - docs/drs/supported_providers.rst | 14 - docs/examples/drs/__init__.py | 0 docs/examples/drs/nttcis/__init__.py | 0 .../drs/nttcis/add_consistency_group.py | 27 -- .../drs/nttcis/list_snapshots_by_create_time.py | 23 -- libcloud/drs/__init__.py | 19 -- libcloud/drs/base.py | 201 ------------- libcloud/drs/drivers/__init__.py | 18 -- libcloud/drs/drivers/nttcis.py | 296 ------------------- libcloud/drs/providers.py | 39 --- libcloud/drs/types.py | 43 --- libcloud/test/drs/__init__.py | 0 .../nttcis/delete_consistency_group.xml | 6 - .../test/drs/fixtures/nttcis/drs_ineligible.xml | 6 - .../fixtures/nttcis/drs_initiate_failover.xml | 6 - .../test/drs/fixtures/nttcis/drs_snapshots.xml | 14 - .../fixtures/nttcis/drs_snapshots_by_min.xml | 90 ------ libcloud/test/drs/fixtures/nttcis/expand_cg.xml | 6 - .../fixtures/nttcis/get_consistency_group.xml | 27 -- .../drs/fixtures/nttcis/list_cg_by_params.xml | 25 -- .../fixtures/nttcis/list_consistency_groups.xml | 25 -- .../drs/fixtures/nttcis/oec_0_9_myaccount.xml | 26 -- .../fixtures/nttcis/start_snapshot_preview.xml | 6 - .../fixtures/nttcis/stop_snapshot_preview.xml | 6 - libcloud/test/drs/test_nttcis.py | 206 ------------- 30 files changed, 1192 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/drs/_supported_methods.rst ---------------------------------------------------------------------- diff --git a/docs/drs/_supported_methods.rst b/docs/drs/_supported_methods.rst deleted file mode 100644 index 6e792fd..0000000 --- a/docs/drs/_supported_methods.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. NOTE: This file has been generated automatically using generate_provider_feature_matrix_table.py script, don't manually edit it - -=================================== ======================== ======================= ===================== ======================== ================================ ============== ====================== ===================== ================= -Provider create_consistency_group list_consistency_groups get_consistency_group delete_consistency_group list_consistency_group_snapshots expand_journal start_failover_preview stop_failover_preview initiate_failover -=================================== ======================== ======================= ===================== ======================== ================================ ============== ====================== ===================== ================= -`NTTC-CIS DRS Consistencty Groups`_ yes yes yes yes yes yes yes yes yes -=================================== ======================== ======================= ===================== ======================== ================================ ============== ====================== ===================== ================= - -.. _`NTTC-CIS DRS Consistencty Groups`: https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/drs/_supported_providers.rst ---------------------------------------------------------------------- diff --git a/docs/drs/_supported_providers.rst b/docs/drs/_supported_providers.rst deleted file mode 100644 index 16b893b..0000000 --- a/docs/drs/_supported_providers.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. NOTE: This file has been generated automatically using generate_provider_feature_matrix_table.py script, don't manually edit it - -=================================== ================================== ================= ==================== ================================== ======================== -Provider Documentation Provider Constant Supported Regions Module Class Name -=================================== ================================== ================= ==================== ================================== ======================== -`NTTC-CIS DRS Consistencty Groups`_ :doc:`Click </drs/drivers/nttcis>` NTTCIS single region driver :mod:`libcloud.drs.drivers.nttcis` :class:`NttCisDRSDriver` -=================================== ================================== ================= ==================== ================================== ======================== - -.. _`NTTC-CIS DRS Consistencty Groups`: https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/drs/drivers/index.rst ---------------------------------------------------------------------- diff --git a/docs/drs/drivers/index.rst b/docs/drs/drivers/index.rst deleted file mode 100644 index 5599158..0000000 --- a/docs/drs/drivers/index.rst +++ /dev/null @@ -1,12 +0,0 @@ -:orphan: - -DNS Drivers Documentation -========================= - -This chapter includes links to driver (provider) specific documentation pages. - -.. toctree:: - :glob: - :maxdepth: 1 - - * \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/drs/drivers/nttcis.rst ---------------------------------------------------------------------- diff --git a/docs/drs/drivers/nttcis.rst b/docs/drs/drivers/nttcis.rst deleted file mode 100644 index accb00e..0000000 --- a/docs/drs/drivers/nttcis.rst +++ /dev/null @@ -1,18 +0,0 @@ -NttCis DRS Driver Documentation -=============================== - -NTT Communications Cloud Infrastructure Services offers disaster recovery services for Compute Services. - - -Instantiating the driver ------------------------- - -.. literalinclude:: /examples/drs/nttcis/add_consistency_group.py - :language: python - -API Docs --------- - -.. autoclass:: libcloud.drs.drivers.nttcis.NttCisDRSDriver - :members: - :inherited-members: http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/drs/index.rst ---------------------------------------------------------------------- diff --git a/docs/drs/index.rst b/docs/drs/index.rst deleted file mode 100644 index 909b8ae..0000000 --- a/docs/drs/index.rst +++ /dev/null @@ -1,15 +0,0 @@ -DRS -=== - -.. note:: - - DRS API is available in Libcloud 2.4.0 and higher. - -DRS API allows you to manage disaster recovery as a separate service. - -Supported Providers -------------------- - -For a list of supported providers see :doc:`supported providers page -</drs/supported_providers>`. - http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/drs/supported_providers.rst ---------------------------------------------------------------------- diff --git a/docs/drs/supported_providers.rst b/docs/drs/supported_providers.rst deleted file mode 100644 index e34e5eb..0000000 --- a/docs/drs/supported_providers.rst +++ /dev/null @@ -1,14 +0,0 @@ -:orphan: - -Supported Providers -=================== - -Provider Matrix ---------------- - -.. include:: _supported_providers.rst - -Supported Methods ------------------ - -.. include:: _supported_methods.rst http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/examples/drs/__init__.py ---------------------------------------------------------------------- diff --git a/docs/examples/drs/__init__.py b/docs/examples/drs/__init__.py deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/examples/drs/nttcis/__init__.py ---------------------------------------------------------------------- diff --git a/docs/examples/drs/nttcis/__init__.py b/docs/examples/drs/nttcis/__init__.py deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/examples/drs/nttcis/add_consistency_group.py ---------------------------------------------------------------------- diff --git a/docs/examples/drs/nttcis/add_consistency_group.py b/docs/examples/drs/nttcis/add_consistency_group.py deleted file mode 100644 index 89fdbfc..0000000 --- a/docs/examples/drs/nttcis/add_consistency_group.py +++ /dev/null @@ -1,27 +0,0 @@ -# This script creates a consistency group - -import libcloud - - -def create_drs(compute_driver, drs_driver): - nodes = compute_driver.list_nodes(ex_name='src-sdk-test') - src_id = nodes[0].id - nodes = compute_driver.list_nodes(ex_name="tgt-sdk-test") - target_id = nodes[0].id - consistency_group_name = "sdk_test_cg" - journal_size_gb = "100" - result = drs_driver.create_consistency_group( - consistency_group_name, journal_size_gb, src_id, target_id, - description="A test consistency group") - assert result is True - - -if __name__ == "__main__": - cls = libcloud.get_driver(libcloud.DriverType.COMPUTE, - libcloud.DriverType.COMPUTE.NTTCIS) - computedriver = cls('my_user', 'my_pass', region='na') - - cls = libcloud.get_driver(libcloud.DriverType.DRS, - libcloud.DriverType.DRS.NTTCIS) - drsdriver = cls('my_user', 'my_pass', region='na') - create_drs(computedriver, drsdriver) http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/docs/examples/drs/nttcis/list_snapshots_by_create_time.py ---------------------------------------------------------------------- diff --git a/docs/examples/drs/nttcis/list_snapshots_by_create_time.py b/docs/examples/drs/nttcis/list_snapshots_by_create_time.py deleted file mode 100644 index 81f8167..0000000 --- a/docs/examples/drs/nttcis/list_snapshots_by_create_time.py +++ /dev/null @@ -1,23 +0,0 @@ -# This script lists the snapshots in a consistency group -# filtered by a minimum and maximum create time - -import libcloud - - -def get_snapshots_by_min_max(drsdriver): - cgs = drsdriver.list_consistency_groups() - cg_id = [i for i in cgs if i.name == "sdk_test2_cg"][0].id - snaps = drsdriver.list_consistency_group_snapshots( - cg_id, - create_time_min="2018-11-06T00:00:00.000Z", - create_time_max="2018-11-07T00:00:00.000Z") - return snaps - - -if __name__ == "__main__": - cls = libcloud.get_driver(libcloud.DriverType.DRS, - libcloud.DriverType.DRS.NTTCIS) - drsdriver = cls('my_user', 'my_pass', region='na') - objs = get_snapshots_by_min_max(drsdriver) - for obj in objs.snapshot: - print(obj) http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/drs/__init__.py ---------------------------------------------------------------------- diff --git a/libcloud/drs/__init__.py b/libcloud/drs/__init__.py deleted file mode 100644 index e27c8d7..0000000 --- a/libcloud/drs/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -# 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/d1580f45/libcloud/drs/base.py ---------------------------------------------------------------------- diff --git a/libcloud/drs/base.py b/libcloud/drs/base.py deleted file mode 100644 index 38d5c5c..0000000 --- a/libcloud/drs/base.py +++ /dev/null @@ -1,201 +0,0 @@ - -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# 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. - -from libcloud.common.base import ConnectionKey -from libcloud.common.base import BaseDriver - -__all__ = [ - 'DRSConsistencyGroup', - 'DRSDriver', -] - - -class DRSConsistencyGroup(object): - """ - Provide a common interface for handling DRS. - """ - - def __init__(self, id, name, description, journalSizeGB, - serverPairSourceServerId, serverPairtargetServerId, - driver, extra=None): - """ - :param id: Load balancer ID. - :type id: ``str`` - - :param name: Load balancer name. - :type name: ``str`` - - :param state: State this loadbalancer is in. - :type state: :class:`libcloud.loadbalancer.types.State` - - :param ip: IP address of this loadbalancer. - :type ip: ``str`` - - :param port: Port of this loadbalancer. - :type port: ``int`` - - :param driver: Driver this loadbalancer belongs to. - :type driver: :class:`.Driver` - - :param extra: Provider specific attributes. (optional) - :type extra: ``dict`` - """ - self.id = str(id) if id else None - self.name = name - self.description = description - self.journalSizeGB = journalSizeGB - - self.serverPairSourceServerId = serverPairSourceServerId - self.serverPairtargetServerId = serverPairtargetServerId - self.driver = driver - self.extra = extra or {} - - -class DRSDriver(BaseDriver): - """ - A base Driver class to derive from - - This class is always subclassed by a specific driver. - """ - - connectionCls = ConnectionKey - name = None - type = None - port = None - - def __init__(self, key, secret=None, secure=True, host=None, - port=None, **kwargs): - super(DRSDriver, self).__init__(key=key, secret=secret, secure=secure, - host=host, port=port, **kwargs) - - def create_consistency_group(self, name, journal_sz_gb, - source_server_id, target_server_id): - """ - :param name: Name of the consistency group to create - :type name: ``str`` - :param journal_sz_gb: Size in 10 Gb increments of the consistency - group's journal - :type journal_sz_gb: ``str`` - :param source_server_id: The id of the server to copy from - :type source_server_id: ``str`` - :param target_server_id: The id of the server to copy to - :type target_server_id: ``str`` - :return: :class: `ConsistencyGroup` - """ - raise NotImplementedError( - 'create_consistency_group not implemented for this driver') - - def list_consistency_groups(self): - """ - List all consistency groups - - :rtype: ``list`` of :class:`ConsistencyGroup` - """ - raise NotImplementedError( - 'list_consistency_groups not implemented for this driver') - - def get_consistency_group(self, consistency_group_id): - """ - Return a :class:`ConsistencyGroup` object. - - :param consistency_group_id: id of a consistency group you want - to fetch - :type consistency_group_id: ``str`` - - :rtype: :class:`ConsistencyGroup` - """ - - raise NotImplementedError( - 'get_consistency_group not implemented for this driver') - - def delete_consistency_group(self, consistency_group_id): - """ - Delete a consistency group - - :param consistency_group_id: Id of consistency group to delete - :type consistency_group_id: ``str`` - - :return: ``True`` For successful deletion, otherwise ``False``. - :rtype: ``bool`` - """ - - raise NotImplementedError( - 'delete_consistency_group not implemented for this driver') - - def list_consistency_group_snapshots(self, consistency_group_id): - """ - Return a list of consistency group snapshots. - - :param consistency_group_id: id of a consistency group to fetch - snapshots from. - :type consistency_group_id: ``str`` - :rtype: ``list`` - """ - - raise NotImplementedError( - 'list_consistency_group_snapshots not implemented for this driver') - - def expand_journal(self, consistency_group_id, size_gb): - """ - :param consistency_group_id: consistency group's id with journal - to expand - :type consistency_group_id: ``str`` - :param size_gb: Size in increments of 10 Gb to expand journal. - :return: ``True`` For successful deletion, otherwise ``False``. - :rtype: ``bool`` - """ - - raise NotImplementedError( - 'expand_journal not implemented for this driver') - - def start_failover_preview(self, consistency_group_id, snapshot_id): - """ - :param consistency_group_id: consistency group's id with journal - to expand - :type consistency_group_id: ``str `` - :param snapshot_id: Snapshot Id to bring into preview mode. - :type snapshot_id: ``str`` - :return: ``True`` For successful deletion, otherwise ``False``. - :rtype: ``bool`` - """ - - raise NotImplementedError( - 'start_failover_preview not implemented for this driver') - - def stop_failover_preview(self, consistency_group_id): - """ - :param consistency_group_id: Consistency group id of consistency - group to brought out of - PREVIEWING_SNAHSHOT and into DRS_MODE. - :type consistency_group_id: ``str`` - :return: ``True`` For successful deletion, otherwise ``False``. - :rtype: ``bool`` - """ - - raise NotImplementedError( - 'stop_failover_preview not implemented for this driver') - - def initiate_failover(self, consistency_group_id): - """ - :param consistency_group_id: Consistency group id of consistency - group on which to initiate failover. - :type consistency_group_id: ``str`` - :return: ``True`` For successful deletion, otherwise ``False``. - :rtype: ``bool`` - """ - - raise NotImplementedError( - 'initiate_failover not implemented for this driver') http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/drs/drivers/__init__.py ---------------------------------------------------------------------- diff --git a/libcloud/drs/drivers/__init__.py b/libcloud/drs/drivers/__init__.py deleted file mode 100644 index 2473c57..0000000 --- a/libcloud/drs/drivers/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# 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. - -__all__ = [ - 'nttcis' -] http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/drs/drivers/nttcis.py ---------------------------------------------------------------------- diff --git a/libcloud/drs/drivers/nttcis.py b/libcloud/drs/drivers/nttcis.py deleted file mode 100644 index 54127d4..0000000 --- a/libcloud/drs/drivers/nttcis.py +++ /dev/null @@ -1,296 +0,0 @@ -from libcloud.utils.py3 import ET -from libcloud.common.nttcis import NttCisConnection -from libcloud.common.nttcis import API_ENDPOINTS -from libcloud.common.nttcis import DEFAULT_REGION -from libcloud.common.nttcis import process_xml, get_params -from libcloud.drs.types import Provider -from libcloud.drs.base import DRSDriver -from libcloud.common.nttcis import TYPES_URN -from libcloud.utils.xml import fixxpath, findtext, findall - - -class NttCisDRSDriver(DRSDriver): - """ - NttCis DRS driver. - """ - - selected_region = None - connectionCls = NttCisConnection - name = 'NTTC-CIS DRS Consistencty Groups' - website = 'https://www.us.ntt.com/en/services/cloud/enterprise-cloud.html' - type = Provider.NTTCIS - api_version = 1.0 - - network_domain_id = None - - def __init__(self, key, secret=None, secure=True, host=None, port=None, - api_version=None, region=DEFAULT_REGION, **kwargs): - - if region not in API_ENDPOINTS and host is None: - raise ValueError( - 'Invalid region: %s, no host specified' % (region)) - if region is not None: - self.selected_region = API_ENDPOINTS[region] - - super(NttCisDRSDriver, self).__init__(key=key, - secret=secret, - secure=secure, host=host, - port=port, - 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 - - def create_consistency_group(self, name, journal_size_gb, - source_server_id, target_server_id, - description=None): - """ - Create a consistency group - - :param name: Name of consistency group - :type name: ``str`` - :param journal_size_gb: Journal size in GB - :type journal_size_gb: ``str`` - :param source_server_id: Id of the server to copy - :type source_server_id: ``str`` - :param target_server_id: Id of the server to receive the copy - :type source_server_id: ``str`` - :param description: (Optional) Description of consistency group - :type description: ``str`` - :returns: :class: NttCisConsistenccyGroup - """ - - consistency_group_elm = ET.Element('createConsistencyGroup', - {'xmlns': TYPES_URN}) - ET.SubElement(consistency_group_elm, "name").text = name - if description is not None: - ET.SubElement( - consistency_group_elm, "description").text = description - ET.SubElement( - consistency_group_elm, "journalSizeGb").text = journal_size_gb - server_pair = ET.SubElement(consistency_group_elm, "serverPair") - ET.SubElement( - server_pair, "sourceServerId").text = source_server_id - ET.SubElement( - server_pair, "targetServerId").text = target_server_id - response = self.connection.request_with_orgId_api_2( - "consistencyGroup/createConsistencyGroup", - method="POST", - data=ET.tostring(consistency_group_elm)).object - response_code = findtext(response, 'responseCode', TYPES_URN) - return response_code in ['IN_PROGRESS', 'OK'] - - @get_params - def list_consistency_groups(self, params={}): - """ - Functions takes a named parameter that must be one of the following - :param params: A sequence of comma separated keyword arguments - and a value - * target_data_center_id= - * source_network_domain_id= - * target_network_domain_id= - * source_server_id= - * target_server_id= - * name= - * state= - * operation_status= - * drs_infrastructure_status= - :returns: `list` of :class: `NttCisConsistencyGroup` - """ - - response = self.connection.request_with_orgId_api_2( - 'consistencyGroup/consistencyGroup', params=params).object - cgs = self._to_consistency_groups(response) - return cgs - - def get_consistency_group(self, consistency_group_id): - """ - Retrieves a Consistency by it's id and is more efficient thatn listing - all consistency groups and filtering that result. - - :param consistency_group_id: An id of a consistency group - :type consistency_group_id: ``str`` - :returns: :class: `NttCisConsistencygroup` - """ - response = self.connection.request_with_orgId_api_2( - "consistencyGroup/consistencyGroup/%s" % consistency_group_id - ).object - cg = self._to_process(response) - return cg - - def list_consistency_group_snapshots(self, consistency_group_id, - create_time_min=None, - create_time_max=None): - """ - Optional parameters identify the date of creation of Consistency Group - snapshots in *XML Schema (XSD) date time format. Best used as a - combination of createTime.MIN and createTime.MAX. If neither is - provided then all snapshots up to the possible maximum of 1014 - will be returned. If MIN is provided by itself, all snapshots - between the time specified by MIN and the point in time of - execution will be returned. If MAX is provided by itself, - then all snapshots up to that point in time (up to the - maximum number of 1014) will be returned. MIN and MAX are - inclusive for this API function - - :param consistency_group_id: The id of consistency group - :type consistency_group_id: ``str`` - :param create_time_min: (Optional) in form YYYY-MM-DDT00:00.00.00Z or - substitute time offset for Z, i.e, - -05:00 - :type create_time_min: ``str`` - :param create_time_max: (Optional) in form YYYY-MM-DDT00:00:00.000Z or - substitute time offset for Z, i.e, - -05:00 - :type create_time_max: ``str`` - :returns: `list` of :class: `NttCisSnapshots` - """ - - if create_time_min is None and create_time_max is None: - params = {"consistencyGroupId": consistency_group_id} - elif create_time_min and create_time_max: - params = {"consistencyGroupId": consistency_group_id, - "createTime.MIN": create_time_min, - "createTime.MAX": create_time_max - } - elif create_time_min or create_time_max: - if create_time_max is not None: - params = {"consistencyGroupId": consistency_group_id, - "createTime.MAX": create_time_max - } - elif create_time_min is not None: - params = {"consistencyGroupId": consistency_group_id, - "createTime.MIN": create_time_min - } - paged_result = self.connection.request_with_orgId_api_2( - 'consistencyGroup/snapshot', - method='GET', - params=params - ).object - snapshots = self._to_process(paged_result) - return snapshots - - def expand_journal(self, consistency_group_id, size_gb): - """ - Expand the consistency group's journhal size in 100Gb increments - - :param consistency_group_id: The consistency group's UUID - :type consistency_group_id: ``str`` - :param size_gb: Gb in 100 Gb increments - :type size_gb: ``str`` - :returns: ``bool`` - """ - - expand_elm = ET.Element("expandJournal", {"id": consistency_group_id, - "xmlns": TYPES_URN}) - ET.SubElement(expand_elm, "sizeGb").text = size_gb - response = self.connection.request_with_orgId_api_2( - "consistencyGroup/expandJournal", - method="POST", - data=ET.tostring(expand_elm)).object - response_code = findtext(response, 'responseCode', TYPES_URN) - return response_code in ['IN_PROGRESS', 'OK'] - - def start_failover_preview(self, consistency_group_id, snapshot_id): - """ - Brings a Consistency Group into PREVIEWING_SNAPSHOT mode - - :param consistency_group_id: Id of the Consistency Group to put into - PRIEVEW_MODE - :type consistency_group_id: ``str`` - :param snapshot_id: Id of the Snapshot to preview - :type snapshot_id: ``str`` - :returns: True/False - :rtype: ``bool`` - """ - preview_elm = ET.Element("startPreviewSnapshot", - {"consistencyGroupId": consistency_group_id, - "xmlns": TYPES_URN - }) - ET.SubElement(preview_elm, "snapshotId").text = snapshot_id - response = self.connection.request_with_orgId_api_2( - "consistencyGroup/startPreviewSnapshot", - method="POST", - data=ET.tostring(preview_elm)).object - response_code = findtext(response, 'responseCode', TYPES_URN) - return response_code in ['IN_PROGRESS', 'OK'] - - def stop_failover_preview(self, consistency_group_id): - """ - Takes a Consistency Group out of PREVIEW_MODE and back to DRS_MODE - - :param consistency_group_id: Consistency Group's Id - :type ``str`` - :returns: True/False - :rtype: ``bool`` - """ - preview_elm = ET.Element("stopPreviewSnapshot", - {"consistencyGroupId": consistency_group_id, - "xmlns": TYPES_URN}) - response = self.connection.request_with_orgId_api_2( - "consistencyGroup/stopPreviewSnapshot", - method="POST", - data=ET.tostring(preview_elm)).object - response_code = findtext(response, 'responseCode', TYPES_URN) - return response_code in ['IN_PROGRESS', 'OK'] - - def initiate_failover(self, consistency_group_id): - """ - This method is irreversible. - It will failover the Consistency Group while removing it as well. - - :param consistency_group_id: Consistency Group's Id to failover - :type consistency_group_id: ``str`` - :returns: True/False - :rtype: ``bool`` - """ - failover_elm = ET.Element("initiateFailover", - {"consistencyGroupId": consistency_group_id, - "xmlns": TYPES_URN}) - response = self.connection.request_with_orgId_api_2( - "consistencyGroup/initiateFailover", - method="POST", - data=ET.tostring(failover_elm)).object - response_code = findtext(response, "responseCode", TYPES_URN) - return response_code in ["IN_PROGRESS", "OK"] - - def delete_consistency_group(self, consistency_group_id): - """ - Delete's a Consistency Group - - :param consistency_group_id: Id of Consistency Group to delete - :type consistency_group_id: ``str`` - :return: True/False - :rtype: ``bool`` - """ - delete_elm = ET.Element("deleteConsistencyGroup", - {"id": consistency_group_id, - "xmlns": TYPES_URN}) - response = self.connection.request_with_orgId_api_2( - "consistencyGroup/deleteConsistencyGroup", - method="POST", - data=ET.tostring(delete_elm)).object - response_code = findtext(response, "responseCode", TYPES_URN) - return response_code in ["IN_PROGRESS", "OK"] - - def _to_consistency_groups(self, object): - cgs = findall(object, 'consistencyGroup', TYPES_URN) - return [self._to_process(el) for el in cgs] - - def _to_snapshots(self, object): - snapshots = [] - for element in object.findall(fixxpath("snapshot", TYPES_URN)): - snapshots.append(self._to_process(element)) - return snapshots - - def _to_process(self, element): - return process_xml(ET.tostring(element)) http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/drs/providers.py ---------------------------------------------------------------------- diff --git a/libcloud/drs/providers.py b/libcloud/drs/providers.py deleted file mode 100644 index 9aadaae..0000000 --- a/libcloud/drs/providers.py +++ /dev/null @@ -1,39 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# 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. - -from libcloud.drs.types import Provider -from libcloud.common.providers import get_driver as _get_provider_driver -from libcloud.common.providers import set_driver as _set_provider_driver - -__all__ = [ - "Provider", - "DRIVERS", - "get_driver", -] - -DRIVERS = { - Provider.NTTCIS: - ('libcloud.drs.drivers.nttcis', 'NttCisDRSDriver'), -} - - -def get_driver(provider): - # deprecated_constants = OLD_CONSTANT_TO_NEW_MAPPING - return _get_provider_driver(drivers=DRIVERS, provider=provider) - - -def set_driver(provider, module, klass): - return _set_provider_driver(drivers=DRIVERS, provider=provider, - module=module, klass=klass) http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/drs/types.py ---------------------------------------------------------------------- diff --git a/libcloud/drs/types.py b/libcloud/drs/types.py deleted file mode 100644 index 39c6368..0000000 --- a/libcloud/drs/types.py +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# 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. - -__all__ = [ - "Provider", - "LibcloudDRSError", - "LibcloudDRSImmutableError", - -] - -from libcloud.common.types import LibcloudError - - -class LibcloudDRSError(LibcloudError): - pass - - -class LibcloudDRSImmutableError(LibcloudDRSError): - pass - - -class Provider(object): - """ - Defines for each of the supported providers - - Non-Dummy drivers are sorted in alphabetical order. Please preserve this - ordering when adding new drivers. - - :cvar NTTCIS: NTT Communications CIS DRS driver - """ - NTTCIS = 'nttcis' http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/__init__.py ---------------------------------------------------------------------- diff --git a/libcloud/test/drs/__init__.py b/libcloud/test/drs/__init__.py deleted file mode 100644 index e69de29..0000000 http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/delete_consistency_group.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/drs/fixtures/nttcis/delete_consistency_group.xml b/libcloud/test/drs/fixtures/nttcis/delete_consistency_group.xml deleted file mode 100644 index 6c5c1ed..0000000 --- a/libcloud/test/drs/fixtures/nttcis/delete_consistency_group.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181108T170953967-0500_49fbd66f-4eca-4107-acf5-08d7bb07c706"> - <operation>DELETE_CONSISTENCY_GROUP</operation> - <responseCode>IN_PROGRESS</responseCode> - <message>Request to Delete Consistency Group has been accepted. Please use appropriate Get or List API for status.</message> -</response> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml b/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml deleted file mode 100644 index a0ff44c..0000000 --- a/libcloud/test/drs/fixtures/nttcis/drs_ineligible.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181031T115504819-0400_9c995adf-a3e8-4b1e-9d1f-a34bf52b693d"> - <operation>CREATE_CONSISTENCY_GROUP</operation> - <responseCode>INCOMPATIBLE_OPERATION</responseCode> - <message>The drsEligible flag for target Server aee58575-38e2-495f-89d3-854e6a886411 must be set.</message> -</response> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/drs_initiate_failover.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/drs/fixtures/nttcis/drs_initiate_failover.xml b/libcloud/test/drs/fixtures/nttcis/drs_initiate_failover.xml deleted file mode 100644 index 115dda1..0000000 --- a/libcloud/test/drs/fixtures/nttcis/drs_initiate_failover.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181108T160941803-0500_729ba262-347d-4da9-bf4d-c30e861bfa63"> - <operation>INITIATE_FAILOVER</operation> - <responseCode>IN_PROGRESS</responseCode> - <message>Request to Initiate Failover has been accepted. Please use appropriate Get or List API for status.</message> -</response> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/drs_snapshots.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/drs/fixtures/nttcis/drs_snapshots.xml b/libcloud/test/drs/fixtures/nttcis/drs_snapshots.xml deleted file mode 100644 index 5386f46..0000000 --- a/libcloud/test/drs/fixtures/nttcis/drs_snapshots.xml +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<consistencyGroupSnapshots xmlns="urn:didata.com:api:cloud:types" totalCount="1013" journalUsageGb="0.22" protectionWindow="P0Y0M2DT1H48M45.532S" predictedProtectionWindow="P23Y1M15DT11H1M58.309S"> - <snapshot id="297700" createTime="2018-11-02T14:00:13.271-04:00" sizeKb="0"/> - <snapshot id="297695" createTime="2018-11-02T14:00:10.219-04:00" sizeKb="2"/> - <snapshot id="297650" createTime="2018-11-02T13:59:42.780-04:00" sizeKb="7"/> - <snapshot id="297488" createTime="2018-11-02T13:58:05.255-04:00" sizeKb="188"/> - <snapshot id="297235" createTime="2018-11-02T13:56:27.697-04:00" sizeKb="29"/> - <snapshot id="296911" createTime="2018-11-02T13:53:12.913-04:00" sizeKb="14"/> - <snapshot id="296591" createTime="2018-11-02T13:49:57.857-04:00" sizeKb="14"/> - <snapshot id="296271" createTime="2018-11-02T13:46:42.980-04:00" sizeKb="14"/> - <snapshot id="295951" createTime="2018-11-02T13:43:27.903-04:00" sizeKb="14"/> - <snapshot id="295631" createTime="2018-11-02T13:40:12.811-04:00" sizeKb="14"/> - <snapshot id="295311" createTime="2018-11-02T13:36:57.691-04:00" sizeKb="14"/> -</consistencyGroupSnapshots> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/drs_snapshots_by_min.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/drs/fixtures/nttcis/drs_snapshots_by_min.xml b/libcloud/test/drs/fixtures/nttcis/drs_snapshots_by_min.xml deleted file mode 100644 index 99c6ced..0000000 --- a/libcloud/test/drs/fixtures/nttcis/drs_snapshots_by_min.xml +++ /dev/null @@ -1,90 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<consistencyGroupSnapshots xmlns="urn:didata.com:api:cloud:types" totalCount="87" journalUsageGb="0.22" protectionWindow="P0Y0M7DT4H47M26.177S" predictedProtectionWindow="P91Y3M21DT22H2M36.211S"> - <snapshot id="140736" createTime="2018-11-07T15:58:53.916-05:00" sizeKb="0"/> - <snapshot id="140731" createTime="2018-11-07T15:58:50.873-05:00" sizeKb="5"/> - <snapshot id="140601" createTime="2018-11-07T15:57:31.642-05:00" sizeKb="54"/> - <snapshot id="139321" createTime="2018-11-07T15:44:32.220-05:00" sizeKb="54"/> - <snapshot id="138041" createTime="2018-11-07T15:31:32.329-05:00" sizeKb="54"/> - <snapshot id="136761" createTime="2018-11-07T15:18:32.749-05:00" sizeKb="54"/> - <snapshot id="135481" createTime="2018-11-07T15:05:32.688-05:00" sizeKb="75"/> - <snapshot id="134183" createTime="2018-11-07T14:52:32.661-05:00" sizeKb="54"/> - <snapshot id="132903" createTime="2018-11-07T14:39:32.389-05:00" sizeKb="54"/> - <snapshot id="131623" createTime="2018-11-07T14:26:32.069-05:00" sizeKb="54"/> - <snapshot id="130343" createTime="2018-11-07T14:13:32.825-05:00" sizeKb="27"/> - <snapshot id="129703" createTime="2018-11-07T14:07:02.931-05:00" sizeKb="55"/> - <snapshot id="129041" createTime="2018-11-07T14:00:33.348-05:00" sizeKb="54"/> - <snapshot id="127761" createTime="2018-11-07T13:47:33.123-05:00" sizeKb="54"/> - <snapshot id="126481" createTime="2018-11-07T13:34:33.073-05:00" sizeKb="54"/> - <snapshot id="125201" createTime="2018-11-07T13:21:33.622-05:00" sizeKb="54"/> - <snapshot id="123921" createTime="2018-11-07T13:08:34.110-05:00" sizeKb="43"/> - <snapshot id="123268" createTime="2018-11-07T13:02:04.173-05:00" sizeKb="249"/> - <snapshot id="122516" createTime="2018-11-07T12:55:34.213-05:00" sizeKb="54"/> - <snapshot id="121236" createTime="2018-11-07T12:42:34.018-05:00" sizeKb="54"/> - <snapshot id="119956" createTime="2018-11-07T12:29:34.921-05:00" sizeKb="54"/> - <snapshot id="118676" createTime="2018-11-07T12:16:34.703-05:00" sizeKb="54"/> - <snapshot id="117396" createTime="2018-11-07T12:03:35.038-05:00" sizeKb="82"/> - <snapshot id="116094" createTime="2018-11-07T11:50:34.781-05:00" sizeKb="54"/> - <snapshot id="114814" createTime="2018-11-07T11:37:34.411-05:00" sizeKb="54"/> - <snapshot id="113534" createTime="2018-11-07T11:24:34.562-05:00" sizeKb="54"/> - <snapshot id="112254" createTime="2018-11-07T11:11:34.661-05:00" sizeKb="33"/> - <snapshot id="111606" createTime="2018-11-07T11:05:04.533-05:00" sizeKb="117"/> - <snapshot id="110911" createTime="2018-11-07T10:58:34.802-05:00" sizeKb="139"/> - <snapshot id="109579" createTime="2018-11-07T10:45:35.381-05:00" sizeKb="61"/> - <snapshot id="108285" createTime="2018-11-07T10:32:35.296-05:00" sizeKb="72"/> - <snapshot id="106985" createTime="2018-11-07T10:19:35.070-05:00" sizeKb="54"/> - <snapshot id="105705" createTime="2018-11-07T10:06:34.828-05:00" sizeKb="75"/> - <snapshot id="104407" createTime="2018-11-07T09:53:35.075-05:00" sizeKb="54"/> - <snapshot id="103127" createTime="2018-11-07T09:40:35.476-05:00" sizeKb="54"/> - <snapshot id="101847" createTime="2018-11-07T09:27:35.646-05:00" sizeKb="54"/> - <snapshot id="100567" createTime="2018-11-07T09:14:35.570-05:00" sizeKb="27"/> - <snapshot id="99927" createTime="2018-11-07T09:08:05.453-05:00" sizeKb="53"/> - <snapshot id="99261" createTime="2018-11-07T09:01:35.363-05:00" sizeKb="62"/> - <snapshot id="97971" createTime="2018-11-07T08:48:35.423-05:00" sizeKb="54"/> - <snapshot id="96691" createTime="2018-11-07T08:35:35.499-05:00" sizeKb="54"/> - <snapshot id="95411" createTime="2018-11-07T08:22:35.176-05:00" sizeKb="54"/> - <snapshot id="94131" createTime="2018-11-07T08:09:35.704-05:00" sizeKb="63"/> - <snapshot id="92840" createTime="2018-11-07T07:56:35.594-05:00" sizeKb="54"/> - <snapshot id="91560" createTime="2018-11-07T07:43:35.557-05:00" sizeKb="57"/> - <snapshot id="90275" createTime="2018-11-07T07:30:36.714-05:00" sizeKb="57"/> - <snapshot id="88991" createTime="2018-11-07T07:17:36.518-05:00" sizeKb="61"/> - <snapshot id="87703" createTime="2018-11-07T07:04:36.925-05:00" sizeKb="75"/> - <snapshot id="86404" createTime="2018-11-07T06:51:36.594-05:00" sizeKb="54"/> - <snapshot id="85124" createTime="2018-11-07T06:38:36.944-05:00" sizeKb="54"/> - <snapshot id="83844" createTime="2018-11-07T06:25:37.281-05:00" sizeKb="54"/> - <snapshot id="82564" createTime="2018-11-07T06:12:37.253-05:00" sizeKb="27"/> - <snapshot id="81924" createTime="2018-11-07T06:06:07.098-05:00" sizeKb="48"/> - <snapshot id="81266" createTime="2018-11-07T05:59:37.367-05:00" sizeKb="54"/> - <snapshot id="79986" createTime="2018-11-07T05:46:37.421-05:00" sizeKb="54"/> - <snapshot id="78706" createTime="2018-11-07T05:33:38.322-05:00" sizeKb="54"/> - <snapshot id="77426" createTime="2018-11-07T05:20:38.384-05:00" sizeKb="54"/> - <snapshot id="76146" createTime="2018-11-07T05:07:38.985-05:00" sizeKb="62"/> - <snapshot id="75475" createTime="2018-11-07T05:01:09.065-05:00" sizeKb="32"/> - <snapshot id="74826" createTime="2018-11-07T04:54:38.976-05:00" sizeKb="54"/> - <snapshot id="73546" createTime="2018-11-07T04:41:38.697-05:00" sizeKb="54"/> - <snapshot id="72266" createTime="2018-11-07T04:28:39.145-05:00" sizeKb="54"/> - <snapshot id="70986" createTime="2018-11-07T04:15:39.114-05:00" sizeKb="55"/> - <snapshot id="69702" createTime="2018-11-07T04:02:39.563-05:00" sizeKb="83"/> - <snapshot id="68403" createTime="2018-11-07T03:49:39.577-05:00" sizeKb="27"/> - <snapshot id="67763" createTime="2018-11-07T03:43:09.797-05:00" sizeKb="51"/> - <snapshot id="67102" createTime="2018-11-07T03:36:39.935-05:00" sizeKb="58"/> - <snapshot id="65820" createTime="2018-11-07T03:23:39.859-05:00" sizeKb="37"/> - <snapshot id="65170" createTime="2018-11-07T03:17:09.938-05:00" sizeKb="372"/> - <snapshot id="64341" createTime="2018-11-07T03:10:39.796-05:00" sizeKb="27"/> - <snapshot id="63701" createTime="2018-11-07T03:04:10.126-05:00" sizeKb="50"/> - <snapshot id="63042" createTime="2018-11-07T02:57:40.014-05:00" sizeKb="54"/> - <snapshot id="61762" createTime="2018-11-07T02:44:40.619-05:00" sizeKb="54"/> - <snapshot id="60466" createTime="2018-11-07T02:31:31.343-05:00" sizeKb="54"/> - <snapshot id="59186" createTime="2018-11-07T02:18:31.853-05:00" sizeKb="55"/> - <snapshot id="57902" createTime="2018-11-07T02:05:31.526-05:00" sizeKb="83"/> - <snapshot id="56598" createTime="2018-11-07T01:52:31.345-05:00" sizeKb="54"/> - <snapshot id="55318" createTime="2018-11-07T01:39:31.367-05:00" sizeKb="54"/> - <snapshot id="54038" createTime="2018-11-07T01:26:31.545-05:00" sizeKb="54"/> - <snapshot id="52758" createTime="2018-11-07T01:13:31.876-05:00" sizeKb="27"/> - <snapshot id="52118" createTime="2018-11-07T01:07:01.827-05:00" sizeKb="55"/> - <snapshot id="51456" createTime="2018-11-07T01:00:31.835-05:00" sizeKb="59"/> - <snapshot id="50167" createTime="2018-11-07T00:47:32.638-05:00" sizeKb="54"/> - <snapshot id="48887" createTime="2018-11-07T00:34:33.021-05:00" sizeKb="54"/> - <snapshot id="47607" createTime="2018-11-07T00:21:33.155-05:00" sizeKb="54"/> - <snapshot id="46327" createTime="2018-11-07T00:08:33.145-05:00" sizeKb="42"/> - <snapshot id="45670" createTime="2018-11-07T00:02:03.027-05:00" sizeKb="48"/> -</consistencyGroupSnapshots> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/expand_cg.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/drs/fixtures/nttcis/expand_cg.xml b/libcloud/test/drs/fixtures/nttcis/expand_cg.xml deleted file mode 100644 index f29d9a1..0000000 --- a/libcloud/test/drs/fixtures/nttcis/expand_cg.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181106T161731342-0500_8c65ed73-ddb1-4043-981a-535a0c8e28aa"> - <operation>EXPAND_JOURNAL</operation> - <responseCode>IN_PROGRESS</responseCode> - <message>Request to Expand DRS Journal Space has been accepted. Please use appropriate Get or List API for status.</message> -</response> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/get_consistency_group.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/drs/fixtures/nttcis/get_consistency_group.xml b/libcloud/test/drs/fixtures/nttcis/get_consistency_group.xml deleted file mode 100644 index bcbe931..0000000 --- a/libcloud/test/drs/fixtures/nttcis/get_consistency_group.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<consistencyGroups xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1" totalCount="1" pageSize="250"> - <consistencyGroup id="3710c093-7dcc-4a21-bd07-af9f4d93b6b5"> - <name>sdk_test2_cg</name> - <description>A test consistency group</description> - <journal sizeGb="100" extentCount="1"/> - <source datacenterId="NADRAASLAB01" networkDomainId="f9d6a249-c922-4fa1-9f0f-de5b452c4026"> - <networkDomainName>DRS-ProdEng-East-ND1</networkDomainName> - </source> - <target datacenterId="NADRAASLAB02" networkDomainId="e46c8815-193f-402d-b8a5-682eaa646fb2"> - <networkDomainName>DRS-ProdEng-West-ND1</networkDomainName> - </target> - <serverPair id="de9f0a6b-db84-4ffa-aacf-796f694c29f2" state="NORMAL"> - <sourceServer id="032f3967-00e4-4780-b4ef-8587460f9dd4" primaryNicIpv4="192.168.12.8" primaryNicIpv6="2607:f480:111:1426:3dc9:25dc:4985:81b2"> - <name>src-sdk-test</name> - </sourceServer> - <targetServer id="aee58575-38e2-495f-89d3-854e6a886411" primaryNicIpv4="192.168.22.7" primaryNicIpv6="2607:f480:211:1159:2dff:40ed:ee7c:4738"> - <name>tgt-sdk-test</name> - </targetServer> - </serverPair> - <createTime>2018-10-31T16:02:05.000Z</createTime> - <operationStatus>DRS_MODE</operationStatus> - <drsInfrastructure enabled="true" status="ACTIVE" updateTime="2018-11-01T19:40:01.000Z"/> - <drsStatusCheckFailureCount>0</drsStatusCheckFailureCount> - <state>NORMAL</state> - </consistencyGroup> -</consistencyGroups> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/list_cg_by_params.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/drs/fixtures/nttcis/list_cg_by_params.xml b/libcloud/test/drs/fixtures/nttcis/list_cg_by_params.xml deleted file mode 100644 index 0115461..0000000 --- a/libcloud/test/drs/fixtures/nttcis/list_cg_by_params.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<consistencyGroups xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1" totalCount="1" pageSize="250"> - <consistencyGroup id="3710c093-7dcc-4a21-bd07-af9f4d93b6b5"><name>sdk_test2_cg</name> - <description>A test consistency group</description><journal sizeGb="100" extentCount="1"/> - <source datacenterId="NADRAASLAB01" networkDomainId="f9d6a249-c922-4fa1-9f0f-de5b452c4026"> - <networkDomainName>DRS-ProdEng-East-ND1</networkDomainName> - </source> - <target datacenterId="NADRAASLAB02" networkDomainId="e46c8815-193f-402d-b8a5-682eaa646fb2"> - <networkDomainName>DRS-ProdEng-West-ND1</networkDomainName> - </target> - <serverPair id="de9f0a6b-db84-4ffa-aacf-796f694c29f2" state="NORMAL"> - <sourceServer id="032f3967-00e4-4780-b4ef-8587460f9dd4" primaryNicIpv4="192.168.12.8" primaryNicIpv6="2607:f480:111:1426:3dc9:25dc:4985:81b2"> - <name>src-sdk-test</name> - </sourceServer> - <targetServer id="aee58575-38e2-495f-89d3-854e6a886411" primaryNicIpv4="192.168.22.7" primaryNicIpv6="2607:f480:211:1159:2dff:40ed:ee7c:4738"> - <name>tgt-sdk-test</name> - </targetServer> - </serverPair> - <createTime>2018-10-31T16:02:05.000Z</createTime> - <operationStatus>DRS_MODE</operationStatus> - <drsInfrastructure enabled="true" status="ACTIVE" updateTime="2018-11-05T16:35:01.000Z"/> - <drsStatusCheckFailureCount>0</drsStatusCheckFailureCount> - <state>NORMAL</state> - </consistencyGroup> -</consistencyGroups> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/list_consistency_groups.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/drs/fixtures/nttcis/list_consistency_groups.xml b/libcloud/test/drs/fixtures/nttcis/list_consistency_groups.xml deleted file mode 100644 index 8b1a936..0000000 --- a/libcloud/test/drs/fixtures/nttcis/list_consistency_groups.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<consistencyGroups xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1" totalCount="1" pageSize="250"> - <consistencyGroup id="3710c093-7dcc-4a21-bd07-af9f4d93b6b5"> - <name>sdk_test2_cg</name> - <description>A test consistency group</description> - <journal sizeGb="100" extentCount="1"/> - <source datacenterId="NADRAASLAB01" networkDomainId="f9d6a249-c922-4fa1-9f0f-de5b452c4026"> - <networkDomainName>DRS-ProdEng-East-ND1</networkDomainName> - </source> - <target datacenterId="NADRAASLAB02" networkDomainId="e46c8815-193f-402d-b8a5-682eaa646fb2"> - <networkDomainName>DRS-ProdEng-West-ND1</networkDomainName> - </target> - <serverPair id="de9f0a6b-db84-4ffa-aacf-796f694c29f2" state="NORMAL"> - <sourceServer id="032f3967-00e4-4780-b4ef-8587460f9dd4" primaryNicIpv4="192.168.12.8" primaryNicIpv6="2607:f480:111:1426:3dc9:25dc:4985:81b2"> - <name>src-sdk-test</name> - </sourceServer> - <targetServer id="aee58575-38e2-495f-89d3-854e6a886411" primaryNicIpv4="192.168.22.7" primaryNicIpv6="2607:f480:211:1159:2dff:40ed:ee7c:4738"> - <name>tgt-sdk-test</name></targetServer></serverPair> - <createTime>2018-10-31T16:02:05.000Z</createTime> - <operationStatus>DRS_MODE</operationStatus> - <drsInfrastructure enabled="true" status="ACTIVE" updateTime="2018-11-01T14:20:01.000Z"/> - <drsStatusCheckFailureCount>0</drsStatusCheckFailureCount> - <state>NORMAL</state> - </consistencyGroup> -</consistencyGroups> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml b/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml deleted file mode 100644 index 4f3b132..0000000 --- a/libcloud/test/drs/fixtures/nttcis/oec_0_9_myaccount.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<ns3:Account xmlns="http://oec.api.opsource.net/schemas/server" xmlns:ns9="http://oec.api.opsource.net/schemas/reset" xmlns:ns5="http://oec.api.opsource.net/schemas/vip" xmlns:ns12="http://oec.api.opsource.net/schemas/general" xmlns:ns6="http://oec.api.opsource.net/schemas/imageimportexport" xmlns:ns13="http://oec.api.opsource.net/schemas/support" xmlns:ns7="http://oec.api.opsource.net/schemas/whitelabel" xmlns:ns10="http://oec.api.opsource.net/schemas/ipplan" xmlns:ns8="http://oec.api.opsource.net/schemas/datacenter" xmlns:ns11="http://oec.api.opsource.net/schemas/storage" xmlns:ns2="http://oec.api.opsource.net/schemas/organization" xmlns:ns4="http://oec.api.opsource.net/schemas/network" xmlns:ns3="http://oec.api.opsource.net/schemas/directory"> - <ns3:userName>testuser</ns3:userName> - <ns3:fullName>Test User</ns3:fullName> - <ns3:firstName>Test</ns3:firstName> - <ns3:lastName>User</ns3:lastName> - <ns3:emailAddress>[email protected]</ns3:emailAddress> - <ns3:orgId>8a8f6abc-2745-4d8a-9cbc-8dabe5a7d0e4</ns3:orgId> - <ns3:roles> - <ns3:role> - <ns3:name>create image</ns3:name> - </ns3:role> - <ns3:role> - <ns3:name>reports</ns3:name> - </ns3:role> - <ns3:role> - <ns3:name>server</ns3:name> - </ns3:role> - <ns3:role> - <ns3:name>primary administrator</ns3:name> - </ns3:role> - <ns3:role> - <ns3:name>network</ns3:name> - </ns3:role> - </ns3:roles> -</ns3:Account> http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/start_snapshot_preview.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/drs/fixtures/nttcis/start_snapshot_preview.xml b/libcloud/test/drs/fixtures/nttcis/start_snapshot_preview.xml deleted file mode 100644 index 50bede8..0000000 --- a/libcloud/test/drs/fixtures/nttcis/start_snapshot_preview.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181108T135438714-0500_b30a28fa-f9e4-4e04-ae4c-cf07a3b31bb4"> - <operation>START_PREVIEW_SNAPSHOT</operation> - <responseCode>IN_PROGRESS</responseCode> - <message>Request to Start Preview Snapshot has been accepted. Please use appropriate Get or List API for status.</message> -</response> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/fixtures/nttcis/stop_snapshot_preview.xml ---------------------------------------------------------------------- diff --git a/libcloud/test/drs/fixtures/nttcis/stop_snapshot_preview.xml b/libcloud/test/drs/fixtures/nttcis/stop_snapshot_preview.xml deleted file mode 100644 index 22ae894..0000000 --- a/libcloud/test/drs/fixtures/nttcis/stop_snapshot_preview.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<response xmlns="urn:didata.com:api:cloud:types" requestId="na_20181108T135122604-0500_c06c2498-63d0-4172-8476-5af1b1fe07db"> - <operation>STOP_PREVIEW_SNAPSHOT</operation> - <responseCode>IN_PROGRESS</responseCode> - <message>Request to Stop Preview Snapshot has been accepted. Please use appropriate Get or List API for status.</message> -</response> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1580f45/libcloud/test/drs/test_nttcis.py ---------------------------------------------------------------------- diff --git a/libcloud/test/drs/test_nttcis.py b/libcloud/test/drs/test_nttcis.py deleted file mode 100644 index 0070a6d..0000000 --- a/libcloud/test/drs/test_nttcis.py +++ /dev/null @@ -1,206 +0,0 @@ -import pytest -from libcloud.utils.py3 import httplib -from libcloud.test import MockHttp -from libcloud.common.nttcis import NttCisAPIException -from libcloud.drs.drivers.nttcis import NttCisDRSDriver -from libcloud.test.file_fixtures import DRSFileFixtures -from libcloud.test.secrets import NTTCIS_PARAMS - - [email protected]() -def driver(): - NttCisDRSDriver.connectionCls.active_api_version = "2.7" - NttCisDRSDriver.connectionCls.conn_class = NttCisMockHttp - NttCisMockHttp.type = None - driver = NttCisDRSDriver(*NTTCIS_PARAMS) - return driver - - -def test_ineligible_server(driver): - NttCisMockHttp.type = 'INPROGRESS' - with pytest.raises(NttCisAPIException) as excinfo: - driver.create_consistency_group( - "sdk_test2_cg", "100", "032f3967-00e4-4780-b4ef-8587460f9dd4", - "aee58575-38e2-495f-89d3-854e6a886411", - description="A test consistency group") - assert excinfo.value.msg == 'The drsEligible flag for target Server ' \ - 'aee58575-38e2-495f-89d3-854e6a886411 must be set.' - - -def test_list_consistency_groups(driver): - cgs = driver.list_consistency_groups() - assert isinstance(cgs, list) - assert hasattr(cgs[0], 'serverPair') - - -def test_get_consistency_group(driver): - cg = driver.get_consistency_group("3710c093-7dcc-4a21-bd07-af9f4d93b6b5") - assert cg.id == "3710c093-7dcc-4a21-bd07-af9f4d93b6b5" - - -def test_get_consistency_group_by_name(driver): - cgs = driver.list_consistency_groups(name="skd_test2_cg") - assert cgs[0].id == "3710c093-7dcc-4a21-bd07-af9f4d93b6b5" - - -def test_expand_journal(driver): - cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5" - size_gb = "100" - result = driver.expand_journal(cg_id, size_gb) - assert result is True - - -def test_list_snapshots(driver): - cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5" - result = driver.list_consistency_group_snapshots(cg_id) - assert hasattr(result, 'snapshot') - assert len(result.snapshot) == 11 - - -def test_list_snapshots_with_min(driver): - NttCisMockHttp.type = "WITH_MIN" - cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5" - result = driver.list_consistency_group_snapshots( - cg_id, create_time_min="2018-11-07T00:00:00.000-05:00") - assert hasattr(result, 'snapshot') - assert len(result.snapshot) == 87 - - -def test_start_snapshot_preview(driver): - snapshot_id = "87703" - cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5" - result = driver.start_failover_preview(cg_id, snapshot_id) - assert result is True - - -def test_stop_snapshot_preivew(driver): - cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5" - result = driver.stop_failover_preview(cg_id) - assert result is True - - -def test_initiate_failover(driver): - cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5" - result = driver.initiate_failover(cg_id) - assert result is True - - -def test_delete_consistency_group(driver): - cg_id = "3710c093-7dcc-4a21-bd07-af9f4d93b6b5" - result = driver.initiate_failover(cg_id) - assert result is True - - -class NttCisMockHttp(MockHttp): - - fixtures = DRSFileFixtures('nttcis') - - def _oec_0_9_myaccount(self, method, url, body, headers): - body = self.fixtures.load('oec_0_9_myaccount.xml') - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_INPROGRESS(self, method, url, body, headers): - body = self.fixtures.load('oec_0_9_myaccount.xml') - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _oec_0_9_myaccount_WITH_MIN(self, method, url, body, headers): - body = self.fixtures.load('oec_0_9_myaccount.xml') - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_createConsistencyGroup_INPROGRESS(self, - method, - url, - body, - headers): - body = self.fixtures.load( - 'drs_ineligible.xml' - ) - return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_consistencyGroup(self, - method, - url, - body, - headers): - body = self.fixtures.load("list_consistency_groups.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_consistencyGroup_3710c093_7dcc_4a21_bd07_af9f4d93b6b5(self, - method, - url, - body, - headers): - body = self.fixtures.load("get_consistency_group.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_consistencyGroup_name(self, - method, - url, - body, - headers): - body = self.fixtures.load("list_cg_by_params.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_expandJournal(self, - method, - url, - body, - headers): - body = self.fixtures.load("expand_cg.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_snapshot(self, - method, - url, - body, - headers): - body = self.fixtures.load("drs_snapshots.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_snapshot_WITH_MIN(self, - method, - url, - body, - headers): - body = self.fixtures.load("drs_snapshots_by_min.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_startPreviewSnapshot(self, - method, - url, - body, - headers): - body = self.fixtures.load("start_snapshot_preview.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_stopPreviewSnapshot(self, - method, - url, - body, - headers): - body = self.fixtures.load("stop_snapshot_preview.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_initiateFailover(self, - method, - url, - body, - headers): - body = self.fixtures.load("drs_initiate_failover.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_initiateFailover(self, - method, - url, - body, - headers): - body = self.fixtures.load("drs_initiate_failover.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) - - def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_consistencyGroup_deleteConsistencyGroup(self, - method, - url, - body, - headers): - body = self.fixtures.load("delete_consistency_group.xml") - return (httplib.OK, body, {}, httplib.responses[httplib.OK]) \ No newline at end of file
