Author: tomaz
Date: Fri May 18 04:40:30 2012
New Revision: 1339973
URL: http://svn.apache.org/viewvc?rev=1339973&view=rev
Log:
Add ex_register_iso method to the CloudStack driver. This patch has been
contributed by Daemian Mack and is part of LIBCLOUD-196.
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=1339973&r1=1339972&r2=1339973&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Fri May 18 04:40:30 2012
@@ -7,6 +7,9 @@ Changes with Apache Libcloud in developm
; LIBCLOUD-195
[Sengor Kusturica]
+ - Add ex_register_iso method to the CloudStack driver. ; LIBCLOUD-196
+ [Daemian Mack]
+
Changes with Apache Libcloud 0.10.0:
*) Compute:
Modified: libcloud/trunk/libcloud/compute/drivers/cloudstack.py
URL:
http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/cloudstack.py?rev=1339973&r1=1339972&r2=1339973&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/cloudstack.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/cloudstack.py Fri May 18 04:40:30
2012
@@ -17,7 +17,7 @@ from libcloud.compute.providers import P
from libcloud.common.cloudstack import CloudStackDriverMixIn
from libcloud.compute.base import Node, NodeDriver, NodeImage, NodeLocation, \
NodeSize
-from libcloud.compute.types import NodeState
+from libcloud.compute.types import NodeState, LibcloudError
class CloudStackNode(Node):
@@ -302,3 +302,25 @@ class CloudStackNodeDriver(CloudStackDri
node.extra['ip_forwarding_rules'].remove(rule)
self._async_request('deleteIpForwardingRule', id=rule.id)
return True
+
+ def ex_register_iso(self, name, url, location=None, **kwargs):
+ "Registers an existing ISO by URL."
+ if location is None:
+ location = self.list_locations()[0]
+
+ extra_args = {}
+ extra_args['bootable'] = kwargs.pop('bootable', False)
+ if extra_args['bootable']:
+ os_type_id = kwargs.pop('ostypeid', None)
+
+ if not os_type_id:
+ raise LibcloudError('If bootable=True, ostypeid is required!')
+
+ extra_args['ostypeid'] = os_type_id
+
+ return self._sync_request('registerIso',
+ name=name,
+ displaytext=name,
+ url=url,
+ zoneid=location.id,
+ **extra_args)