libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1443019 - in /libcloud/trunk: CHANGES libcloud/compute/drivers/ibm_sce.py libcloud/test/compute/fixtures/ibm_sce/destroy_image.xml libcloud/test/compute/test_ibm_sce.py
Date Wed, 06 Feb 2013 15:35:33 GMT
Author: tomaz
Date: Wed Feb  6 15:35:33 2013
New Revision: 1443019

URL: http://svn.apache.org/viewvc?rev=1443019&view=rev
Log:
Add ex_destroy_image method to IBM SCE driver.

Contributed by Perry Zou part of LIBCLOUD-291.

Added:
    libcloud/trunk/libcloud/test/compute/fixtures/ibm_sce/destroy_image.xml
Modified:
    libcloud/trunk/CHANGES
    libcloud/trunk/libcloud/compute/drivers/ibm_sce.py
    libcloud/trunk/libcloud/test/compute/test_ibm_sce.py

Modified: libcloud/trunk/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/trunk/CHANGES?rev=1443019&r1=1443018&r2=1443019&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Wed Feb  6 15:35:33 2013
@@ -148,6 +148,9 @@ Changes with Apache Libcloud in developm
      ex_build_node extension method. (LIBCLOUD-249)
      [Dinesh Bhoopathy]
 
+   - Add ex_destroy_image method to IBM SCE driver. (LIBCLOUD-291)
+     [Perry Zou]
+
   *) Storage
 
     - Add a new local storage driver.

Modified: libcloud/trunk/libcloud/compute/drivers/ibm_sce.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/ibm_sce.py?rev=1443019&r1=1443018&r2=1443019&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/ibm_sce.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/ibm_sce.py Wed Feb  6 15:35:33 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):

Added: libcloud/trunk/libcloud/test/compute/fixtures/ibm_sce/destroy_image.xml
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/test/compute/fixtures/ibm_sce/destroy_image.xml?rev=1443019&view=auto
==============================================================================
--- libcloud/trunk/libcloud/test/compute/fixtures/ibm_sce/destroy_image.xml (added)
+++ libcloud/trunk/libcloud/test/compute/fixtures/ibm_sce/destroy_image.xml Wed Feb  6 15:35:33
2013
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:DeleteImageResponse
xmlns:ns2="http://www.ibm.com/xmlns/b2b/cloud/api/2010-03-31"/>
\ No newline at end of file

Modified: libcloud/trunk/libcloud/test/compute/test_ibm_sce.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/test/compute/test_ibm_sce.py?rev=1443019&r1=1443018&r2=1443019&view=diff
==============================================================================
--- libcloud/trunk/libcloud/test/compute/test_ibm_sce.py (original)
+++ libcloud/trunk/libcloud/test/compute/test_ibm_sce.py Wed Feb  6 15:35:33 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])



Mime
View raw message