You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by pq...@apache.org on 2010/06/04 23:17:56 UTC
svn commit: r951574 - /incubator/libcloud/trunk/libcloud/drivers/gogrid.py
Author: pquerna
Date: Fri Jun 4 21:17:56 2010
New Revision: 951574
URL: http://svn.apache.org/viewvc?rev=951574&view=rev
Log:
Inroduce ex_create_node_nowait() to GoGrid driver which doesn't block until id is allocated.
Submitted by: Roman Bogorodskiy <bogorodskiy gmail.com>
Modified:
incubator/libcloud/trunk/libcloud/drivers/gogrid.py
Modified: incubator/libcloud/trunk/libcloud/drivers/gogrid.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/drivers/gogrid.py?rev=951574&r1=951573&r2=951574&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/drivers/gogrid.py (original)
+++ incubator/libcloud/trunk/libcloud/drivers/gogrid.py Fri Jun 4 21:17:56 2010
@@ -219,14 +219,13 @@ class GoGridNodeDriver(NodeDriver):
def list_locations(self):
return [NodeLocation(0, "GoGrid Los Angeles", 'US', self)]
- def create_node(self, **kwargs):
- """Create a new GoGird node
-
- See L{NodeDriver.create_node} for more keyword args.
-
- @keyword ex_description: Description of a Node
- @type ex_description: C{string}
- """
+ def ex_create_node_nowait(self, **kwargs):
+ """Don't block until GoGrid allocates id for a node
+ but return right away with id == None.
+
+ The existance of this method is explained by the fact
+ that GoGrid assigns id to a node only few minutes after
+ creation."""
name = kwargs['name']
image = kwargs['image']
size = kwargs['size']
@@ -241,6 +240,18 @@ class GoGridNodeDriver(NodeDriver):
params=params).object
node = self._to_node(object['list'][0])
+ return node
+
+ def create_node(self, **kwargs):
+ """Create a new GoGird node
+
+ See L{NodeDriver.create_node} for more keyword args.
+
+ @keyword ex_description: Description of a Node
+ @type ex_description: C{string}
+ """
+ node = self.ex_create_node_nowait(**kwargs)
+
timeout = 60 * 20
waittime = 0
interval = 2 * 60