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/11/16 02:18:03 UTC

[1/7] libcloud git commit: Fix the bug that created the node at ecs driver

Repository: libcloud
Updated Branches:
  refs/heads/trunk f5f246eee -> fe34a54e0


Fix the bug that created the node at ecs driver

1, From the official document can know parameter param['IoOptimized'] type is string and his value is ``none`` or ``optimized``


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

Branch: refs/heads/trunk
Commit: 837f3c83b0360564a640c3b772c6f17b6fd1d858
Parents: ae98ebc
Author: hequn <he...@hihuron.com>
Authored: Thu Nov 10 15:06:37 2016 +0800
Committer: hequn <he...@hihuron.com>
Committed: Thu Nov 10 15:06:37 2016 +0800

----------------------------------------------------------------------
 libcloud/compute/drivers/ecs.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/837f3c83/libcloud/compute/drivers/ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ecs.py b/libcloud/compute/drivers/ecs.py
index d55ed53..1dc6cb5 100644
--- a/libcloud/compute/drivers/ecs.py
+++ b/libcloud/compute/drivers/ecs.py
@@ -675,9 +675,9 @@ class ECSDriver(NodeDriver):
 
         if ex_io_optimized is not None:
             optimized = ex_io_optimized
-            if not isinstance(optimized, bool):
-                optimized = str(optimized).lower() == 'true'
-            params['IoOptimized'] = 'true' if optimized else 'false'
+            if isinstance(optimized, bool):
+                optimized = 'optimized' if optimized else 'none'
+            params['IoOptimized'] = optimized
 
         if ex_system_disk:
             system_disk = self._get_system_disk(ex_system_disk)


[4/7] libcloud git commit: Merge branch 'trunk' of https://github.com/watermelo/libcloud into trunk

Posted by an...@apache.org.
Merge branch 'trunk' of https://github.com/watermelo/libcloud into trunk


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

Branch: refs/heads/trunk
Commit: 403825df03cd22995e2c28851c1cfd46595298b1
Parents: 32558b5 c591b6e
Author: hequn <he...@hihuron.com>
Authored: Tue Nov 15 09:56:53 2016 +0800
Committer: hequn <he...@hihuron.com>
Committed: Tue Nov 15 09:56:53 2016 +0800

----------------------------------------------------------------------

----------------------------------------------------------------------



[5/7] libcloud git commit: Fixed the creation of nodes bug.

Posted by an...@apache.org.
Fixed the creation of nodes bug.

1, Fixed the creation of nodes can not specify bandwidth bug.


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

Branch: refs/heads/trunk
Commit: 60bae834f2ba5cbce6a6eb2c834b8ac56db96c89
Parents: 403825d
Author: hequn <he...@hihuron.com>
Authored: Tue Nov 15 10:29:03 2016 +0800
Committer: hequn <he...@hihuron.com>
Committed: Tue Nov 15 10:29:03 2016 +0800

----------------------------------------------------------------------
 libcloud/compute/drivers/ecs.py | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/60bae834/libcloud/compute/drivers/ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ecs.py b/libcloud/compute/drivers/ecs.py
index bb34453..9b85ee9 100644
--- a/libcloud/compute/drivers/ecs.py
+++ b/libcloud/compute/drivers/ecs.py
@@ -1384,6 +1384,10 @@ class ECSDriver(NodeDriver):
                                          'mandatory for PayByTraffic internet'
                                          ' charge type.')
 
+        if ex_internet_max_bandwidth_out:
+            params['InternetMaxBandwidthOut'] = \
+                ex_internet_max_bandwidth_out
+
         if ex_internet_max_bandwidth_in:
             params['InternetMaxBandwidthIn'] = \
                 ex_internet_max_bandwidth_in


[7/7] libcloud git commit: Merge branch 'upstream' into trunk Closes #945

Posted by an...@apache.org.
Merge branch 'upstream' into trunk
Closes #945


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

Branch: refs/heads/trunk
Commit: fe34a54e0893973d8b70738a1ba01837be5e2992
Parents: bbba0ee f5f246e
Author: hequn <he...@hihuron.com>
Authored: Wed Nov 16 09:38:39 2016 +0800
Committer: Anthony Shaw <an...@apache.org>
Committed: Wed Nov 16 13:17:45 2016 +1100

----------------------------------------------------------------------
 CHANGES.rst                           | 13 ++++++
 docs/compute/_supported_providers.rst |  2 +-
 docs/compute/drivers/ec2.rst          |  1 +
 libcloud/__init__.py                  |  2 +-
 libcloud/common/azure_arm.py          |  2 +-
 libcloud/compute/drivers/ec2.py       | 63 ++++++++++++++++++++++++++++++
 libcloud/compute/types.py             |  2 +
 7 files changed, 82 insertions(+), 3 deletions(-)
----------------------------------------------------------------------



[3/7] libcloud git commit: Implement the method for creating public ip

Posted by an...@apache.org.
Implement the method for creating public ip


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

Branch: refs/heads/trunk
Commit: c591b6e2a7f37530ab525d410ebbbbefb3848c56
Parents: 04edfab
Author: hequn <he...@hihuron.com>
Authored: Mon Nov 14 10:49:48 2016 +0800
Committer: hequn <he...@hihuron.com>
Committed: Mon Nov 14 10:49:48 2016 +0800

----------------------------------------------------------------------
 libcloud/compute/drivers/ecs.py                   | 18 +++++++++++++++++-
 .../compute/fixtures/ecs/create_public_ip.xml     |  6 ++++++
 libcloud/test/compute/test_ecs.py                 | 10 ++++++++++
 3 files changed, 33 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/c591b6e2/libcloud/compute/drivers/ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ecs.py b/libcloud/compute/drivers/ecs.py
index 1dc6cb5..bb34453 100644
--- a/libcloud/compute/drivers/ecs.py
+++ b/libcloud/compute/drivers/ecs.py
@@ -477,7 +477,6 @@ class ECSDriver(NodeDriver):
     Used for Aliyun ECS service.
 
     TODO:
-    Create public IP address
     Get guest OS root password
     Adjust internet bandwidth settings
     Manage security groups and rules
@@ -1273,6 +1272,23 @@ class ECSDriver(NodeDriver):
         image_id = findtext(resp.object, 'ImageId', namespace=self.namespace)
         return self.get_image(image_id=image_id)
 
+    def create_public_ip(self, instance_id):
+            """
+            Create public ip.
+
+            :keyword instance_id: instance id for allocating public ip.
+            :type    instance_id: ``str``
+
+            :return public ip
+            :rtype ``str``
+            """
+            params = {'Action': 'AllocatePublicIpAddress',
+                      'InstanceId': instance_id}
+
+            resp = self.connection.request(self.path, params=params)
+            return findtext(resp.object, 'IpAddress',
+                            namespace=self.namespace)
+
     def _to_nodes(self, object):
         """
         Convert response to Node object list

http://git-wip-us.apache.org/repos/asf/libcloud/blob/c591b6e2/libcloud/test/compute/fixtures/ecs/create_public_ip.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/ecs/create_public_ip.xml b/libcloud/test/compute/fixtures/ecs/create_public_ip.xml
new file mode 100644
index 0000000..e723d7f
--- /dev/null
+++ b/libcloud/test/compute/fixtures/ecs/create_public_ip.xml
@@ -0,0 +1,6 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<AllocatePublicIpAddressResponse>
+    <RequestId>F2EF6A3B-E345-46B9-931E-0EA094818567</RequestId>
+    <IpAddress>10.1.149.159</IpAddress>
+</AllocatePublicIpAddressResponse>
+

http://git-wip-us.apache.org/repos/asf/libcloud/blob/c591b6e2/libcloud/test/compute/test_ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ecs.py b/libcloud/test/compute/test_ecs.py
index d1bbae9..f610da8 100644
--- a/libcloud/test/compute/test_ecs.py
+++ b/libcloud/test/compute/test_ecs.py
@@ -58,6 +58,7 @@ class ECSDriverTestCase(LibcloudTestCase):
                                             driver=self.driver)
         self.fake_location = NodeLocation(id=self.region, name=self.region,
                                           country=None, driver=self.driver)
+        self.fake_instance_id = 'fake_instance_id'
 
     def test_list_nodes(self):
         nodes = self.driver.list_nodes()
@@ -247,6 +248,11 @@ class ECSDriverTestCase(LibcloudTestCase):
         result = self.driver.ex_stop_node(self.fake_node, ex_force_stop=True)
         self.assertTrue(result)
 
+    def test_create_public_ip(self):
+        ECSMockHttp.type = 'create_public_ip'
+        result = self.driver.create_public_ip(self.fake_instance_id)
+        self.assertTrue(result)
+
     def test_list_volumes(self):
         volumes = self.driver.list_volumes()
         self.assertEqual(2, len(volumes))
@@ -930,6 +936,10 @@ class ECSMockHttp(MockHttpTestCase):
         resp_body = self.fixtures.load('describe_zones.xml')
         return (httplib.OK, resp_body, {}, httplib.responses[httplib.OK])
 
+    def _create_public_ip_AllocatePublicIpAddress(self, method, url, body, headers):
+        resp_body = self.fixtures.load('create_public_ip.xml')
+        return (httplib.OK, resp_body, {}, httplib.responses[httplib.OK])
+
 
 if __name__ == '__main__':
     sys.exit(unittest.main())


[6/7] libcloud git commit: Modified forward push

Posted by an...@apache.org.
Modified forward push


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

Branch: refs/heads/trunk
Commit: bbba0ee7e8e1324c074d07ebf725c4f96b018b09
Parents: 60bae83
Author: hequn <he...@hihuron.com>
Authored: Tue Nov 15 10:56:22 2016 +0800
Committer: hequn <he...@hihuron.com>
Committed: Tue Nov 15 10:56:22 2016 +0800

----------------------------------------------------------------------
 libcloud/compute/drivers/ecs.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/bbba0ee7/libcloud/compute/drivers/ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ecs.py b/libcloud/compute/drivers/ecs.py
index 9b85ee9..03105ca 100644
--- a/libcloud/compute/drivers/ecs.py
+++ b/libcloud/compute/drivers/ecs.py
@@ -1383,10 +1383,9 @@ class ECSDriver(NodeDriver):
                     raise AttributeError('ex_internet_max_bandwidth_out is '
                                          'mandatory for PayByTraffic internet'
                                          ' charge type.')
-
-        if ex_internet_max_bandwidth_out:
-            params['InternetMaxBandwidthOut'] = \
-                ex_internet_max_bandwidth_out
+            elif ex_internet_max_bandwidth_out:
+                params['InternetMaxBandwidthOut'] = \
+                    ex_internet_max_bandwidth_out
 
         if ex_internet_max_bandwidth_in:
             params['InternetMaxBandwidthIn'] = \


[2/7] libcloud git commit: add unit test

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


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

Branch: refs/heads/trunk
Commit: 04edfab3381fdbf6ad3ccca928dd69e7523bec9c
Parents: 837f3c8
Author: hequn <he...@hihuron.com>
Authored: Mon Nov 14 09:53:01 2016 +0800
Committer: hequn <he...@hihuron.com>
Committed: Mon Nov 14 09:53:01 2016 +0800

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


http://git-wip-us.apache.org/repos/asf/libcloud/blob/04edfab3/libcloud/test/compute/test_ecs.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ecs.py b/libcloud/test/compute/test_ecs.py
index 5c4b099..d1bbae9 100644
--- a/libcloud/test/compute/test_ecs.py
+++ b/libcloud/test/compute/test_ecs.py
@@ -579,7 +579,7 @@ class ECSMockHttp(MockHttpTestCase):
                   'InternetMaxBandwidthIn': '200',
                   'HostName': 'hostname',
                   'Password': 'password',
-                  'IoOptimized': 'true',
+                  'IoOptimized': 'optimized',
                   'SystemDisk.Category': 'cloud',
                   'SystemDisk.DiskName': 'root',
                   'SystemDisk.Description': 'sys',