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/07 02:24:57 UTC

[01/12] libcloud git commit: Add tests and fixtures FCU GetProductType API

Repository: libcloud
Updated Branches:
  refs/heads/trunk 12d4cf030 -> a37a02a80


Add tests and fixtures FCU GetProductType API

Signed-off-by: Javier M. Mellid <jm...@igalia.com>


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

Branch: refs/heads/trunk
Commit: 797ef7885255d549422fd360007c7c7f8411e570
Parents: dccaabd
Author: Javier M. Mellid <jm...@igalia.com>
Authored: Tue Oct 4 12:14:24 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Oct 7 13:23:41 2016 +1100

----------------------------------------------------------------------
 libcloud/test/compute/fixtures/fcu/ex_get_product_type.xml | 6 ++++++
 libcloud/test/compute/test_ec2.py                          | 9 +++++++++
 2 files changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/797ef788/libcloud/test/compute/fixtures/fcu/ex_get_product_type.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/fcu/ex_get_product_type.xml b/libcloud/test/compute/fixtures/fcu/ex_get_product_type.xml
new file mode 100644
index 0000000..e5ea50c
--- /dev/null
+++ b/libcloud/test/compute/fixtures/fcu/ex_get_product_type.xml
@@ -0,0 +1,6 @@
+<GetProductTypeResponse
+    xmlns="http://api.outscale.com/wsdl/fcuext/2014-04-15/">
+    <requestId>e37f7876-8379-4505-8c3c-73c500e34257</requestId>
+    <productTypeId>0002</productTypeId>
+    <description>Windows</description>
+</GetProductTypeResponse>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/797ef788/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index f772518..bdeda9a 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -1810,6 +1810,10 @@ class FCUMockHttp(EC2MockHttp):
         body = self.fixtures.load('ex_describe_instance_types.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
+    def _GetProductType(self, method, url, body, headers):
+        body = self.fixtures.load('ex_get_product_type.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
 
 class OutscaleFCUTests(LibcloudTestCase):
 
@@ -1846,6 +1850,11 @@ class OutscaleFCUTests(LibcloudTestCase):
         self.assertTrue('68718428160' in it.values())
         self.assertTrue(it['m3.large'] == '8050966528')
 
+    def test_ex_get_product_type(self):
+        product_type = self.driver.ex_get_product_type('ami-29ab9e54')
+        self.assertTrue(product_type['productTypeId'] == '0002')
+        self.assertTrue(product_type['description'] == 'Windows')
+
 
 if __name__ == '__main__':
     sys.exit(unittest.main())


[07/12] libcloud git commit: Add new DescribeInstanceTypes API in Outscale EC2 driver

Posted by an...@apache.org.
Add new DescribeInstanceTypes API in Outscale EC2 driver

Signed-off-by: Javier M. Mellid <jm...@igalia.com>


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

Branch: refs/heads/trunk
Commit: 97223fa311d3adea404420f51d4d75916a3011a3
Parents: c6527a5
Author: Javier M. Mellid <jm...@igalia.com>
Authored: Mon Oct 3 13:38:36 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Oct 7 13:23:41 2016 +1100

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


http://git-wip-us.apache.org/repos/asf/libcloud/blob/97223fa3/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index cf5184c..77211cd 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -6949,6 +6949,68 @@ class OutscaleNodeDriver(BaseEC2NodeDriver):
 
         return product_types
 
+    def _to_instance_types(self, elem):
+
+        instance_types = []
+        for instance_types_item in findall(element=elem,
+                                           xpath='instanceTypeSet/item',
+                                           namespace=OUTSCALE_NAMESPACE):
+            name = findtext(element=instance_types_item,
+                            xpath='name',
+                            namespace=OUTSCALE_NAMESPACE)
+            vcpu = findtext(element=instance_types_item,
+                            xpath='vcpu',
+                            namespace=OUTSCALE_NAMESPACE)
+            memory = findtext(element=instance_types_item,
+                              xpath='memory',
+                              namespace=OUTSCALE_NAMESPACE)
+            storageSize = findtext(element=instance_types_item,
+                                   xpath='storageSize',
+                                   namespace=OUTSCALE_NAMESPACE)
+            storageCount = findtext(element=instance_types_item,
+                                    xpath='storageCount',
+                                    namespace=OUTSCALE_NAMESPACE)
+            maxIpAddresses = findtext(element=instance_types_item,
+                                      xpath='maxIpAddresses',
+                                      namespace=OUTSCALE_NAMESPACE)
+            ebsOptimizedAvailable = findtext(element=instance_types_item,
+                                             xpath='ebsOptimizedAvailable',
+                                             namespace=OUTSCALE_NAMESPACE)
+            d = {'name': name,
+                 'vcpu': vcpu,
+                 'memory': memory,
+                 'storageSize': storageSize,
+                 'storageCount': storageCount,
+                 'maxIpAddresses': maxIpAddresses,
+                 'ebsOptimizedAvailable': ebsOptimizedAvailable}
+            instance_types.append(d)
+
+        return instance_types
+
+    def ex_describe_instance_types(self, filters=None):
+        """
+        Describes Instance Types.
+
+        :param      filters: The filters so that the response includes
+                             information for only instance types
+        :type       filters: ``dict``
+
+        :return:    A instance types list
+        :rtype:     ``list``
+        """
+
+        params = {'Action': 'DescribeInstanceTypes'}
+
+        if filters:
+            params.update(self._build_filters(filters))
+
+        response = self.connection.request(self.path, params=params,
+                                           method='GET').object
+
+        instance_types = self._to_instance_types(response)
+
+        return instance_types
+
 
 class OutscaleSASNodeDriver(OutscaleNodeDriver):
     """


[05/12] libcloud git commit: Add new DescribeQuota API in Outscale EC2 driver

Posted by an...@apache.org.
Add new DescribeQuota API in Outscale EC2 driver

Signed-off-by: Javier M. Mellid <jm...@igalia.com>


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

Branch: refs/heads/trunk
Commit: e45b3d05200bd626d325c783158102dd8010f441
Parents: a3dbabd
Author: Javier M. Mellid <jm...@igalia.com>
Authored: Mon Oct 3 12:33:49 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Oct 7 13:23:41 2016 +1100

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


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e45b3d05/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 10889c7..7a4a9d6 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -6563,6 +6563,7 @@ class OutscaleConnection(EC2Connection):
     Connection class for Outscale
     """
 
+    version = DEFAULT_OUTSCALE_API_VERSION
     host = None
 
 
@@ -6810,6 +6811,103 @@ class OutscaleNodeDriver(BaseEC2NodeDriver):
             sizes.append(NodeSize(driver=self, **attributes))
         return sizes
 
+    def _to_quota(self, elem):
+        """
+        To Quota
+        """
+
+        quota = {}
+        for reference_quota_item in findall(element=elem,
+                                            xpath='referenceQuotaSet/item',
+                                            namespace=OUTSCALE_NAMESPACE):
+            reference = findtext(element=reference_quota_item,
+                                 xpath='reference',
+                                 namespace=OUTSCALE_NAMESPACE)
+            quota_set = []
+            for quota_item in findall(element=reference_quota_item,
+                                      xpath='quotaSet/item',
+                                      namespace=OUTSCALE_NAMESPACE):
+                ownerId = findtext(element=quota_item,
+                                   xpath='ownerId',
+                                   namespace=OUTSCALE_NAMESPACE)
+                name = findtext(element=quota_item,
+                                xpath='name',
+                                namespace=OUTSCALE_NAMESPACE)
+                displayName = findtext(element=quota_item,
+                                       xpath='displayName',
+                                       namespace=OUTSCALE_NAMESPACE)
+                description = findtext(element=quota_item,
+                                       xpath='description',
+                                       namespace=OUTSCALE_NAMESPACE)
+                groupName = findtext(element=quota_item,
+                                     xpath='groupName',
+                                     namespace=OUTSCALE_NAMESPACE)
+                maxQuotaValue = findtext(element=quota_item,
+                                         xpath='maxQuotaValue',
+                                         namespace=OUTSCALE_NAMESPACE)
+                usedQuotaValue = findtext(element=quota_item,
+                                          xpath='usedQuotaValue',
+                                          namespace=OUTSCALE_NAMESPACE)
+                quota_set.append({'ownerId': ownerId,
+                                  'name': name,
+                                  'displayName': displayName,
+                                  'description': description,
+                                  'groupName': groupName,
+                                  'maxQuotaValue': maxQuotaValue,
+                                  'usedQuotaValue': usedQuotaValue})
+            quota[reference] = quota_set
+
+        return quota
+
+    def ex_describe_quota(self, dry_run=False, filters=None,
+                          max_results=None, marker=None):
+        """
+        Describes one or more of your quotas.
+
+        :param      dry_run: dry_run
+        :type       dry_run: ``bool``
+
+        :param      filters: The filters so that the response includes
+                             information for only certain quotas
+        :type       filters: ``dict``
+
+        :param      max_results: The maximum number of items that can be
+                                 returned in a single page (by default, 100)
+        :type       max_results: ``int``
+
+        :param      marker: Set quota marker
+        :type       marker: ``string``
+
+        :return:    (is_truncated, quota) tuple
+        :rtype:     ``(bool, dict)``
+        """
+
+        if filters:
+            raise NotImplementedError(
+                'quota filters are not implemented')
+
+        if marker:
+            raise NotImplementedError(
+                'quota marker is not implemented')
+
+        params = {'Action': 'DescribeQuota'}
+
+        if dry_run:
+            params.update({'DryRun': dry_run})
+
+        if max_results:
+            params.update({'MaxResults': max_results})
+
+        response = self.connection.request(self.path, params=params,
+                                           method='GET').object
+
+        quota = self._to_quota(response)
+
+        is_truncated = findtext(element=response, xpath='isTruncated',
+                                namespace=OUTSCALE_NAMESPACE)
+
+        return is_truncated, quota
+
 
 class OutscaleSASNodeDriver(OutscaleNodeDriver):
     """


[09/12] libcloud git commit: Add tests and fixtures FCU DescribeProductTypes API

Posted by an...@apache.org.
Add tests and fixtures FCU DescribeProductTypes API

Signed-off-by: Javier M. Mellid <jm...@igalia.com>


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

Branch: refs/heads/trunk
Commit: 426949097b52ea09c2cd0943e078d8f02e6c4fc9
Parents: 576673d
Author: Javier M. Mellid <jm...@igalia.com>
Authored: Tue Oct 4 11:10:49 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Oct 7 13:23:41 2016 +1100

----------------------------------------------------------------------
 .../fixtures/fcu/ex_describe_product_types.xml    | 18 ++++++++++++++++++
 libcloud/test/compute/test_ec2.py                 | 13 +++++++++++++
 2 files changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/42694909/libcloud/test/compute/fixtures/fcu/ex_describe_product_types.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/fcu/ex_describe_product_types.xml b/libcloud/test/compute/fixtures/fcu/ex_describe_product_types.xml
new file mode 100644
index 0000000..5901a63
--- /dev/null
+++ b/libcloud/test/compute/fixtures/fcu/ex_describe_product_types.xml
@@ -0,0 +1,18 @@
+<DescribeProductTypesResponse
+    xmlns="http://api.outscale.com/wsdl/fcuext/2014-04-15/">
+    <requestId>6f5287ac-2833-43d5-8675-b1ffd7b658d3</requestId>
+    <productTypeSet>
+        <item>
+            <productTypeId>0001</productTypeId>
+            <description>Linux/UNIX</description>
+        </item>
+        <item>
+            <productTypeId>0002</productTypeId>
+            <description>Windows</description>
+        </item>
+        <item>
+            <productTypeId>0003</productTypeId>
+            <description>MapR</description>
+        </item>
+    </productTypeSet>
+</DescribeProductTypesResponse>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/42694909/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index 5d919fa..50aef44 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -1802,6 +1802,10 @@ class FCUMockHttp(EC2MockHttp):
         body = self.fixtures.load('ex_describe_quota.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
+    def _DescribeProductTypes(self, method, url, body, headers):
+        body = self.fixtures.load('ex_describe_product_types.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
 
 class OutscaleFCUTests(LibcloudTestCase):
 
@@ -1819,6 +1823,15 @@ class OutscaleFCUTests(LibcloudTestCase):
         self.assertTrue('global' in quota.keys())
         self.assertTrue('vpc-00000000' in quota.keys())
 
+    def test_ex_describe_product_types(self):
+        product_types = self.driver.ex_describe_product_types()
+        pt = {}
+        for e in product_types:
+            pt[e['productTypeId']] = e['description']
+        self.assertTrue('0001' in pt.keys())
+        self.assertTrue('MapR' in pt.values())
+        self.assertTrue(pt['0002'] == 'Windows')
+
 
 if __name__ == '__main__':
     sys.exit(unittest.main())


[06/12] libcloud git commit: Add new DescribeProductTypes API in Outscale EC2 driver

Posted by an...@apache.org.
Add new DescribeProductTypes API in Outscale EC2 driver

Signed-off-by: Javier M. Mellid <jm...@igalia.com>


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

Branch: refs/heads/trunk
Commit: c6527a5ee0ef2440aaf36aecda4cdcc014e0ca8b
Parents: e45b3d0
Author: Javier M. Mellid <jm...@igalia.com>
Authored: Mon Oct 3 13:01:19 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Oct 7 13:23:41 2016 +1100

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


http://git-wip-us.apache.org/repos/asf/libcloud/blob/c6527a5e/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 7a4a9d6..cf5184c 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -6908,6 +6908,47 @@ class OutscaleNodeDriver(BaseEC2NodeDriver):
 
         return is_truncated, quota
 
+    def _to_product_types(self, elem):
+
+        product_types = []
+        for product_types_item in findall(element=elem,
+                                          xpath='productTypeSet/item',
+                                          namespace=OUTSCALE_NAMESPACE):
+            productTypeId = findtext(element=product_types_item,
+                                     xpath='productTypeId',
+                                     namespace=OUTSCALE_NAMESPACE)
+            description = findtext(element=product_types_item,
+                                   xpath='description',
+                                   namespace=OUTSCALE_NAMESPACE)
+            product_types.append({'productTypeId': productTypeId,
+                                  'description': description})
+
+        return product_types
+
+    def ex_describe_product_types(self, filters=None):
+        """
+        Describes Product Types.
+
+        :param      filters: The filters so that the response includes
+                             information for only certain quotas
+        :type       filters: ``dict``
+
+        :return:    A product types list
+        :rtype:     ``list``
+        """
+
+        params = {'Action': 'DescribeProductTypes'}
+
+        if filters:
+            params.update(self._build_filters(filters))
+
+        response = self.connection.request(self.path, params=params,
+                                           method='GET').object
+
+        product_types = self._to_product_types(response)
+
+        return product_types
+
 
 class OutscaleSASNodeDriver(OutscaleNodeDriver):
     """


[08/12] libcloud git commit: Add tests and fixtures FCU DescribeInstanceTypes API

Posted by an...@apache.org.
Add tests and fixtures FCU DescribeInstanceTypes API

Signed-off-by: Javier M. Mellid <jm...@igalia.com>


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

Branch: refs/heads/trunk
Commit: dccaabd6211b13096dd8fe30d7629132af8cfd70
Parents: 4269490
Author: Javier M. Mellid <jm...@igalia.com>
Authored: Tue Oct 4 11:21:27 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Oct 7 13:23:41 2016 +1100

----------------------------------------------------------------------
 .../fixtures/fcu/ex_describe_instance_types.xml | 33 ++++++++++++++++++++
 libcloud/test/compute/test_ec2.py               | 14 +++++++++
 2 files changed, 47 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/dccaabd6/libcloud/test/compute/fixtures/fcu/ex_describe_instance_types.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/fcu/ex_describe_instance_types.xml b/libcloud/test/compute/fixtures/fcu/ex_describe_instance_types.xml
new file mode 100644
index 0000000..c66f030
--- /dev/null
+++ b/libcloud/test/compute/fixtures/fcu/ex_describe_instance_types.xml
@@ -0,0 +1,33 @@
+<DescribeInstanceTypesResponse
+    xmlns="http://api.outscale.com/wsdl/fcuext/2014-04-15/">
+    <requestId>0556395e-4fe3-4cc1-80cb-c98b9f44ca4b</requestId>
+    <instanceTypeSet>
+        <item>
+            <name>og4.4xlarge</name>
+            <vcpu>24</vcpu>
+            <memory>193273528320</memory>
+            <storageSize>412316860416</storageSize>
+            <storageCount>1</storageCount>
+            <maxIpAddresses>30</maxIpAddresses>
+            <ebsOptimizedAvailable>true</ebsOptimizedAvailable>
+        </item>
+        <item>
+            <name>m3.large</name>
+            <vcpu>2</vcpu>
+            <memory>8050966528</memory>
+            <storageSize>34359738368</storageSize>
+            <storageCount>1</storageCount>
+            <maxIpAddresses>10</maxIpAddresses>
+            <ebsOptimizedAvailable>false</ebsOptimizedAvailable>
+        </item>
+        <item>
+            <name>oc2.8xlarge</name>
+            <vcpu>15</vcpu>
+            <memory>68718428160</memory>
+            <storageSize>901943132160</storageSize>
+            <storageCount>4</storageCount>
+            <maxIpAddresses>30</maxIpAddresses>
+            <ebsOptimizedAvailable>false</ebsOptimizedAvailable>
+        </item>
+    </instanceTypeSet>
+</DescribeInstanceTypesResponse>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/dccaabd6/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index 50aef44..f772518 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -1806,6 +1806,10 @@ class FCUMockHttp(EC2MockHttp):
         body = self.fixtures.load('ex_describe_product_types.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
+    def _DescribeInstanceTypes(self, method, url, body, headers):
+        body = self.fixtures.load('ex_describe_instance_types.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
 
 class OutscaleFCUTests(LibcloudTestCase):
 
@@ -1832,6 +1836,16 @@ class OutscaleFCUTests(LibcloudTestCase):
         self.assertTrue('MapR' in pt.values())
         self.assertTrue(pt['0002'] == 'Windows')
 
+    def test_ex_describe_instance_instance_types(self):
+        instance_types = self.driver.ex_describe_instance_types()
+        it = {}
+        for e in instance_types:
+            it[e['name']] = e['memory']
+        self.assertTrue('og4.4xlarge' in it.keys())
+        self.assertTrue('oc2.8xlarge' in it.keys())
+        self.assertTrue('68718428160' in it.values())
+        self.assertTrue(it['m3.large'] == '8050966528')
+
 
 if __name__ == '__main__':
     sys.exit(unittest.main())


[11/12] libcloud git commit: Add tests and fixtures FCU ModifyInstanceKeypair API

Posted by an...@apache.org.
Add tests and fixtures FCU ModifyInstanceKeypair API

Signed-off-by: Javier M. Mellid <jm...@igalia.com>
Closes #890


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

Branch: refs/heads/trunk
Commit: 4fb3bc3baf7d267ebbee1936d6c156e7409c343d
Parents: 797ef78
Author: Javier M. Mellid <jm...@igalia.com>
Authored: Tue Oct 4 12:32:09 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Oct 7 13:23:44 2016 +1100

----------------------------------------------------------------------
 .../test/compute/fixtures/fcu/ex_modify_instance_keypair.xml | 5 +++++
 libcloud/test/compute/test_ec2.py                            | 8 ++++++++
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/4fb3bc3b/libcloud/test/compute/fixtures/fcu/ex_modify_instance_keypair.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/fcu/ex_modify_instance_keypair.xml b/libcloud/test/compute/fixtures/fcu/ex_modify_instance_keypair.xml
new file mode 100644
index 0000000..bb11a17
--- /dev/null
+++ b/libcloud/test/compute/fixtures/fcu/ex_modify_instance_keypair.xml
@@ -0,0 +1,5 @@
+<ModifyInstanceKeypairResponse
+    xmlns="http://api.outscale.com/wsdl/fcuext/2014-04-15/">
+    <requestId>9be5a40b-5f0a-4761-89fb-770eada0c865</requestId>
+    <return>true</return>
+</ModifyInstanceKeypairResponse>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/4fb3bc3b/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index bdeda9a..466c0df 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -1814,6 +1814,10 @@ class FCUMockHttp(EC2MockHttp):
         body = self.fixtures.load('ex_get_product_type.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
+    def _ModifyInstanceKeypair(self, method, url, body, headers):
+        body = self.fixtures.load('ex_modify_instance_keypair.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
 
 class OutscaleFCUTests(LibcloudTestCase):
 
@@ -1855,6 +1859,10 @@ class OutscaleFCUTests(LibcloudTestCase):
         self.assertTrue(product_type['productTypeId'] == '0002')
         self.assertTrue(product_type['description'] == 'Windows')
 
+    def test_ex_modify_instance_keypair(self):
+        r = self.driver.ex_modify_instance_keypair('i-57292bc5', 'key_name')
+        self.assertTrue(r)
+
 
 if __name__ == '__main__':
     sys.exit(unittest.main())


[04/12] libcloud git commit: Add Outscale API constants working with TINA OS

Posted by an...@apache.org.
Add Outscale API constants working with TINA OS

Update version and namespace matching the current TINA OS API (AWS EC2
compatible)

This patch handle two different versions between the API version used to issue
requests and the API version crafted in the namespace. It is a bug in the
server side currently. The bugfix is work in progress. Meanwhile we need those
bits in place to keep the new APIs working.

Signed-off-by: Javier M. Mellid <jm...@igalia.com>


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

Branch: refs/heads/trunk
Commit: a3dbabdeb063e706ea3be65e391c1d00d3abdcfc
Parents: 12d4cf0
Author: Javier M. Mellid <jm...@igalia.com>
Authored: Mon Oct 3 12:15:53 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Oct 7 13:23:41 2016 +1100

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


http://git-wip-us.apache.org/repos/asf/libcloud/blob/a3dbabde/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 083fa4a..10889c7 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -86,6 +86,10 @@ NAMESPACE = 'http://ec2.amazonaws.com/doc/%s/' % (API_VERSION)
 DEFAULT_EUCA_API_VERSION = '3.3.0'
 EUCA_NAMESPACE = 'http://msgs.eucalyptus.com/%s' % (DEFAULT_EUCA_API_VERSION)
 
+# Outscale Constants
+DEFAULT_OUTSCALE_API_VERSION = '2016-04-01'
+OUTSCALE_NAMESPACE = 'http://api.outscale.com/wsdl/fcuext/2014-04-15/'
+
 """
 Sizes must be hardcoded, because Amazon doesn't provide an API to fetch them.
 From http://aws.amazon.com/ec2/instance-types/


[12/12] libcloud git commit: changes for #890

Posted by an...@apache.org.
changes for #890


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

Branch: refs/heads/trunk
Commit: a37a02a805d18f1199a338dd78c4eae778f46b43
Parents: 4fb3bc3
Author: Anthony Shaw <an...@apache.org>
Authored: Fri Oct 7 13:24:47 2016 +1100
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Oct 7 13:24:47 2016 +1100

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


http://git-wip-us.apache.org/repos/asf/libcloud/blob/a37a02a8/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index 92ff59e..48e68cc 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -23,6 +23,10 @@ General
 Compute
 ~~~~~~~
 
+- Added FCU (Flexible Compute Unit) support to the Outscale driver.
+  (GITHUB-890)
+  [Javier M. Mellid]
+
 - [google compute] Add "WINDOWS" guestOsFeatures option.
   (GITHUB-861)
   [Max Illfelder]


[10/12] libcloud git commit: Add new GetProductType API in Outscale EC2 driver

Posted by an...@apache.org.
Add new GetProductType API in Outscale EC2 driver

Signed-off-by: Javier M. Mellid <jm...@igalia.com>


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

Branch: refs/heads/trunk
Commit: d277e988f1f6c078e79cfb2e6848d465ceb24f26
Parents: 97223fa
Author: Javier M. Mellid <jm...@igalia.com>
Authored: Mon Oct 3 13:56:59 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Oct 7 13:23:41 2016 +1100

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


http://git-wip-us.apache.org/repos/asf/libcloud/blob/d277e988/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 77211cd..ec38dfd 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -6908,6 +6908,43 @@ class OutscaleNodeDriver(BaseEC2NodeDriver):
 
         return is_truncated, quota
 
+    def _to_product_type(self, elem):
+
+        productTypeId = findtext(element=elem, xpath='productTypeId',
+                                 namespace=OUTSCALE_NAMESPACE)
+        description = findtext(element=elem, xpath='description',
+                               namespace=OUTSCALE_NAMESPACE)
+
+        return {'productTypeId': productTypeId,
+                'description': description}
+
+    def ex_get_product_type(self, image_id, snapshot_id=None):
+        """
+        Get the product type of a specified OMI or snapshot.
+
+        :param      image_id: The ID of the OMI
+        :type       image_id: ``string``
+
+        :param      snapshot_id: The ID of the snapshot
+        :type       snapshot_id: ``string``
+
+        :return:    A product type
+        :rtype:     ``dict``
+        """
+
+        params = {'Action': 'GetProductType'}
+
+        params.update({'ImageId': image_id})
+        if snapshot_id is not None:
+            params.update({'SnapshotId': snapshot_id})
+
+        response = self.connection.request(self.path, params=params,
+                                           method='GET').object
+
+        product_type = self._to_product_type(response)
+
+        return product_type
+
     def _to_product_types(self, elem):
 
         product_types = []


[02/12] libcloud git commit: Add tests and fixtures FCU DescribeQuota API

Posted by an...@apache.org.
Add tests and fixtures FCU DescribeQuota API

Signed-off-by: Javier M. Mellid <jm...@igalia.com>


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

Branch: refs/heads/trunk
Commit: 576673d6360fe8bc0191ab6dc2395f6fd5a2a018
Parents: e778636
Author: Javier M. Mellid <jm...@igalia.com>
Authored: Mon Oct 3 15:50:26 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Oct 7 13:23:41 2016 +1100

----------------------------------------------------------------------
 .../compute/fixtures/fcu/ex_describe_quota.xml  | 53 ++++++++++++++++++++
 libcloud/test/compute/test_ec2.py               | 25 +++++++++
 2 files changed, 78 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/576673d6/libcloud/test/compute/fixtures/fcu/ex_describe_quota.xml
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/fixtures/fcu/ex_describe_quota.xml b/libcloud/test/compute/fixtures/fcu/ex_describe_quota.xml
new file mode 100644
index 0000000..2948302
--- /dev/null
+++ b/libcloud/test/compute/fixtures/fcu/ex_describe_quota.xml
@@ -0,0 +1,53 @@
+<DescribeQuotaResponse
+    xmlns="http://api.outscale.com/wsdl/fcuext/2014-04-15/">
+    <requestId>31ef7689-2521-445f-b634-2a5e3e66f699</requestId>
+    <isTruncated>true</isTruncated>
+    <referenceQuotaSet>
+        <item>
+            <reference>global</reference>
+            <quotaSet>
+                <item>
+                    <ownerId>366866344682</ownerId>
+                    <name>vm_limit</name>
+                    <displayName>VM Limit</displayName>
+                    <description>Maximum number of VM this user can own</description>
+                    <groupName>Compute</groupName>
+                    <maxQuotaValue>20</maxQuotaValue>
+                    <usedQuotaValue>1</usedQuotaValue>
+                </item>
+                <item>
+                    <ownerId>366866344682</ownerId>
+                    <name>core_limit</name>
+                    <displayName>Core Limit</displayName>
+                    <description>Maximum number of total cores (virtual core)</description>
+                    <groupName>Compute</groupName>
+                    <maxQuotaValue>800</maxQuotaValue>
+                    <usedQuotaValue>2</usedQuotaValue>
+                </item>
+                <item>
+                    <ownerId>366866344682</ownerId>
+                    <name>memory_limit</name>
+                    <displayName>Memory Limit</displayName>
+                    <description>Maximum number of total memory (GiB)</description>
+                    <groupName>Compute</groupName>
+                    <maxQuotaValue>4880</maxQuotaValue>
+                    <usedQuotaValue>7</usedQuotaValue>
+                </item>
+            </quotaSet>
+        </item>
+        <item>
+            <reference>vpc-00000000</reference>
+            <quotaSet>
+                <item>
+                    <ownerId>366866344682</ownerId>
+                    <name>sg_limit</name>
+                    <displayName>Security Groups Limit</displayName>
+                    <description>Maximum number of security groups</description>
+                    <groupName>Security Groups</groupName>
+                    <maxQuotaValue>100</maxQuotaValue>
+                    <usedQuotaValue>2</usedQuotaValue>
+                </item>
+            </quotaSet>
+        </item>
+    </referenceQuotaSet>
+</DescribeQuotaResponse>

http://git-wip-us.apache.org/repos/asf/libcloud/blob/576673d6/libcloud/test/compute/test_ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_ec2.py b/libcloud/test/compute/test_ec2.py
index 2b24776..5d919fa 100644
--- a/libcloud/test/compute/test_ec2.py
+++ b/libcloud/test/compute/test_ec2.py
@@ -1795,5 +1795,30 @@ class OutscaleTests(EC2Tests):
         self.assertTrue('m1.xlarge' in ids)
 
 
+class FCUMockHttp(EC2MockHttp):
+    fixtures = ComputeFileFixtures('fcu')
+
+    def _DescribeQuota(self, method, url, body, headers):
+        body = self.fixtures.load('ex_describe_quota.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
+
+
+class OutscaleFCUTests(LibcloudTestCase):
+
+    def setUp(self):
+        OutscaleSASNodeDriver.connectionCls.conn_classes = (None, FCUMockHttp)
+        EC2MockHttp.use_param = 'Action'
+        EC2MockHttp.type = None
+        self.driver = OutscaleSASNodeDriver(key=EC2_PARAMS[0],
+                                            secret=EC2_PARAMS[1],
+                                            host='some.fcucloud.com')
+
+    def test_ex_describe_quota(self):
+        is_truncated, quota = self.driver.ex_describe_quota()
+        self.assertTrue(is_truncated == 'true')
+        self.assertTrue('global' in quota.keys())
+        self.assertTrue('vpc-00000000' in quota.keys())
+
+
 if __name__ == '__main__':
     sys.exit(unittest.main())


[03/12] libcloud git commit: Add new ModifyInstanceKeypair API in Outscale EC2 driver

Posted by an...@apache.org.
Add new ModifyInstanceKeypair API in Outscale EC2 driver

Signed-off-by: Javier M. Mellid <jm...@igalia.com>


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

Branch: refs/heads/trunk
Commit: e778636ce7ee27ff9de8cc75eb2869fcb9ff8b66
Parents: d277e98
Author: Javier M. Mellid <jm...@igalia.com>
Authored: Mon Oct 3 14:07:54 2016 +0200
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Oct 7 13:23:41 2016 +1100

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


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e778636c/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index ec38dfd..cf338e1 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -6811,6 +6811,31 @@ class OutscaleNodeDriver(BaseEC2NodeDriver):
             sizes.append(NodeSize(driver=self, **attributes))
         return sizes
 
+    def ex_modify_instance_keypair(self, instance_id, key_name=None):
+        """
+        Modifies the keypair associated with a specified instance.
+        Once the modification done, you must restart the instance.
+
+        :param      instance_id: The ID of the instance
+        :type       instance_id: ``string``
+
+        :param      key_name: The name of the keypair
+        :type       key_name: ``string``
+        """
+
+        params = {'Action': 'ModifyInstanceKeypair'}
+
+        params.update({'instanceId': instance_id})
+
+        if key_name is not None:
+            params.update({'keyName': key_name})
+
+        response = self.connection.request(self.path, params=params,
+                                           method='GET').object
+
+        return (findtext(element=response, xpath='return',
+                         namespace=OUTSCALE_NAMESPACE) == 'true')
+
     def _to_quota(self, elem):
         """
         To Quota