libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rbogorods...@apache.org
Subject svn commit: r1067451 - in /incubator/libcloud/trunk: CHANGES libcloud/drivers/rackspace.py
Date Sat, 05 Feb 2011 14:52:19 GMT
Author: rbogorodskiy
Date: Sat Feb  5 14:52:18 2011
New Revision: 1067451

URL: http://svn.apache.org/viewvc?rev=1067451&view=rev
Log:
Implement ex_rebuild() and ex_get_node_details()
routines for Rackspace driver.

Submitted by:	Andrew Klochkov

Modified:
    incubator/libcloud/trunk/CHANGES
    incubator/libcloud/trunk/libcloud/drivers/rackspace.py

Modified: incubator/libcloud/trunk/CHANGES
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/CHANGES?rev=1067451&r1=1067450&r2=1067451&view=diff
==============================================================================
--- incubator/libcloud/trunk/CHANGES (original)
+++ incubator/libcloud/trunk/CHANGES Sat Feb  5 14:52:18 2011
@@ -2,6 +2,10 @@
 
 Changes with Apache Libcloud 0.4.3
 
+    *) Implement ex_rebuild() and ex_get_node_details()
+       routines for Rackspace driver.
+       [Andrew Klochkov]
+
     *) Implement ex_list_ips() for GoGrid driver to list
        IP addresses assigned to the account. Make use of
        it in _get_first_ip().

Modified: incubator/libcloud/trunk/libcloud/drivers/rackspace.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/rackspace.py?rev=1067451&r1=1067450&r2=1067451&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/rackspace.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/rackspace.py Sat Feb  5 14:52:18 2011
@@ -309,6 +309,18 @@ class RackspaceNodeDriver(NodeDriver):
                                        data=ET.tostring(server_elm))
         return self._to_node(resp.object)
 
+    def ex_rebuild(self, node_id, image_id):
+        elm = ET.Element(
+            'rebuild',
+            {'xmlns': NAMESPACE,
+             'imageId': image_id,
+            }
+        )
+        resp = self.connection.request("/servers/%s/action" % node_id,
+                                       method='POST',
+                                       data=ET.tostring(elm))
+        return resp.status == 202
+
     def ex_create_ip_group(self, group_name, node_id=None):
         group_elm = ET.Element(
             'sharedIpGroup',
@@ -414,6 +426,13 @@ class RackspaceNodeDriver(NodeDriver):
         resp = self.connection.request(uri, method='DELETE')
         return resp.status == 202
 
+    def ex_get_node_details(self, node_id):
+        uri = '/servers/%s' % (node_id)
+        resp = self.connection.request(uri, method='GET')
+        if resp.status == 404:
+            return None
+        return self._to_node(resp.object)
+
     def _node_action(self, node, body):
         if isinstance(body, list):
             attr = ' '.join(['%s="%s"' % (item[0], item[1])



Mime
View raw message