libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [40/45] libcloud git commit: removed drs from provider feature matrix
Date Thu, 13 Dec 2018 11:26:49 GMT
removed drs from provider feature matrix


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

Branch: refs/heads/trunk
Commit: 2b445ceac7586d09507735435c6fccc938459b19
Parents: bbe90e5
Author: mitch <mitch.raful@itaas.dimensiondata.com>
Authored: Wed Nov 28 22:17:31 2018 -0500
Committer: mitch <mitch.raful@itaas.dimensiondata.com>
Committed: Wed Nov 28 22:17:31 2018 -0500

----------------------------------------------------------------------
 .../generate_provider_feature_matrix_table.py   | 21 -----
 libcloud/base.py                                |  7 --
 libcloud/compute/drivers/nttcis.py              | 36 +++++----
 .../fixtures/nttcis/create_preview_server.xml   |  7 ++
 .../nttcis/disable_server_snapshot_service.xml  |  6 ++
 .../nttcis/initiate_manual_snapshot.xml         |  2 +-
 .../fixtures/nttcis/list_server_snapshots.xml   | 27 +++++++
 .../fixtures/nttcis/manual_snapshot_server.xml  | 26 +++++++
 libcloud/test/compute/test_nttcis.py            | 80 +++++++++++++++++++-
 9 files changed, 166 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/contrib/generate_provider_feature_matrix_table.py
----------------------------------------------------------------------
diff --git a/contrib/generate_provider_feature_matrix_table.py b/contrib/generate_provider_feature_matrix_table.py
index 419baee..4e6441f 100755
--- a/contrib/generate_provider_feature_matrix_table.py
+++ b/contrib/generate_provider_feature_matrix_table.py
@@ -45,11 +45,6 @@ from libcloud.dns.providers import get_driver as get_dns_driver
 from libcloud.dns.providers import DRIVERS as DNS_DRIVERS
 from libcloud.dns.types import Provider as DNSProvider
 
-from libcloud.drs.base import DRSDriver
-from libcloud.drs.providers import get_driver as get_drs_driver
-from libcloud.drs.providers import DRIVERS as DRS_DRIVERS
-from libcloud.drs.types import Provider as DRSProvider
-
 from libcloud.container.base import ContainerDriver
 from libcloud.container.providers import get_driver as get_container_driver
 from libcloud.container.providers import DRIVERS as CONTAINER_DRIVERS
@@ -94,11 +89,6 @@ BASE_API_METHODS = {
     'dns': ['list_zones', 'list_records', 'iterate_zones', 'iterate_records',
             'create_zone', 'update_zone', 'create_record', 'update_record',
             'delete_zone', 'delete_record'],
-    'drs': ['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'],
     'container': ['install_image', 'list_images', 'deploy_container',
                   'get_container', 'start_container', 'stop_container',
                   'restart_container', 'destroy_container', 'list_containers',
@@ -179,17 +169,6 @@ FRIENDLY_METHODS_NAMES = {
         'delete_zone': 'delete zone',
         'delete_record': 'delete record'
     },
-    'drs': {
-        'create_consistency_group': 'create_consistency_group',
-        'list_consistency_groups': 'list_consistency_groups',
-        'get_consistency_group': 'get_consistency_group',
-        'delete_consistency_group': 'delete_consistency_group',
-        'list_consistency_group_snapshots': 'list_consistency_group_snapshots',
-        'expand_journal': 'expand_journal',
-        'start_failover_preview': 'start_failover_preview',
-        'stop_failover_preview': 'stop_failover_preview',
-        'initiate_failover': 'initiate_failover'
-    },
     'container': {
         'install_image': 'install image',
         'list_images': 'list images',

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/base.py
----------------------------------------------------------------------
diff --git a/libcloud/base.py b/libcloud/base.py
index dead087..94e9f17 100644
--- a/libcloud/base.py
+++ b/libcloud/base.py
@@ -25,9 +25,6 @@ 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
@@ -49,9 +46,6 @@ class DriverType(object):
     """ DNS service provider driver """
     DNS = DnsProvider
 
-    """ DRS service provider driver """
-    DRS = DrsProvider
-
     """ Load balancer provider-driver """
     LOADBALANCER = LoadBalancerProvider
 
@@ -64,7 +58,6 @@ 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/2b445cea/libcloud/compute/drivers/nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/nttcis.py b/libcloud/compute/drivers/nttcis.py
index 8f7deef..8980051 100644
--- a/libcloud/compute/drivers/nttcis.py
+++ b/libcloud/compute/drivers/nttcis.py
@@ -1319,18 +1319,23 @@ class NttCisNodeDriver(NodeDriver):
         response_code = findtext(result, 'responseCode', TYPES_URN)
         return response_code in ['IN_PROGRESS', 'OK']
 
-    def list_snapshots(self, node):
+    def list_snapshots(self, node, page_size=None):
         """
-        List snapshots of a server
+        List snapshots of a server. The list of snapshots can get large.
+        Therefore, page_size is optional to limit this if desired.
 
-        :param      node: Node nameof the node on which to enable snapshots.
-        :type       node: ``str``
-
-        :rtype: ``list``
+        :param node: Node nameof the node on which to enable snapshots.
+        :type node: ``str``
+        :param page_size: (Optional) Limit the number of records returned
+        :return snapshots
+        :rtype: ``list`` of `dictionaries`
         """
 
         params = {}
         params['serverId'] = self.list_nodes(ex_name=node)[0].id
+        if page_size is not None:
+            params["pageSize"] = page_size
+
         return self._to_snapshots(self.connection.request_with_orgId_api_2(
             'snapshot/snapshot',
             params=params).object)
@@ -1339,9 +1344,9 @@ class NttCisNodeDriver(NodeDriver):
         """
         Get snapshot of a server by snapshot id.
 
-        :param      snapshot_id: ID of snapshot to retrieve.
-        :type       snapshot_id: ``str``
-
+        :param snapshot_id: ID of snapshot to retrieve.
+        :type  snapshot_id: ``str``
+        :return a snapshot
         :rtype: ``dict``
         """
 
@@ -1352,10 +1357,10 @@ class NttCisNodeDriver(NodeDriver):
         """
         Disable snapshots on a server.  This also deletes current snapshots.
 
-        :param      node: Node ID of the node on which to enable snapshots.
-        :type       node: ``str``
-
-        :rtype: ``list``
+        :param node: Node ID of the node on which to enable snapshots.
+        :type node: ``str``
+        :return True or False
+        :rtype: ``bool``
         """
 
         update_node = ET.Element('disableSnapshotService',
@@ -1481,9 +1486,8 @@ class NttCisNodeDriver(NodeDriver):
             'snapshot/createSnapshotPreviewServer',
             method='POST',
             data=ET.tostring(create_preview)).object
-        for info in findall(result, 'info', TYPES_URN):
-            if info.get('name') == 'serverId':
-                return info.get('value')
+        response_code = findtext(result, 'responseCode', TYPES_URN)
+        return response_code in ['IN_PROGRESS', 'OK']
 
     def ex_migrate_preview_server(self, preview_id):
         migrate_preview = ET.Element('migrateSnapshotPreviewServer',

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/test/compute/fixtures/nttcis/create_preview_server.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/create_preview_server.xml b/libcloud/test/compute/fixtures/nttcis/create_preview_server.xml
index e69de29..6715c64 100644
--- a/libcloud/test/compute/fixtures/nttcis/create_preview_server.xml
+++ b/libcloud/test/compute/fixtures/nttcis/create_preview_server.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="eu_20181128T230815109+0100_29483e8f-e94d-4472-8c92-723b9068828d">
+    <operation>CREATE_SNAPSHOT_PREVIEW_SERVER</operation>
+    <responseCode>IN_PROGRESS</responseCode>
+    <message>Request to Create Snapshot Preview Server has been accepted. Please use
appropriate Get or List API for status.</message>
+    <info name="serverId" value="17bff533-1959-4d16-b0bc-cea6f4cd1bb6"/>
+</response>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/test/compute/fixtures/nttcis/disable_server_snapshot_service.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/disable_server_snapshot_service.xml b/libcloud/test/compute/fixtures/nttcis/disable_server_snapshot_service.xml
index e69de29..32f3eb8 100644
--- a/libcloud/test/compute/fixtures/nttcis/disable_server_snapshot_service.xml
+++ b/libcloud/test/compute/fixtures/nttcis/disable_server_snapshot_service.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<response xmlns="urn:didata.com:api:cloud:types" requestId="eu_20181129T033624848+0100_8c78e514-872a-4bb9-bfb9-b02fb33a7713">
+    <operation>DISABLE_SNAPSHOT_SERVICE</operation>
+    <responseCode>OK</responseCode>
+    <message>Snapshot Service has been disabled.</message>
+</response>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/test/compute/fixtures/nttcis/initiate_manual_snapshot.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/initiate_manual_snapshot.xml b/libcloud/test/compute/fixtures/nttcis/initiate_manual_snapshot.xml
index 988342b..7c461ed 100644
--- a/libcloud/test/compute/fixtures/nttcis/initiate_manual_snapshot.xml
+++ b/libcloud/test/compute/fixtures/nttcis/initiate_manual_snapshot.xml
@@ -4,4 +4,4 @@
     <responseCode>IN_PROGRESS</responseCode>
     <message>Request to Initiate Manual Snapshot has been accepted. Please use appropriate
Get or List API for status.</message>
     <info name="manualSnapshotId" value="dd9a9e7e-2de7-4543-adef-bb1fda7ac030"/>
-</response>
\ No newline at end of file
+</response>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/test/compute/fixtures/nttcis/list_server_snapshots.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/list_server_snapshots.xml b/libcloud/test/compute/fixtures/nttcis/list_server_snapshots.xml
index e69de29..0096857 100644
--- a/libcloud/test/compute/fixtures/nttcis/list_server_snapshots.xml
+++ b/libcloud/test/compute/fixtures/nttcis/list_server_snapshots.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<snapshots xmlns="urn:didata.com:api:cloud:types" pageNumber="1" pageCount="1" totalCount="43"
pageSize="1">
+    <snapshot id="d11940a8-1455-43bf-a2de-b51a38c2aa94">
+        <startTime>2018-08-15T12:00:47.000Z</startTime>
+        <expiryTime>2019-08-15T12:00:47.000Z</expiryTime>
+        <type>SYSTEM</type>
+        <consistencyLevel>CRASH_CONSISTENT</consistencyLevel>
+        <indexState>INDEX_VALID</indexState>
+        <serverConfig>
+            <cluster id="EU6-01" name="Default Cluster"/>
+            <cpu count="2" speed="STANDARD" coresPerSocket="1"/>
+            <memoryGb>4</memoryGb>
+            <scsiController busNumber="0" id="3e27b3ff-f34c-4b50-abac-c4dbf17c46d3" adapterType="LSI_LOGIC_PARALLEL"
state="NORMAL">
+                <disk scsiId="0" id="0bb10086-9691-4cd7-9ae3-914c79890250" sizeGb="20"
speed="STANDARD" driveType="DISK" state="NORMAL"/>
+            </scsiController>
+            <networkInfo networkDomainId="6aafcf08-cb0b-432c-9c64-7371265db086" networkDomainName="sdk_test_1">
+                <primaryNic id="29ccc441-9972-41df-b918-b9c93a1b46e9" privateIpv4="10.1.1.6"
ipv6="2a00:47c0:111:1331:6140:e432:729b:eef6" vlanId="eb05a24e-85a6-46e3-a7c9-f1765737476d"
vlanName="sdk_vlan1" networkAdapter="VMXNET3" connected="true" key="4000" state="NORMAL"/>
+            </networkInfo>
+            <guest osCustomization="true">
+                <operatingSystem id="UBUNTU1664" displayName="UBUNTU16/64" family="UNIX"/>
+            </guest>
+            <virtualHardwareVersion>vmx-10</virtualHardwareVersion>
+        </serverConfig>
+        <state>NORMAL</state>
+        <createTime>2018-08-15T12:30:50.000Z</createTime>
+    </snapshot>
+</snapshots>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/test/compute/fixtures/nttcis/manual_snapshot_server.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/nttcis/manual_snapshot_server.xml b/libcloud/test/compute/fixtures/nttcis/manual_snapshot_server.xml
index e69de29..0f3e7e5 100644
--- a/libcloud/test/compute/fixtures/nttcis/manual_snapshot_server.xml
+++ b/libcloud/test/compute/fixtures/nttcis/manual_snapshot_server.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server xmlns="urn:didata.com:api:cloud:types" id="e1eb7d71-93c9-4b9c-807c-e05932dc8143"
datacenterId="EU6">
+    <name>test</name>
+    <description>auto_created_server</description>
+    <cpu count="2" speed="STANDARD" coresPerSocket="1"/>
+    <memoryGb>4</memoryGb>
+    <scsiController state="NORMAL" id="f6a0a9b4-8e8e-4db4-84a3-6aed43f2a6ee" adapterType="LSI_LOGIC_PARALLEL"
key="1000" busNumber="0">
+        <disk state="NORMAL" id="b96f35f3-ad63-489a-9e0e-a675cd1d1143" sizeGb="20" speed="STANDARD"
scsiId="0"/>
+    </scsiController>
+    <networkInfo networkDomainId="6aafcf08-cb0b-432c-9c64-7371265db086">
+        <primaryNic id="8f2c0823-94f9-4ac7-a59d-d0ed292da7b0" privateIpv4="10.1.1.10"
ipv6="2a00:47c0:111:1331:524d:5ca0:b59c:4220" vlanId="eb05a24e-85a6-46e3-a7c9-f1765737476d"
vlanName="sdk_vlan1" networkAdapter="VMXNET3" connected="true" macAddress="00:50:56:bb:9b:d5"
key="4000" state="NORMAL"/>
+    </networkInfo>
+    <snapshotService servicePlan="ADVANCED" state="NORMAL" manualSnapshotInProgress="false">
+        <window dayOfWeek="DAILY" startHour="12"/>
+    </snapshotService>
+    <source type="IMAGE_ID" value="81a36aa0-555c-4735-b965-4b64fcf0ac8f"/>
+    <createTime>2018-11-15T19:23:36.000Z</createTime>
+    <deployed>true</deployed>
+    <started>true</started>
+    <state>NORMAL</state>
+    <guest osCustomization="true">
+        <operatingSystem id="UBUNTU1664" displayName="UBUNTU16/64" family="UNIX" osUnitsGroupId="CANONICAL"/>
+        <vmTools type="OPEN_VM_TOOLS" versionStatus="UNMANAGED" runningStatus="RUNNING"
apiVersion="10304"/>
+    </guest>
+    <virtualHardware version="vmx-10" upToDate="false"/>
+</server>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2b445cea/libcloud/test/compute/test_nttcis.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_nttcis.py b/libcloud/test/compute/test_nttcis.py
index 7f894bd..7f73473 100644
--- a/libcloud/test/compute/test_nttcis.py
+++ b/libcloud/test/compute/test_nttcis.py
@@ -186,6 +186,42 @@ def test_list_datacenter_snapshot_windows(driver):
     assert isinstance(ret[0], dict)
 
 
+def test_list_snapshots(driver):
+    NttCisMockHttp.type = None
+    snapshots = driver.list_snapshots('sdk_server_1', page_size=1)
+    assert len(snapshots) == 1
+    assert snapshots[0]['id'] == "d11940a8-1455-43bf-a2de-b51a38c2aa94"
+
+
+def test_enable_snapshot_service(driver):
+    NttCisMockHttp.type = None
+    window_id = 'ea646520-4272-11e8-838c-180373fb68df'
+    node = 'e1eb7d71-93c9-4b9c-807c-e05932dc8143'
+    result = driver.ex_enable_snapshots(node, window_id)
+    assert result is True
+
+
+def test_initiate_manual_snapshot(driver):
+    NttCisMockHttp.type = None
+    result = driver.ex_initiate_manual_snapshot('test', 'e1eb7d71-93c9-4b9c-807c-e05932dc8143')
+    assert result is True
+
+
+def test_create_snapshot_preview_server(driver):
+    snapshot_id = "dd9a9e7e-2de7-4543-adef-bb1fda7ac030"
+    server_name = "test_snapshot"
+    start = "true"
+    nic_connected = "true"
+    result = driver.ex_create_snapshot_preview_server(
+        snapshot_id, server_name, start, nic_connected)
+    assert result is True
+
+
+def test_disable_node_snapshot(driver):
+    node = "e1eb7d71-93c9-4b9c-807c-e05932dc8143"
+    assert driver.ex_disable_snapshots(node) is True
+
+
 def test_reboot_node_response(driver):
     node = Node(id='11', name=None, state=None,
                 public_ips=None, private_ips=None, driver=driver)
@@ -3029,4 +3065,46 @@ class NttCisMockHttp(MockHttp):
         body = self.fixtures.load(
             'deploy_customised_server.xml'
         )
-        return httplib.OK, body, {}, httplib.responses[httplib.OK]
\ No newline at end of file
+        return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+    def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_snapshot_snapshot(
+        self, method, url, body, headers):
+        body = self.fixtures.load(
+            "list_server_snapshots.xml"
+        )
+        return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+    def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_snapshot_enableSnapshotService(
+        self, method, url, body, headers):
+        body = self.fixtures.load(
+            "enable_snapshot_service.xml"
+        )
+        return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+    def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_snapshot_initiateManualSnapshot(
+        self, method, url, body, headers):
+        body = self.fixtures.load(
+            "initiate_manual_snapshot.xml"
+        )
+        return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+    def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_e1eb7d71_93c9_4b9c_807c_e05932dc8143(
+        self, method, url, body, headers):
+        body = self.fixtures.load(
+            "manual_snapshot_server.xml"
+        )
+        return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+    def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_snapshot_createSnapshotPreviewServer(
+        self, method, url, body, headers):
+        body = self.fixtures.load(
+            "create_preview_server.xml"
+        )
+        return httplib.OK, body, {}, httplib.responses[httplib.OK]
+
+    def _caas_2_7_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_snapshot_disableSnapshotService(
+        self, method, url, body, headers):
+        body = self.fixtures.load(
+            "disable_server_snapshot_service.xml"
+        )
+        return httplib.OK, body, {}, httplib.responses[httplib.OK]


Mime
View raw message