Author: tomaz
Date: Sat May 25 03:37:18 2013
New Revision: 1486282
URL: http://svn.apache.org/r1486282
Log:
Allow user to pass extra arguments via "extra_args" argument which are
then passed to the "deployVirtualMachine" call in the CloudStack driver
create_node method.
Part of LIBCLOUD-330.
Modified:
libcloud/trunk/CHANGES
libcloud/trunk/libcloud/compute/drivers/cloudstack.py
Modified: libcloud/trunk/CHANGES
URL:
http://svn.apache.org/viewvc/libcloud/trunk/CHANGES?rev=1486282&r1=1486281&r2=1486282&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Sat May 25 03:37:18 2013
@@ -58,6 +58,11 @@ Changes with Apache Libcloud in deveplom
a Node object from the create_node method. (LIBCLOUD-329)
[Sebastien Goasguen, Tomaz Muraus]
+ - Allow user to pass extra arguments via "extra_args" argument which are
+ then passed to the "deployVirtualMachine" call in the CloudStack driver
+ create_node method. (LIBCLOUD-330)
+ [Sebastien Goasguen, Tomaz Muraus]
+
*) Storage
- Fix an issue with double encoding the container name in the CloudFiles
Modified: libcloud/trunk/libcloud/compute/drivers/cloudstack.py
URL:
http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/cloudstack.py?rev=1486282&r1=1486281&r2=1486282&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/cloudstack.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/cloudstack.py Sat May 25 03:37:18
2013
@@ -230,22 +230,34 @@ class CloudStackNodeDriver(CloudStackDri
0, self))
return sizes
- def create_node(self, name, size, image, location=None, **kwargs):
+ def create_node(self, name, size, image, location=None, extra_args=None,
+ **kwargs):
"""
@inherits: L{NodeDriver.create_node}
+
+ @keyword extra_args: Extra argument passed to the
+ "deployVirtualMachine" call. A list of available arguments can be found
+ at
http://cloudstack.apache.org/docs/api/apidocs-4.0.0/root_admin/deployVirtualMachine.html
+ @type extra_args: C{dict}
+
@rtype: L{CloudStackNode}
"""
- extra_args = {}
+
+ if extra_args:
+ request_args = extra_args.copy()
+ else:
+ request_args = {}
+
if location is None:
location = self.list_locations()[0]
if 'network_id' in kwargs:
- extra_args['networkids'] = network_id
+ request_args['networkids'] = network_id
result = self._async_request(
'deployVirtualMachine', name=name, displayname=name,
serviceofferingid=size.id, templateid=image.id,
- zoneid=location.id, **extra_args
+ zoneid=location.id, **request_args
)
node = result['virtualmachine']