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 2016/10/24 11:04:59 UTC

[1/8] libcloud git commit: Handle exception when powering off a server that is already stopped

Repository: libcloud
Updated Branches:
  refs/heads/trunk 50cba636e -> ebbacff26


Handle exception when powering off a server that is already stopped


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

Branch: refs/heads/trunk
Commit: 1f1233beb1a1cd34468136ce8588625ef7e3db8d
Parents: 94ab917
Author: Samuel Chong <sa...@gmail.com>
Authored: Mon Oct 17 10:49:37 2016 +1100
Committer: Samuel Chong <sa...@gmail.com>
Committed: Mon Oct 17 10:49:37 2016 +1100

----------------------------------------------------------------------
 libcloud/compute/drivers/dimensiondata.py | 32 ++++++++++++++++++--------
 1 file changed, 23 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/1f1233be/libcloud/compute/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py
index 5e6fe76..f8a1df4 100644
--- a/libcloud/compute/drivers/dimensiondata.py
+++ b/libcloud/compute/drivers/dimensiondata.py
@@ -21,6 +21,7 @@ try:
 except ImportError:
     from xml.etree import ElementTree as ET
 
+from libcloud.common.exceptions import BaseHTTPError
 from libcloud.compute.base import NodeDriver, Node, NodeAuthPassword
 from libcloud.compute.base import NodeSize, NodeImage, NodeLocation
 from libcloud.common.dimensiondata import dd_object_to_id
@@ -638,12 +639,25 @@ class DimensionDataNodeDriver(NodeDriver):
         """
         request_elm = ET.Element('powerOffServer',
                                  {'xmlns': TYPES_URN, 'id': node.id})
-        body = self.connection.request_with_orgId_api_2(
-            'server/powerOffServer',
-            method='POST',
-            data=ET.tostring(request_elm)).object
-        response_code = findtext(body, 'responseCode', TYPES_URN)
-        return response_code in ['IN_PROGRESS', 'OK']
+
+        response_code = None
+
+        try:
+            body = self.connection.request_with_orgId_api_2(
+                'server/powerOffServer',
+                method='POST',
+                data=ET.tostring(request_elm)).object
+            response_code = findtext(body, 'responseCode', TYPES_URN)
+        except (DimensionDataAPIException, NameError, BaseHTTPError):
+            r = self.ex_wait_for_state(
+                state='stopped',
+                func=self.ex_get_node_by_id,
+                id=node.id,
+                timeout=1)
+            if r is not None:
+                response_code = r.state.upper()
+            pass
+        return response_code in ['IN_PROGRESS', 'OK', 'STOPPED, STOPPING']
 
     def ex_reset(self, node):
         """
@@ -991,10 +1005,10 @@ class DimensionDataNodeDriver(NodeDriver):
     def ex_list_network_domains(self, location=None, name=None,
                                 service_plan=None, state=None):
         """
-        List networks domains deployed across all data center locations
-        for your organization.
-        The response includes the location of each network domain.
+        List networks domains deployed across all data center locations domain.
 
+        for your organization.
+        The response includes the location of each network
         :param      location: Only network domains in the location (optional)
         :type       location: :class:`NodeLocation` or ``str``
 


[7/8] libcloud git commit: changes for #902, #909

Posted by an...@apache.org.
changes for #902, #909


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

Branch: refs/heads/trunk
Commit: 7ed5858d7b91d9b08385230b61181b66418bb99f
Parents: 50cba63
Author: Anthony Shaw <an...@apache.org>
Authored: Mon Oct 24 12:04:13 2016 +0100
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Oct 24 12:04:13 2016 +0100

----------------------------------------------------------------------
 CHANGES.rst | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/7ed5858d/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 17f42d6..6857592 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -8,6 +8,15 @@ Changes in current version of Apache Libcloud
 Compute
 ~~~~~~~
 
+- [dimension data] Refactor create_node for MCP2 to support CaaS API 2.3 feature.
+  Can now specify Network Adapter Name for primary and additional NIC. Parameters in create_node function is tailored for MCP2.
+  (GITHUB-902)
+  [Samuel Chong]
+
+- Volume snapshot operations, i.e. creating, listing and deleting volume snapshots, for the Digital Ocean driver.
+  (LIBCLOUD-861, GITHUB-909)
+  [Fahri Cihan Demirci]
+
 - Added snapshot management to OVH compute
   (GITHUB-897)
   [Anthony Monthe]


[5/8] libcloud git commit: Fixed exception handling for powering off node

Posted by an...@apache.org.
Fixed exception handling for powering off node


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

Branch: refs/heads/trunk
Commit: d17901893f875d7c6c9aefbaea9f354e54bfd050
Parents: 50e9a57
Author: Samuel Chong <sa...@gmail.com>
Authored: Mon Oct 17 14:08:10 2016 +1100
Committer: Samuel Chong <sa...@gmail.com>
Committed: Mon Oct 17 14:08:10 2016 +1100

----------------------------------------------------------------------
 libcloud/compute/drivers/dimensiondata.py       | 13 ++-----
 .../fixtures/dimensiondata/server_GetServer.xml | 39 ++++++++++++++++++++
 libcloud/test/compute/test_dimensiondata.py     |  8 +++-
 3 files changed, 49 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1790189/libcloud/compute/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py
index bc8d565..0546ec3 100644
--- a/libcloud/compute/drivers/dimensiondata.py
+++ b/libcloud/compute/drivers/dimensiondata.py
@@ -640,8 +640,6 @@ class DimensionDataNodeDriver(NodeDriver):
         request_elm = ET.Element('powerOffServer',
                                  {'xmlns': TYPES_URN, 'id': node.id})
 
-        response_code = None
-
         try:
             body = self.connection.request_with_orgId_api_2(
                 'server/powerOffServer',
@@ -649,14 +647,9 @@ class DimensionDataNodeDriver(NodeDriver):
                 data=ET.tostring(request_elm)).object
             response_code = findtext(body, 'responseCode', TYPES_URN)
         except (DimensionDataAPIException, NameError, BaseHTTPError):
-            r = self.ex_wait_for_state(
-                state='stopped',
-                func=self.ex_get_node_by_id,
-                id=node.id,
-                timeout=1)
-            if r is not None:
-                response_code = r.state.upper()
-            pass
+            r = self.ex_get_node_by_id(node.id)
+            response_code = r.state.upper()
+
         return response_code in ['IN_PROGRESS', 'OK', 'STOPPED', 'STOPPING']
 
     def ex_reset(self, node):

http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1790189/libcloud/test/compute/fixtures/dimensiondata/server_GetServer.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/dimensiondata/server_GetServer.xml b/libcloud/test/compute/fixtures/dimensiondata/server_GetServer.xml
new file mode 100644
index 0000000..fc71562
--- /dev/null
+++ b/libcloud/test/compute/fixtures/dimensiondata/server_GetServer.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<server id="5a32d6e4-9707-4813-a269-56ab4d989f4d" datacenterId="NA9">
+    <name>Production Web Server</name>
+    <description>Server to host our main web application.</description>
+    <operatingSystem id="WIN2008S32" displayName="WIN2008S/32"
+                     family="WINDOWS"/>
+    <cpu count="2" speed="STANDARD" coresPerSocket="1"/>
+    <memoryGb>4</memoryGb>
+    <disk id="c2e1f199-116e-4dbc-9960-68720b832b0a" scsiId="0" sizeGb="50"
+          speed="STANDARD" state="NORMAL"/>
+    <networkInfo networkDomainId="553f26b6-2a73-42c3-a78b-6116f11291d0">
+        <primaryNic id="5e869800-df7b-4626-bcbf-8643b8be11fd"
+                    privateIpv4="10.0.4.8"
+                    ipv6="2607:f480:1111:1282:2960:fb72:7154:6160"
+                    vlanId="bc529e20-dc6f-42ba-be20-0ffe44d1993f"
+                    vlanName="Production VLAN" state="NORMAL"/>
+    </networkInfo>
+    <backup assetId="5579f3a7-4c32-4cf5-8a7e-b45c36a35c10"
+            servicePlan="Enterprise" state="NORMAL"/>
+    <monitoring monitoringId="11049" servicePlan="ESSENTIALS" state="NORMAL"/>
+    <softwareLabel>MSSQL2008R2S</softwareLabel>
+    <sourceImageId>3ebf3c0f-90fe-4a8b-8585-6e65b316592c</sourceImageId>
+    <createTime>2015-12-02T10:31:33.000Z</createTime>
+    <deployed>true</deployed>
+    <started>true</started>
+    <state>stopped</state>
+    <progress>
+        <action>SHUTDOWN_SERVER</action>
+        <requestTime>2015-12-02T11:07:40.000Z</requestTime>
+        <userName>devuser1</userName>
+    </progress>
+    <vmwareTools versionStatus="CURRENT" runningStatus="RUNNING"
+                 apiVersion="9354"/>
+    <virtualHardware version="vmx-08"
+                     upToDate="false"/> <!-- DRS: drsEligible or consistencyGroup or neither -->
+    <drsEligible/>
+    **OR**
+    <consistencyGroup id="1f4ef-1238933-2344adce-1098" name="ProductionCG" status="DRS_MODE" serverRole="TARGET"/>
+</server>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/d1790189/libcloud/test/compute/test_dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_dimensiondata.py b/libcloud/test/compute/test_dimensiondata.py
index 80dfa4a..7ea0d1e 100644
--- a/libcloud/test/compute/test_dimensiondata.py
+++ b/libcloud/test/compute/test_dimensiondata.py
@@ -515,8 +515,9 @@ class DimensionDataTests(unittest.TestCase, TestCaseMixin):
 
     def test_ex_power_off_INPROGRESS(self):
         DimensionDataMockHttp.type = 'INPROGRESS'
-        node = Node(id='11', name=None, state=None,
+        node = Node(id='11', name=None, state='STOPPING',
                     public_ips=None, private_ips=None, driver=self.driver)
+
         with self.assertRaises(DimensionDataAPIException):
             self.driver.ex_power_off(node)
 
@@ -2183,6 +2184,11 @@ class DimensionDataMockHttp(StorageMockHttp, MockHttp):
             'server_powerOffServer_INPROGRESS.xml')
         return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK])
 
+    def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_server_server_11_INPROGRESS(
+            self, method, url, body, headers):
+        body = self.fixtures.load('server_GetServer.xml')
+        return (httplib.BAD_REQUEST, body, {}, httplib.responses[httplib.OK])
+
     def _caas_2_3_8a8f6abc_2745_4d8a_9cbc_8dabe5a7d0e4_network_networkDomain(self, method, url, body, headers):
         body = self.fixtures.load(
             'network_networkDomain.xml')


[4/8] libcloud git commit: fix unit test

Posted by an...@apache.org.
fix unit test


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

Branch: refs/heads/trunk
Commit: 50e9a57e4071f04ff9bd2485f7f8248a87e4c8de
Parents: e04cbe6
Author: Samuel Chong <sa...@gmail.com>
Authored: Mon Oct 17 11:35:34 2016 +1100
Committer: Samuel Chong <sa...@gmail.com>
Committed: Mon Oct 17 11:35:34 2016 +1100

----------------------------------------------------------------------
 libcloud/common/dimensiondata.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/50e9a57e/libcloud/common/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/common/dimensiondata.py b/libcloud/common/dimensiondata.py
index 84bca0d..8eb5446 100644
--- a/libcloud/common/dimensiondata.py
+++ b/libcloud/common/dimensiondata.py
@@ -549,6 +549,8 @@ class DimensionDataConnection(ConnectionUserAndKey):
         :return: Result from the calling function.
         """
         cnt = 0
+        result = None
+        object_state = None
         while cnt < timeout / poll_interval:
             result = func(*args, **kwargs)
             if isinstance(result, Node):
@@ -561,7 +563,7 @@ class DimensionDataConnection(ConnectionUserAndKey):
             sleep(poll_interval)
             cnt += 1
 
-        msg = 'Status check for object %s timed out' % (result)
+        msg = 'Status check for object %s timed out' % result
         raise DimensionDataAPIException(code=object_state,
                                         msg=msg,
                                         driver=self.driver)


[8/8] libcloud git commit: Merge branch 'github-912' into trunk Closes #912

Posted by an...@apache.org.
Merge branch 'github-912' into trunk
Closes #912


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

Branch: refs/heads/trunk
Commit: ebbacff261b31ca29dd3c899ecffb08d1db7df8a
Parents: 7ed5858 64793fd
Author: Anthony Shaw <an...@apache.org>
Authored: Mon Oct 24 12:04:43 2016 +0100
Committer: Anthony Shaw <an...@apache.org>
Committed: Mon Oct 24 12:04:43 2016 +0100

----------------------------------------------------------------------
 libcloud/common/dimensiondata.py                |  2 +
 libcloud/compute/drivers/dimensiondata.py       | 25 ++++++++-----
 .../fixtures/dimensiondata/server_GetServer.xml | 39 ++++++++++++++++++++
 libcloud/test/compute/test_dimensiondata.py     |  8 +++-
 4 files changed, 64 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/ebbacff2/libcloud/common/dimensiondata.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ebbacff2/libcloud/compute/drivers/dimensiondata.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/libcloud/blob/ebbacff2/libcloud/test/compute/test_dimensiondata.py
----------------------------------------------------------------------


[3/8] libcloud git commit: Fixed response code missing single quote

Posted by an...@apache.org.
Fixed response code missing single quote


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

Branch: refs/heads/trunk
Commit: e04cbe61262c9f2c3c277f0309d1d2b77ebec0cf
Parents: a6e4543
Author: Samuel Chong <sa...@gmail.com>
Authored: Mon Oct 17 11:18:11 2016 +1100
Committer: Samuel Chong <sa...@gmail.com>
Committed: Mon Oct 17 11:18:11 2016 +1100

----------------------------------------------------------------------
 libcloud/compute/drivers/dimensiondata.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e04cbe61/libcloud/compute/drivers/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py
index fb90aca..bc8d565 100644
--- a/libcloud/compute/drivers/dimensiondata.py
+++ b/libcloud/compute/drivers/dimensiondata.py
@@ -657,7 +657,7 @@ class DimensionDataNodeDriver(NodeDriver):
             if r is not None:
                 response_code = r.state.upper()
             pass
-        return response_code in ['IN_PROGRESS', 'OK', 'STOPPED, STOPPING']
+        return response_code in ['IN_PROGRESS', 'OK', 'STOPPED', 'STOPPING']
 
     def ex_reset(self, node):
         """


[2/8] libcloud git commit: Merge remote-tracking branch 'apache/trunk' into enhance_get_resource_state

Posted by an...@apache.org.
Merge remote-tracking branch 'apache/trunk' into enhance_get_resource_state


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

Branch: refs/heads/trunk
Commit: a6e45436961be976a4075f305240fe91874e6d98
Parents: 1f1233b e4e56e9
Author: Samuel Chong <sa...@gmail.com>
Authored: Mon Oct 17 10:52:00 2016 +1100
Committer: Samuel Chong <sa...@gmail.com>
Committed: Mon Oct 17 10:52:00 2016 +1100

----------------------------------------------------------------------
 doap_libcloud.rdf                               |   7 ++
 docs/compute/index.rst                          |   2 +-
 docs/other/hacktoberfest.txt                    |   1 +
 libcloud/compute/drivers/dimensiondata.py       |   2 +-
 libcloud/container/drivers/rancher.py           |  33 +++---
 .../fixtures/dimensiondata/audit_log.csv        |  25 +++++
 libcloud/test/compute/test_dimensiondata.py     |  12 ++
 .../fixtures/rancher/start_container.json       | 109 +++++++++++++++++++
 libcloud/test/container/test_rancher.py         |   9 ++
 9 files changed, 180 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/a6e45436/libcloud/compute/drivers/dimensiondata.py
----------------------------------------------------------------------


[6/8] libcloud git commit: Add back parenthesis to safe guard format string in the future.

Posted by an...@apache.org.
Add back parenthesis to safe guard format string in the future.


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

Branch: refs/heads/trunk
Commit: 64793fdf65d5f77d3e0b6badc71565e552190190
Parents: d179018
Author: Samuel Chong <sa...@gmail.com>
Authored: Fri Oct 21 10:56:29 2016 +1100
Committer: Samuel Chong <sa...@gmail.com>
Committed: Fri Oct 21 10:56:29 2016 +1100

----------------------------------------------------------------------
 libcloud/common/dimensiondata.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/64793fdf/libcloud/common/dimensiondata.py
----------------------------------------------------------------------
diff --git a/libcloud/common/dimensiondata.py b/libcloud/common/dimensiondata.py
index 8eb5446..33a1221 100644
--- a/libcloud/common/dimensiondata.py
+++ b/libcloud/common/dimensiondata.py
@@ -563,7 +563,7 @@ class DimensionDataConnection(ConnectionUserAndKey):
             sleep(poll_interval)
             cnt += 1
 
-        msg = 'Status check for object %s timed out' % result
+        msg = 'Status check for object %s timed out' % (result)
         raise DimensionDataAPIException(code=object_state,
                                         msg=msg,
                                         driver=self.driver)