libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1443254 - in /libcloud/branches/0.12.x: ./ libcloud/compute/drivers/ libcloud/test/compute/ libcloud/test/compute/fixtures/ibm_sce/ libcloud/test/compute/fixtures/openstack/
Date Wed, 06 Feb 2013 22:44:44 GMT
Author: tomaz
Date: Wed Feb  6 22:44:44 2013
New Revision: 1443254

URL: http://svn.apache.org/viewvc?rev=1443254&view=rev
Log:
Backport changes from trunk.

Added:
    libcloud/branches/0.12.x/libcloud/test/compute/fixtures/ibm_sce/destroy_image.xml
      - copied unchanged from r1443251, libcloud/trunk/libcloud/test/compute/fixtures/ibm_sce/destroy_image.xml
    libcloud/branches/0.12.x/libcloud/test/compute/fixtures/openstack/v1_slug_servers_no_admin_pass.xml
      - copied unchanged from r1443251, libcloud/trunk/libcloud/test/compute/fixtures/openstack/v1_slug_servers_no_admin_pass.xml
Modified:
    libcloud/branches/0.12.x/   (props changed)
    libcloud/branches/0.12.x/CHANGES
    libcloud/branches/0.12.x/libcloud/compute/drivers/elastichosts.py
    libcloud/branches/0.12.x/libcloud/compute/drivers/ibm_sce.py
    libcloud/branches/0.12.x/libcloud/compute/drivers/openstack.py
    libcloud/branches/0.12.x/libcloud/test/compute/test_ibm_sce.py
    libcloud/branches/0.12.x/libcloud/test/compute/test_openstack.py

Propchange: libcloud/branches/0.12.x/
------------------------------------------------------------------------------
  Merged /libcloud/trunk:r1442710-1443251

Modified: libcloud/branches/0.12.x/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/CHANGES?rev=1443254&r1=1443253&r2=1443254&view=diff
==============================================================================
--- libcloud/branches/0.12.x/CHANGES (original)
+++ libcloud/branches/0.12.x/CHANGES Wed Feb  6 22:44:44 2013
@@ -138,6 +138,17 @@ Changes with Apache Libcloud 0.12.0:
      ex_build_node extension method. (LIBCLOUD-249)
      [Dinesh Bhoopathy]
 
+   - Add ex_destroy_image method to IBM SCE driver. (LIBCLOUD-291)
+     [Perry Zou]
+
+   - Add the following new regions to the ElasticHosts driver: sjc-c, syd-v,
+     hkg-e. (LIBCLOUD-293)
+     [Tomaz Muraus]
+
+   - Fix create_node in OpenStack driver to work correctly if 'adminPass'
+     attribute is not present in the response.
+     [Gavin McCance, Tomaz Muraus]
+
   *) Storage
 
     - Add a new local storage driver.

Modified: libcloud/branches/0.12.x/libcloud/compute/drivers/elastichosts.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/compute/drivers/elastichosts.py?rev=1443254&r1=1443253&r2=1443254&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/compute/drivers/elastichosts.py (original)
+++ libcloud/branches/0.12.x/libcloud/compute/drivers/elastichosts.py Wed Feb  6 22:44:44
2013
@@ -44,10 +44,25 @@ API_ENDPOINTS = {
         'country': 'United States',
         'host': 'api.lax-p.elastichosts.com'
     },
+    'us-3': {
+        'name': 'San Jose (Silicon Valley)',
+        'country': 'United States',
+        'host': 'api.sjc-c.elastichosts.com'
+    },
     'ca-1': {
         'name': 'Toronto Peer 1',
         'country': 'Canada',
         'host': 'api.tor-p.elastichosts.com'
+    },
+    'au-1': {
+        'name': 'Sydney',
+        'country': 'Australia',
+        'host': 'api.syd-v.elastichosts.com'
+    },
+    'cn-1': {
+        'name': 'Hong Kong',
+        'country': 'China',
+        'host': 'api.hkg-e.elastichosts.com'
     }
 }
 

Modified: libcloud/branches/0.12.x/libcloud/compute/drivers/ibm_sce.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/compute/drivers/ibm_sce.py?rev=1443254&r1=1443253&r2=1443254&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/compute/drivers/ibm_sce.py (original)
+++ libcloud/branches/0.12.x/libcloud/compute/drivers/ibm_sce.py Wed Feb  6 22:44:44 2013
@@ -26,6 +26,7 @@ import base64
 import time
 
 from libcloud.utils.py3 import urlencode
+from libcloud.utils.py3 import httplib
 from libcloud.utils.py3 import b
 
 from libcloud.common.base import XmlResponse, ConnectionUserAndKey
@@ -329,7 +330,7 @@ class IBMNodeDriver(NodeDriver):
         url = REST_BASE + '/instances/%s' % (node.id)
         status = int(self.connection.request(action=url,
                                              method='DELETE').status)
-        return status == 200
+        return status == httplib.OK
 
     def destroy_volume(self, volume):
         """
@@ -343,6 +344,21 @@ class IBMNodeDriver(NodeDriver):
         url = REST_BASE + '/storage/%s' % (volume.id)
         status = int(self.connection.request(action=url,
                                              method='DELETE').status)
+        return status == httplib.OK
+
+    def ex_destroy_image(self,image):
+        """
+        Destroys an image.
+
+        @param      image: Image to be destroyed
+        @type       image: L{NodeImage}
+
+        @return: C{bool}
+        """
+
+        url = REST_BASE + '/offerings/image/%s' % (image.id)
+        status = int(self.connection.request(action=url,
+                                             method='DELETE').status)
         return status == 200
 
     def attach_volume(self, node, volume):

Modified: libcloud/branches/0.12.x/libcloud/compute/drivers/openstack.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/compute/drivers/openstack.py?rev=1443254&r1=1443253&r2=1443254&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/compute/drivers/openstack.py (original)
+++ libcloud/branches/0.12.x/libcloud/compute/drivers/openstack.py Wed Feb  6 22:44:44 2013
@@ -1090,7 +1090,10 @@ class OpenStack_1_1_NodeDriver(OpenStack
         server_resp = self.connection.request(
             '/servers/%s' % create_response['id'])
         server_object = server_resp.object['server']
-        server_object['adminPass'] = create_response['adminPass']
+
+        # adminPass is not always present
+        # http://docs.openstack.org/essex/openstack-compute/admin/content/configuring-compute-API.html#d6e1833
+        server_object['adminPass'] = create_response.get('adminPass', None)
 
         return self._to_node(server_object)
 
@@ -1614,7 +1617,7 @@ class OpenStack_1_1_NodeDriver(OpenStack
                 uri=next(link['href'] for link in api_node['links'] if
                          link['rel'] == 'self'),
                 metadata=api_node['metadata'],
-                password=api_node.get('adminPass'),
+                password=api_node.get('adminPass', None),
                 created=api_node['created'],
                 updated=api_node['updated'],
                 key_name=api_node.get('key_name', None),

Modified: libcloud/branches/0.12.x/libcloud/test/compute/test_ibm_sce.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/test/compute/test_ibm_sce.py?rev=1443254&r1=1443253&r2=1443254&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/test/compute/test_ibm_sce.py (original)
+++ libcloud/branches/0.12.x/libcloud/test/compute/test_ibm_sce.py Wed Feb  6 22:44:44 2013
@@ -187,6 +187,12 @@ class IBMTests(unittest.TestCase, TestCa
         IBMMockHttp.type = 'DESTROY'
         ret = self.driver.destroy_volume(vols[0])
         self.assertTrue(ret)
+        
+    def test_ex_destroy_image(self):
+        image = self.driver.list_images()
+        IBMMockHttp.type = 'DESTROY'
+        ret = self.driver.ex_destroy_image(image[0])
+        self.assertTrue(ret)
 
     def test_detach_volume(self):
         nodes = self.driver.list_nodes()
@@ -278,7 +284,11 @@ class IBMMockHttp(MockHttp):
     def _computecloud_enterprise_api_rest_20100331_storage_39281_DESTROY(self, method, url,
body, headers):
         body = self.fixtures.load('destroy_volume.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
+        
+    def _computecloud_enterprise_api_rest_20100331_offerings_image_2_DESTROY(self, method,
url, body, headers):
+        body = self.fixtures.load('destroy_image.xml')
+        return (httplib.OK, body, {}, httplib.responses[httplib.OK])    
+    
     def _computecloud_enterprise_api_rest_20100331_instances_26557_DETACH(self, method, url,
body, headers):
         body = self.fixtures.load('detach_volume.xml')
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])

Modified: libcloud/branches/0.12.x/libcloud/test/compute/test_openstack.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/test/compute/test_openstack.py?rev=1443254&r1=1443253&r2=1443254&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/test/compute/test_openstack.py (original)
+++ libcloud/branches/0.12.x/libcloud/test/compute/test_openstack.py Wed Feb  6 22:44:44 2013
@@ -203,6 +203,16 @@ class OpenStack_1_0_Tests(unittest.TestC
         self.assertEqual(node.name, 'racktest')
         self.assertEqual(node.extra.get('password'), 'racktestvJq7d3')
 
+    def test_create_node_without_adminPass(self):
+        OpenStackMockHttp.type = 'NO_ADMIN_PASS'
+        image = NodeImage(id=11, name='Ubuntu 8.10 (intrepid)',
+                          driver=self.driver)
+        size = NodeSize(1, '256 slice', None, None, None, None,
+                        driver=self.driver)
+        node = self.driver.create_node(name='racktest', image=image, size=size)
+        self.assertEqual(node.name, 'racktest')
+        self.assertEqual(node.extra.get('password'), None)
+
     def test_create_node_ex_shared_ip_group(self):
         OpenStackMockHttp.type = 'EX_SHARED_IP_GROUP'
         image = NodeImage(id=11, name='Ubuntu 8.10 (intrepid)',
@@ -440,6 +450,10 @@ class OpenStackMockHttp(MockHttpTestCase
         body = self.fixtures.load('v1_slug_servers.xml')
         return (httplib.ACCEPTED, body, XML_HEADERS, httplib.responses[httplib.ACCEPTED])
 
+    def _v1_0_slug_servers_NO_ADMIN_PASS(self, method, url, body, headers):
+        body = self.fixtures.load('v1_slug_servers_no_admin_pass.xml')
+        return (httplib.ACCEPTED, body, XML_HEADERS, httplib.responses[httplib.ACCEPTED])
+
     def _v1_0_slug_servers_EX_SHARED_IP_GROUP(self, method, url, body, headers):
         # test_create_node_ex_shared_ip_group
         # Verify that the body contains sharedIpGroupId XML element



Mime
View raw message