You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2012/07/21 06:24:27 UTC

svn commit: r1364039 [1/4] - in /libcloud/trunk: ./ libcloud/common/ libcloud/compute/ libcloud/compute/drivers/

Author: tomaz
Date: Sat Jul 21 04:24:25 2012
New Revision: 1364039

URL: http://svn.apache.org/viewvc?rev=1364039&view=rev
Log:
Unify docstrings formatting and fix pep8 issues in the compute drivers.
Contributed by Ilgiz Islamgulov, part of LIBCLOUD-229.

Modified:
    libcloud/trunk/.gitignore
    libcloud/trunk/CHANGES
    libcloud/trunk/libcloud/common/openstack.py
    libcloud/trunk/libcloud/compute/base.py
    libcloud/trunk/libcloud/compute/drivers/bluebox.py
    libcloud/trunk/libcloud/compute/drivers/brightbox.py
    libcloud/trunk/libcloud/compute/drivers/cloudsigma.py
    libcloud/trunk/libcloud/compute/drivers/cloudstack.py
    libcloud/trunk/libcloud/compute/drivers/dreamhost.py
    libcloud/trunk/libcloud/compute/drivers/dummy.py
    libcloud/trunk/libcloud/compute/drivers/ec2.py
    libcloud/trunk/libcloud/compute/drivers/ecp.py
    libcloud/trunk/libcloud/compute/drivers/elasticstack.py
    libcloud/trunk/libcloud/compute/drivers/gandi.py
    libcloud/trunk/libcloud/compute/drivers/gogrid.py
    libcloud/trunk/libcloud/compute/drivers/ibm_sce.py
    libcloud/trunk/libcloud/compute/drivers/joyent.py
    libcloud/trunk/libcloud/compute/drivers/ktucloud.py
    libcloud/trunk/libcloud/compute/drivers/libvirt_driver.py
    libcloud/trunk/libcloud/compute/drivers/linode.py
    libcloud/trunk/libcloud/compute/drivers/ninefold.py
    libcloud/trunk/libcloud/compute/drivers/opennebula.py
    libcloud/trunk/libcloud/compute/drivers/openstack.py
    libcloud/trunk/libcloud/compute/drivers/opsource.py
    libcloud/trunk/libcloud/compute/drivers/rackspace.py
    libcloud/trunk/libcloud/compute/drivers/rackspacenova.py
    libcloud/trunk/libcloud/compute/drivers/rimuhosting.py
    libcloud/trunk/libcloud/compute/drivers/slicehost.py
    libcloud/trunk/libcloud/compute/drivers/softlayer.py
    libcloud/trunk/libcloud/compute/drivers/vcl.py
    libcloud/trunk/libcloud/compute/drivers/vcloud.py
    libcloud/trunk/libcloud/compute/drivers/voxel.py
    libcloud/trunk/libcloud/compute/drivers/vpsnet.py

Modified: libcloud/trunk/.gitignore
URL: http://svn.apache.org/viewvc/libcloud/trunk/.gitignore?rev=1364039&r1=1364038&r2=1364039&view=diff
==============================================================================
--- libcloud/trunk/.gitignore (original)
+++ libcloud/trunk/.gitignore Sat Jul 21 04:24:25 2012
@@ -9,3 +9,4 @@ MANIFEST
 /.ropeproject/config.py
 /.coverage
 coverage_html_report/
+.idea

Modified: libcloud/trunk/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/trunk/CHANGES?rev=1364039&r1=1364038&r2=1364039&view=diff
==============================================================================
--- libcloud/trunk/CHANGES (original)
+++ libcloud/trunk/CHANGES Sat Jul 21 04:24:25 2012
@@ -131,6 +131,11 @@ Changes with Apache Libcloud in developm
     - Fix upload_object_via_stream method in the Atmos driver. ; LIBCLOUD-228
       [Benno Rice]
 
+  *) Other:
+
+    - Unify docstrings formatting in the compute drivers. ; LIBCLOUD-229
+      [Ilgiz Islamgulov]
+
 Changes with Apache Libcloud 0.10.1:
 
   *) General:

Modified: libcloud/trunk/libcloud/common/openstack.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/common/openstack.py?rev=1364039&r1=1364038&r2=1364039&view=diff
==============================================================================
--- libcloud/trunk/libcloud/common/openstack.py (original)
+++ libcloud/trunk/libcloud/common/openstack.py Sat Jul 21 04:24:25 2012
@@ -518,6 +518,10 @@ class OpenStackDriverMixin(object):
                                                    None)
 
     def openstack_connection_kwargs(self):
+        """
+
+        @rtype: C{dict}
+        """
         rv = {}
         if self._ex_force_base_url:
             rv['ex_force_base_url'] = self._ex_force_base_url

Modified: libcloud/trunk/libcloud/compute/base.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/base.py?rev=1364039&r1=1364038&r2=1364039&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/base.py (original)
+++ libcloud/trunk/libcloud/compute/base.py Sat Jul 21 04:24:25 2012
@@ -64,7 +64,7 @@ __all__ = [
     "ConnectionUserAndKey",
     "LibcloudHTTPSConnection",
     "LibcloudHTTPConnection"
-    ]
+]
 
 
 class UuidMixin(object):
@@ -413,7 +413,7 @@ class StorageVolume(UuidMixin):
 
     def __repr__(self):
         return '<StorageVolume id=%s size=%s driver=%s>' % (
-                        self.id, self.size, self.driver.name)
+               self.id, self.size, self.driver.name)
 
 
 class NodeDriver(BaseDriver):
@@ -457,7 +457,7 @@ class NodeDriver(BaseDriver):
         """Create a new node instance.
 
         @keyword    name:   String with a name for this new node (required)
-        @type       name:   str
+        @type       name:   C{str}
 
         @keyword    size:   The size of resources allocated to this node.
                             (required)
@@ -474,7 +474,8 @@ class NodeDriver(BaseDriver):
                             (optional)
         @type       auth:   L{NodeAuthSSHKey} or L{NodeAuthPassword}
 
-        @return: The newly created L{Node}.
+        @return: The newly created node.
+        @rtype: L{Node}
         """
         raise NotImplementedError(
             'create_node not implemented for this driver')
@@ -488,7 +489,8 @@ class NodeDriver(BaseDriver):
         @param node: The node to be destroyed
         @type node: L{Node}
 
-        @return: C{bool} True if the destroy was successful, otherwise False
+        @return: True if the destroy was successful, otherwise False
+        @rtype: C{bool}
         """
         raise NotImplementedError(
             'destroy_node not implemented for this driver')
@@ -500,7 +502,8 @@ class NodeDriver(BaseDriver):
         @param node: The node to be rebooted
         @type node: L{Node}
 
-        @return: C{bool} True if the reboot was successful, otherwise False
+        @return: True if the reboot was successful, otherwise False
+        @rtype: C{bool}
         """
         raise NotImplementedError(
             'reboot_node not implemented for this driver')
@@ -508,7 +511,8 @@ class NodeDriver(BaseDriver):
     def list_nodes(self):
         """
         List all nodes
-        @return: C{list} of L{Node} objects
+        @return:  list of node objects
+        @rtype: C{list} of L{Node}
         """
         raise NotImplementedError(
             'list_nodes not implemented for this driver')
@@ -520,7 +524,8 @@ class NodeDriver(BaseDriver):
         @keyword location: The location at which to list images
         @type location: L{NodeLocation}
 
-        @return: C{list} of L{NodeImage} objects
+        @return: list of node image objects
+        @rtype: C{list} of L{NodeImage}
         """
         raise NotImplementedError(
             'list_images not implemented for this driver')
@@ -532,7 +537,8 @@ class NodeDriver(BaseDriver):
         @keyword location: The location at which to list sizes
         @type location: L{NodeLocation}
 
-        @return: C{list} of L{NodeSize} objects
+        @return: list of node size objects
+        @rtype: C{list} of L{NodeSize}
         """
         raise NotImplementedError(
             'list_sizes not implemented for this driver')
@@ -540,7 +546,9 @@ class NodeDriver(BaseDriver):
     def list_locations(self):
         """
         List data centers for a provider
-        @return: C{list} of L{NodeLocation} objects
+
+        @return: list of node location objects
+        @rtype: C{list} of L{NodeLocation}
         """
         raise NotImplementedError(
             'list_locations not implemented for this driver')
@@ -557,6 +565,27 @@ class NodeDriver(BaseDriver):
         timing out).  This exception includes a Node object which you may want
         to destroy if incomplete deployments are not desirable.
 
+        >>> from libcloud.compute.drivers.dummy import DummyNodeDriver
+        >>> from libcloud.compute.deployment import ScriptDeployment
+        >>> from libcloud.compute.deployment import MultiStepDeployment
+        >>> from libcloud.compute.base import NodeAuthSSHKey
+        >>> driver = DummyNodeDriver(0)
+        >>> key = NodeAuthSSHKey('...') # read from file
+        >>> script = ScriptDeployment("yum -y install emacs strace tcpdump")
+        >>> msd = MultiStepDeployment([key, script])
+        >>> def d():
+        ...     try:
+        ...         node = driver.deploy_node(deploy=msd)
+        ...     except NotImplementedError:
+        ...         print ("not implemented for dummy driver")
+        >>> d()
+        not implemented for dummy driver
+
+        Deploy node is typically not overridden in subclasses.  The
+        existing implementation should be able to handle most such.
+
+        @inherits: L{NodeDriver.create_node}
+
         @keyword    deploy: Deployment to run once machine is online and
                             availble to SSH.
         @type       deploy: L{Deployment}
@@ -579,7 +608,7 @@ class NodeDriver(BaseDriver):
 
         @keyword    ssh_key: A path (or paths) to an SSH private key with which
                              to attempt to authenticate. (optional)
-        @type       ssh_key: C{string} or C{list} of C{string}s
+        @type       ssh_key: C{str} or C{list} of C{str}
 
         @keyword    max_tries: How many times to retry if a deployment fails
                                before giving up (default is 3)
@@ -588,27 +617,6 @@ class NodeDriver(BaseDriver):
         @keyword    ssh_interface: The interface to wait for. Default is
                                    'public_ips', other option is 'private_ips'.
         @type       ssh_interface: C{str}
-
-        See L{NodeDriver.create_node} for more keyword args.
-
-        >>> from libcloud.compute.drivers.dummy import DummyNodeDriver
-        >>> from libcloud.compute.deployment import ScriptDeployment
-        >>> from libcloud.compute.deployment import MultiStepDeployment
-        >>> from libcloud.compute.base import NodeAuthSSHKey
-        >>> driver = DummyNodeDriver(0)
-        >>> key = NodeAuthSSHKey('...') # read from file
-        >>> script = ScriptDeployment("yum -y install emacs strace tcpdump")
-        >>> msd = MultiStepDeployment([key, script])
-        >>> def d():
-        ...     try:
-        ...         node = driver.deploy_node(deploy=msd)
-        ...     except NotImplementedError:
-        ...         print ("not implemented for dummy driver")
-        >>> d()
-        not implemented for dummy driver
-
-        Deploy node is typically not overridden in subclasses.  The
-        existing implementation should be able to handle most such.
         """
         if not libcloud.compute.ssh.have_paramiko:
             raise RuntimeError('paramiko is not installed. You can install ' +
@@ -618,7 +626,7 @@ class NodeDriver(BaseDriver):
 
         if 'create_node' not in self.features:
             raise NotImplementedError(
-                    'deploy_node not implemented for this driver')
+                'deploy_node not implemented for this driver')
         elif 'generates_password' not in self.features["create_node"]:
             if 'password' not in self.features["create_node"] and \
                'ssh_key' not in self.features["create_node"]:
@@ -641,9 +649,10 @@ class NodeDriver(BaseDriver):
         try:
             # Wait until node is up and running and has IP assigned
             ssh_interface = kwargs.get('ssh_interface', 'public_ips')
-            node, ip_addresses = self._wait_until_running(node=node,
-                    wait_period=3, timeout=NODE_ONLINE_WAIT_TIMEOUT,
-                    ssh_interface=ssh_interface)
+            node, ip_addresses = self._wait_until_running(
+                node=node,
+                wait_period=3, timeout=NODE_ONLINE_WAIT_TIMEOUT,
+                ssh_interface=ssh_interface)
 
             if password:
                 node.extra['password'] = password
@@ -693,10 +702,11 @@ class NodeDriver(BaseDriver):
                                volume.  (optional)
         @type       snapshot:  C{str}
 
-        @return: The newly created L{StorageVolume}.
+        @return: The newly created volume.
+        @rtype: L{StorageVolume}
         """
         raise NotImplementedError(
-           'create_volume not implemented for this driver')
+            'create_volume not implemented for this driver')
 
     def destroy_volume(self, volume):
         """
@@ -705,11 +715,11 @@ class NodeDriver(BaseDriver):
         @param      volume: Volume to be destroyed
         @type       volume: L{StorageVolume}
 
-        @return: C{bool}
+        @rtype: C{bool}
         """
 
         raise NotImplementedError(
-               'destroy_volume not implemented for this driver')
+            'destroy_volume not implemented for this driver')
 
     def attach_volume(self, node, volume, device=None):
         """
@@ -725,7 +735,7 @@ class NodeDriver(BaseDriver):
                             e.g. '/dev/sdb (optional)
         @type       device: C{str}
 
-        @return: C{bool}
+        @rtype: C{bool}
         """
         raise NotImplementedError('attach not implemented for this driver')
 
@@ -736,7 +746,7 @@ class NodeDriver(BaseDriver):
         @param      volume: Volume to be detached
         @type       volume: L{StorageVolume}
 
-        @returns C{bool}
+        @rtype: C{bool}
         """
 
         raise NotImplementedError('detach not implemented for this driver')
@@ -795,8 +805,8 @@ class NodeDriver(BaseDriver):
                                     + 'but multiple nodes have same UUID'),
                                     driver=self)
 
-            if (len(nodes) == 1 and nodes[0].state == NodeState.RUNNING and \
-                filter_addresses(getattr(nodes[0], ssh_interface))):
+            if (len(nodes) == 1 and nodes[0].state == NodeState.RUNNING and
+                    filter_addresses(getattr(nodes[0], ssh_interface))):
                 return (nodes[0], filter_addresses(getattr(nodes[0],
                                                    ssh_interface)))
             else:

Modified: libcloud/trunk/libcloud/compute/drivers/bluebox.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/bluebox.py?rev=1364039&r1=1364038&r2=1364039&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/bluebox.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/bluebox.py Sat Jul 21 04:24:25 2012
@@ -19,7 +19,8 @@ libcloud driver for the Blue Box Blocks 
 This driver implements all libcloud functionality for the Blue Box Blocks API.
 
 Blue Box home page            http://bluebox.net
-Blue Box API documentation    https://boxpanel.bluebox.net/public/the_vault/index.php/Blocks_API
+Blue Box API documentation    https://boxpanel.bluebox
+.net/public/the_vault/index.php/Blocks_API
 """
 
 import copy
@@ -42,34 +43,34 @@ BLUEBOX_API_HOST = "boxpanel.bluebox.net
 # so we simply list what's available right now, along with all of the various
 # attributes that are needed by libcloud.
 BLUEBOX_INSTANCE_TYPES = {
-  '1gb': {
-    'id': '94fd37a7-2606-47f7-84d5-9000deda52ae',
-    'name': 'Block 1GB Virtual Server',
-    'ram': 1024,
-    'disk': 20,
-    'cpu': 0.5
-  },
-  '2gb': {
-    'id': 'b412f354-5056-4bf0-a42f-6ddd998aa092',
-    'name': 'Block 2GB Virtual Server',
-    'ram': 2048,
-    'disk': 25,
-    'cpu': 1
-  },
-  '4gb': {
-    'id': '0cd183d3-0287-4b1a-8288-b3ea8302ed58',
-    'name': 'Block 4GB Virtual Server',
-    'ram': 4096,
-    'disk': 50,
-    'cpu': 2
-  },
-  '8gb': {
-    'id': 'b9b87a5b-2885-4a2e-b434-44a163ca6251',
-    'name': 'Block 8GB Virtual Server',
-    'ram': 8192,
-    'disk': 100,
-    'cpu': 4
-  }
+    '1gb': {
+        'id': '94fd37a7-2606-47f7-84d5-9000deda52ae',
+        'name': 'Block 1GB Virtual Server',
+        'ram': 1024,
+        'disk': 20,
+        'cpu': 0.5
+    },
+    '2gb': {
+        'id': 'b412f354-5056-4bf0-a42f-6ddd998aa092',
+        'name': 'Block 2GB Virtual Server',
+        'ram': 2048,
+        'disk': 25,
+        'cpu': 1
+    },
+    '4gb': {
+        'id': '0cd183d3-0287-4b1a-8288-b3ea8302ed58',
+        'name': 'Block 4GB Virtual Server',
+        'ram': 4096,
+        'disk': 50,
+        'cpu': 2
+    },
+    '8gb': {
+        'id': 'b9b87a5b-2885-4a2e-b434-44a163ca6251',
+        'name': 'Block 8GB Virtual Server',
+        'ram': 8192,
+        'disk': 100,
+        'cpu': 4
+    }
 }
 
 RAM_PER_CPU = 2048
@@ -102,8 +103,11 @@ class BlueboxNodeSize(NodeSize):
         self.driver = driver
 
     def __repr__(self):
-        return (('<NodeSize: id=%s, name=%s, cpu=%s, ram=%s, disk=%s, price=%s, driver=%s ...>')
-               % (self.id, self.name, self.cpu, self.ram, self.disk, self.price, self.driver.name))
+        return ((
+                '<NodeSize: id=%s, name=%s, cpu=%s, ram=%s, disk=%s, '
+                'price=%s, driver=%s ...>')
+                % (self.id, self.name, self.cpu, self.ram, self.disk,
+                   self.price, self.driver.name))
 
 
 class BlueboxConnection(ConnectionUserAndKey):
@@ -190,14 +194,12 @@ class BlueboxNodeDriver(NodeDriver):
             raise Exception("SSH public key or password required.")
 
         params = urlencode(data)
-        result = self.connection.request('/api/blocks.json', headers=headers, data=params, method='POST')
+        result = self.connection.request('/api/blocks.json', headers=headers,
+                                         data=params, method='POST')
         node = self._to_node(result.object)
         return node
 
     def destroy_node(self, node):
-        """
-        Destroy node by passing in the node object
-        """
         url = '/api/blocks/%s.json' % (node.id)
         result = self.connection.request(url, method='DELETE')
 

Modified: libcloud/trunk/libcloud/compute/drivers/brightbox.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/brightbox.py?rev=1364039&r1=1364038&r2=1364039&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/brightbox.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/brightbox.py Sat Jul 21 04:24:25 2012
@@ -67,10 +67,10 @@ class BrightboxNodeDriver(NodeDriver):
 
     def _to_node(self, data):
         extra_data = _extract(data, ['fqdn', 'user_data', 'status',
-                                    'interfaces', 'snapshots',
-                                    'server_groups', 'hostname',
-                                    'started_at', 'created_at',
-                                    'deleted_at'])
+                                     'interfaces', 'snapshots',
+                                     'server_groups', 'hostname',
+                                     'started_at', 'created_at',
+                                     'deleted_at'])
         extra_data['zone'] = self._to_location(data['zone'])
         return Node(
             id=data['id'],
@@ -95,11 +95,11 @@ class BrightboxNodeDriver(NodeDriver):
 
     def _to_image(self, data):
         extra_data = _extract(data, ['arch', 'compatibility_mode',
-                                   'created_at', 'description',
-                                   'disk_size', 'min_ram', 'official',
-                                   'owner', 'public', 'source',
-                                   'source_type', 'status', 'username',
-                                   'virtual_size', 'licence_name'])
+                                     'created_at', 'description',
+                                     'disk_size', 'min_ram', 'official',
+                                     'owner', 'public', 'source',
+                                     'source_type', 'status', 'username',
+                                     'virtual_size', 'licence_name'])
 
         if data.get('ancestor', None):
             extra_data['ancestor'] = self._to_image(data['ancestor'])
@@ -143,15 +143,16 @@ class BrightboxNodeDriver(NodeDriver):
     def create_node(self, **kwargs):
         """Create a new Brightbox node
 
-        See L{NodeDriver.create_node} for more keyword args.
         Reference: https://api.gb1.brightbox.com/1.0/#server_create_server
 
+        @inherits: L{NodeDriver.create_node}
+
         @keyword    ex_userdata: User data
         @type       ex_userdata: C{str}
 
         @keyword    ex_servergroup: Name or list of server group ids to
                                     add server to
-        @type       ex_servergroup: C{str} or C{list} of C{str}s
+        @type       ex_servergroup: C{str} or C{list} of C{str}
         """
         data = {
             'name': kwargs['name'],
@@ -175,11 +176,9 @@ class BrightboxNodeDriver(NodeDriver):
         return self._to_node(data)
 
     def destroy_node(self, node):
-        """
-        Destroy node by passing in the node object
-        """
-        response = self.connection.request('/%s/servers/%s' % \
-                   (self.api_version, node.id), method='DELETE')
+        response = self.connection.request(
+            '/%s/servers/%s' % (self.api_version, node.id),
+            method='DELETE')
         return response.status == httplib.ACCEPTED
 
     def list_nodes(self):
@@ -205,7 +204,7 @@ class BrightboxNodeDriver(NodeDriver):
 
         @note: This is an API extension for use on Brightbox
 
-        @return: C{list} of C{dict}
+        @rtype: C{list} of C{dict}
         """
         return self.connection.request('/%s/cloud_ips' % self.api_version) \
                               .object
@@ -219,7 +218,7 @@ class BrightboxNodeDriver(NodeDriver):
         @param      reverse_dns: Reverse DNS hostname
         @type       reverse_dns: C{str}
 
-        @return: C{dict}
+        @rtype: C{dict}
         """
         params = {}
 
@@ -240,10 +239,11 @@ class BrightboxNodeDriver(NodeDriver):
         @param      reverse_dns: Reverse DNS hostname
         @type       reverse_dns: C{str}
 
-        @return: C{dict}
+        @rtype: C{dict}
         """
         response = self._put('/%s/cloud_ips/%s' % (self.api_version,
-            cloud_ip_id), {'reverse_dns': reverse_dns})
+                                                   cloud_ip_id),
+                             {'reverse_dns': reverse_dns})
         return response.status == httplib.OK
 
     def ex_map_cloud_ip(self, cloud_ip_id, interface_id):
@@ -260,10 +260,12 @@ class BrightboxNodeDriver(NodeDriver):
                               which this Cloud IP should be mapped to
         @type   interface_id: C{str}
 
-        @return: C{bool} True if the mapping was successful.
+        @return: True if the mapping was successful.
+        @rtype: C{bool}
         """
         response = self._post('/%s/cloud_ips/%s/map' % (self.api_version,
-            cloud_ip_id), {'destination': interface_id})
+                                                        cloud_ip_id),
+                              {'destination': interface_id})
         return response.status == httplib.ACCEPTED
 
     def ex_unmap_cloud_ip(self, cloud_ip_id):
@@ -277,7 +279,8 @@ class BrightboxNodeDriver(NodeDriver):
         @param  cloud_ip_id: The id of the cloud ip.
         @type   cloud_ip_id: C{str}
 
-        @return: C{bool} True if the unmap was successful.
+        @return: True if the unmap was successful.
+        @rtype: C{bool}
         """
         response = self._post('/%s/cloud_ips/%s/unmap' % (self.api_version,
                                                           cloud_ip_id))
@@ -292,8 +295,11 @@ class BrightboxNodeDriver(NodeDriver):
         @param  cloud_ip_id: The id of the cloud ip.
         @type   cloud_ip_id: C{str}
 
-        @return: C{bool} True if the unmap was successful.
+        @return: True if the unmap was successful.
+        @rtype: C{bool}
         """
-        response = self.connection.request('/%s/cloud_ips/%s' %
-                           (self.api_version, cloud_ip_id), method='DELETE')
+        response = self.connection.request(
+            '/%s/cloud_ips/%s' % (self.api_version,
+                                  cloud_ip_id),
+            method='DELETE')
         return response.status == httplib.OK

Modified: libcloud/trunk/libcloud/compute/drivers/cloudsigma.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/cloudsigma.py?rev=1364039&r1=1364038&r2=1364039&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/cloudsigma.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/cloudsigma.py Sat Jul 21 04:24:25 2012
@@ -22,7 +22,6 @@ import base64
 
 from libcloud.utils.py3 import b
 
-
 from libcloud.utils.misc import str2dicts, str2list, dict2str
 from libcloud.common.base import ConnectionUserAndKey, Response
 from libcloud.common.types import InvalidCredsError
@@ -38,7 +37,7 @@ API_ENDPOINTS = {
         'host': 'api.zrh.cloudsigma.com'
     },
 
-   'lvs': {
+    'lvs': {
         'name': 'Las Vegas',
         'country': 'United States',
         'host': 'api.lvs.cloudsigma.com'
@@ -49,9 +48,11 @@ API_ENDPOINTS = {
 DEFAULT_ENDPOINT = 'zrh'
 
 # CloudSigma doesn't specify special instance types.
-# Basically for CPU any value between 0.5 GHz and 20.0 GHz should work, 500 MB to 32000 MB for ram
+# Basically for CPU any value between 0.5 GHz and 20.0 GHz should work,
+# 500 MB to 32000 MB for ram
 # and 1 GB to 1024 GB for hard drive size.
-# Plans in this file are based on examples listed on http://www.cloudsigma.com/en/pricing/price-schedules
+# Plans in this file are based on examples listed on http://www.cloudsigma
+# .com/en/pricing/price-schedules
 INSTANCE_TYPES = {
     'micro-regular': {
         'id': 'micro-regular',
@@ -180,10 +181,10 @@ class CloudSigmaNodeSize(NodeSize):
         self.driver = driver
 
     def __repr__(self):
-        return (('<NodeSize: id=%s, name=%s, cpu=%s, ram=%s disk=%s bandwidth=%s '
-                 'price=%s driver=%s ...>')
-                % (self.id, self.name, self.cpu, self.ram, self.disk, self.bandwidth,
-                   self.price, self.driver.name))
+        return (('<NodeSize: id=%s, name=%s, cpu=%s, ram=%s disk=%s '
+                 'bandwidth=%s price=%s driver=%s ...>')
+                % (self.id, self.name, self.cpu, self.ram, self.disk,
+                   self.bandwidth, self.price, self.driver.name))
 
 
 class CloudSigmaBaseConnection(ConnectionUserAndKey):
@@ -194,10 +195,8 @@ class CloudSigmaBaseConnection(Connectio
         headers['Accept'] = 'application/json'
         headers['Content-Type'] = 'application/json'
 
-        headers['Authorization'] = 'Basic %s' % (base64.b64encode(b('%s:%s' %
-                                                 (self.user_id,
-                                                     self.key))).decode('utf-8'))
-
+        headers['Authorization'] = 'Basic %s' % (base64.b64encode(
+            b('%s:%s' % (self.user_id, self.key))).decode('utf-8'))
         return headers
 
 
@@ -211,7 +210,10 @@ class CloudSigmaBaseNodeDriver(NodeDrive
         """
         Reboot a node.
 
-        Because Cloudsigma API does not provide native reboot call, it's emulated using stop and start.
+        Because Cloudsigma API does not provide native reboot call,
+        it's emulated using stop and start.
+
+        @inherits: L{NodeDriver.reboot_node}
         """
         node = self._get_node(node.id)
         state = node.state
@@ -222,7 +224,8 @@ class CloudSigmaBaseNodeDriver(NodeDrive
             stopped = True
 
         if not stopped:
-            raise CloudSigmaException('Could not stop node with id %s' % (node.id))
+            raise CloudSigmaException(
+                'Could not stop node with id %s' % (node.id))
 
         success = self.ex_start_node(node)
 
@@ -233,6 +236,8 @@ class CloudSigmaBaseNodeDriver(NodeDrive
         Destroy a node (all the drives associated with it are NOT destroyed).
 
         If a node is still running, it's stopped before it's destroyed.
+
+        @inherits: L{NodeDriver.destroy_node}
         """
         node = self._get_node(node.id)
         state = node.state
@@ -244,37 +249,42 @@ class CloudSigmaBaseNodeDriver(NodeDrive
             stopped = True
 
         if not stopped:
-            raise CloudSigmaException('Could not stop node with id %s' % (node.id))
+            raise CloudSigmaException(
+                'Could not stop node with id %s' % (node.id))
 
-        response = self.connection.request(action='/servers/%s/destroy' % (node.id),
-                                           method='POST')
+        response = self.connection.request(
+            action='/servers/%s/destroy' % (node.id),
+            method='POST')
         return response.status == 204
 
     def list_images(self, location=None):
         """
-        Return a list of available standard images (this call might take up to 15 seconds to return).
+        Return a list of available standard images (this call might take up
+        to 15 seconds to return).
+
+        @inherits: L{NodeDriver.list_images}
         """
-        response = self.connection.request(action='/drives/standard/info').object
+        response = self.connection.request(
+            action='/drives/standard/info').object
 
         images = []
         for value in response:
             if value.get('type'):
                 if value['type'] == 'disk':
-                    image = NodeImage(id=value['drive'], name=value['name'], driver=self.connection.driver,
-                                    extra={'size': value['size']})
+                    image = NodeImage(id=value['drive'], name=value['name'],
+                                      driver=self.connection.driver,
+                                      extra={'size': value['size']})
                     images.append(image)
 
         return images
 
     def list_sizes(self, location=None):
-        """
-        Return a list of available node sizes.
-        """
         sizes = []
         for key, value in INSTANCE_TYPES.items():
             size = CloudSigmaNodeSize(id=value['id'], name=value['name'],
                                       cpu=value['cpu'], ram=value['memory'],
-                                      disk=value['disk'], bandwidth=value['bandwidth'],
+                                      disk=value['disk'],
+                                      bandwidth=value['bandwidth'],
                                       price=self._get_size_price(size_id=key),
                                       driver=self.connection.driver)
             sizes.append(size)
@@ -282,9 +292,6 @@ class CloudSigmaBaseNodeDriver(NodeDrive
         return sizes
 
     def list_nodes(self):
-        """
-        Return a list of nodes.
-        """
         response = self.connection.request(action='/servers/info').object
 
         nodes = []
@@ -298,16 +305,18 @@ class CloudSigmaBaseNodeDriver(NodeDrive
         """
         Creates a CloudSigma instance
 
-        See L{NodeDriver.create_node} for more keyword args.
+        @inherits: L{NodeDriver.create_node}
 
         @keyword    name: String with a name for this new node (required)
-        @type       name: C{string}
+        @type       name: C{str}
 
-        @keyword    smp: Number of virtual processors or None to calculate based on the cpu speed
+        @keyword    smp: Number of virtual processors or None to calculate
+        based on the cpu speed
         @type       smp: C{int}
 
-        @keyword    nic_model: e1000, rtl8139 or virtio (is not specified, e1000 is used)
-        @type       nic_model: C{string}
+        @keyword    nic_model: e1000, rtl8139 or virtio (is not specified,
+        e1000 is used)
+        @type       nic_model: C{str}
 
         @keyword    vnc_password: If not set, VNC access is disabled.
         @type       vnc_password: C{bool}
@@ -334,32 +343,38 @@ class CloudSigmaBaseNodeDriver(NodeDrive
                            'size': '%sG' % (kwargs['size'].disk),
                            'driveType': drive_type})
 
-        response = self.connection.request(action='/drives/%s/clone' % image.id, data=dict2str(drive_data),
-                                           method='POST').object
+        response = self.connection.request(
+            action='/drives/%s/clone' % image.id,
+            data=dict2str(drive_data),
+            method='POST').object
 
         if not response:
             raise CloudSigmaException('Drive creation failed')
 
         drive_uuid = response[0]['drive']
 
-        response = self.connection.request(action='/drives/%s/info' % (drive_uuid)).object
+        response = self.connection.request(
+            action='/drives/%s/info' % (drive_uuid)).object
         imaging_start = time.time()
         while 'imaging' in response[0]:
-            response = self.connection.request(action='/drives/%s/info' % (drive_uuid)).object
+            response = self.connection.request(
+                action='/drives/%s/info' % (drive_uuid)).object
             elapsed_time = time.time() - imaging_start
             if 'imaging' in response[0] and elapsed_time >= IMAGING_TIMEOUT:
                 raise CloudSigmaException('Drive imaging timed out')
             time.sleep(1)
 
         node_data = {}
-        node_data.update({'name': kwargs['name'], 'cpu': size.cpu, 'mem': size.ram, 'ide:0:0': drive_uuid,
-                          'boot': 'ide:0:0', 'smp': smp})
+        node_data.update(
+            {'name': kwargs['name'], 'cpu': size.cpu, 'mem': size.ram,
+             'ide:0:0': drive_uuid, 'boot': 'ide:0:0', 'smp': smp})
         node_data.update({'nic:0:model': nic_model, 'nic:0:dhcp': 'auto'})
 
         if vnc_password:
             node_data.update({'vnc:ip': 'auto', 'vnc:password': vnc_password})
 
-        response = self.connection.request(action='/servers/create', data=dict2str(node_data),
+        response = self.connection.request(action='/servers/create',
+                                           data=dict2str(node_data),
                                            method='POST').object
 
         if not isinstance(response, list):
@@ -369,7 +384,8 @@ class CloudSigmaBaseNodeDriver(NodeDrive
         if node is None:
             # Insufficient funds, destroy created drive
             self.ex_drive_destroy(drive_uuid)
-            raise CloudSigmaInsufficientFundsException('Insufficient funds, node creation failed')
+            raise CloudSigmaInsufficientFundsException(
+                'Insufficient funds, node creation failed')
 
         # Start the node after it has been created
         started = self.ex_start_node(node)
@@ -382,13 +398,20 @@ class CloudSigmaBaseNodeDriver(NodeDrive
     def ex_destroy_node_and_drives(self, node):
         """
         Destroy a node and all the drives associated with it.
+
+        @param      node: Node which should be used
+        @type       node: L{Node}
+
+        @rtype: C{bool}
         """
         node = self._get_node_info(node)
 
         drive_uuids = []
         for key, value in node.items():
-            if (key.startswith('ide:') or key.startswith('scsi') or key.startswith('block')) and \
-               not (key.endswith(':bytes') or key.endswith(':requests') or key.endswith('media')):
+            if (key.startswith('ide:') or key.startswith(
+                'scsi') or key.startswith('block')) and\
+                not (key.endswith(':bytes') or
+                     key.endswith(':requests') or key.endswith('media')):
                 drive_uuids.append(value)
 
         node_destroyed = self.destroy_node(self._to_node(node))
@@ -404,8 +427,11 @@ class CloudSigmaBaseNodeDriver(NodeDrive
     def ex_static_ip_list(self):
         """
         Return a list of available static IP addresses.
+
+        @rtype: C{list} of C{str}
         """
-        response = self.connection.request(action='/resources/ip/list', method='GET')
+        response = self.connection.request(action='/resources/ip/list',
+                                           method='GET')
 
         if response.status != 200:
             raise CloudSigmaException('Could not retrieve IP list')
@@ -416,6 +442,8 @@ class CloudSigmaBaseNodeDriver(NodeDrive
     def ex_drives_list(self):
         """
         Return a list of all the available drives.
+
+        @rtype: C{list} of C{dict}
         """
         response = self.connection.request(action='/drives/info', method='GET')
 
@@ -424,9 +452,12 @@ class CloudSigmaBaseNodeDriver(NodeDrive
 
     def ex_static_ip_create(self):
         """
-        Create a new static IP address.
+        Create a new static IP address.p
+
+        @rtype: C{list} of C{dict}
         """
-        response = self.connection.request(action='/resources/ip/create', method='GET')
+        response = self.connection.request(action='/resources/ip/create',
+                                           method='GET')
 
         result = str2dicts(response.body)
         return result
@@ -434,8 +465,14 @@ class CloudSigmaBaseNodeDriver(NodeDrive
     def ex_static_ip_destroy(self, ip_address):
         """
         Destroy a static IP address.
+
+        @param      ip_address: IP address which should be used
+        @type       ip_address: C{str}
+
+        @rtype: C{bool}
         """
-        response = self.connection.request(action='/resources/ip/%s/destroy' % (ip_address), method='GET')
+        response = self.connection.request(
+            action='/resources/ip/%s/destroy' % (ip_address), method='GET')
 
         return response.status == 204
 
@@ -443,8 +480,14 @@ class CloudSigmaBaseNodeDriver(NodeDrive
         """
         Destroy a drive with a specified uuid.
         If the drive is currently mounted an exception is thrown.
+
+        @param      drive_uuid: Drive uuid which should be used
+        @type       drive_uuid: C{str}
+
+        @rtype: C{bool}
         """
-        response = self.connection.request(action='/drives/%s/destroy' % (drive_uuid), method='POST')
+        response = self.connection.request(
+            action='/drives/%s/destroy' % (drive_uuid), method='POST')
 
         return response.status == 204
 
@@ -452,10 +495,21 @@ class CloudSigmaBaseNodeDriver(NodeDrive
         """
         Update a node configuration.
         Changing most of the parameters requires node to be stopped.
+
+        @param      node: Node which should be used
+        @type       node: L{Node}
+
+        @param      kwargs: keyword arguments
+        @type       kwargs: C{dict}
+
+        @rtype: C{bool}
         """
-        valid_keys = ('^name$', '^parent$', '^cpu$', '^smp$', '^mem$', '^boot$', '^nic:0:model$', '^nic:0:dhcp',
-                      '^nic:1:model$', '^nic:1:vlan$', '^nic:1:mac$', '^vnc:ip$', '^vnc:password$', '^vnc:tls',
-                      '^ide:[0-1]:[0-1](:media)?$', '^scsi:0:[0-7](:media)?$', '^block:[0-7](:media)?$')
+        valid_keys = ('^name$', '^parent$', '^cpu$', '^smp$', '^mem$',
+                      '^boot$', '^nic:0:model$', '^nic:0:dhcp',
+                      '^nic:1:model$', '^nic:1:vlan$', '^nic:1:mac$',
+                      '^vnc:ip$', '^vnc:password$', '^vnc:tls',
+                      '^ide:[0-1]:[0-1](:media)?$', '^scsi:0:[0-7](:media)?$',
+                      '^block:[0-7](:media)?$')
 
         invalid_keys = []
         keys = list(kwargs.keys())
@@ -469,42 +523,66 @@ class CloudSigmaBaseNodeDriver(NodeDrive
                 invalid_keys.append(key)
 
         if invalid_keys:
-            raise CloudSigmaException('Invalid configuration key specified: %s' % (',' .join(invalid_keys)))
-
-        response = self.connection.request(action='/servers/%s/set' % (node.id), data=dict2str(kwargs),
-                                           method='POST')
+            raise CloudSigmaException(
+                'Invalid configuration key specified: %s' % (
+                ',' .join(invalid_keys)))
+
+        response = self.connection.request(
+            action='/servers/%s/set' % (node.id),
+            data=dict2str(kwargs),
+            method='POST')
 
         return (response.status == 200 and response.body != '')
 
     def ex_start_node(self, node):
         """
         Start a node.
+
+        @param      node: Node which should be used
+        @type       node: L{Node}
+
+        @rtype: C{bool}
         """
-        response = self.connection.request(action='/servers/%s/start' % (node.id),
-                                           method='POST')
+        response = self.connection.request(
+            action='/servers/%s/start' % (node.id),
+            method='POST')
 
         return response.status == 200
 
     def ex_stop_node(self, node):
         """
         Stop (shutdown) a node.
+
+        @param      node: Node which should be used
+        @type       node: L{Node}
+
+        @rtype: C{bool}
         """
-        response = self.connection.request(action='/servers/%s/stop' % (node.id),
-                                           method='POST')
+        response = self.connection.request(
+            action='/servers/%s/stop' % (node.id),
+            method='POST')
         return response.status == 204
 
     def ex_shutdown_node(self, node):
         """
         Stop (shutdown) a node.
+
+        @inherits: L{CloudSigmaBaseNodeDriver.ex_stop_node}
         """
         return self.ex_stop_node(node)
 
     def ex_destroy_drive(self, drive_uuid):
         """
         Destroy a drive.
+
+        @param      drive_uuid: Drive uuid which should be used
+        @type       drive_uuid: C{str}
+
+        @rtype: C{bool}
         """
-        response = self.connection.request(action='/drives/%s/destroy' % (drive_uuid),
-                                           method='POST')
+        response = self.connection.request(
+            action='/drives/%s/destroy' % (drive_uuid),
+            method='POST')
         return response.status == 204
 
     def _to_node(self, data):
@@ -527,7 +605,8 @@ class CloudSigmaBaseNodeDriver(NodeDrive
                     public_ips = [data['nic:0:dhcp']]
 
             extra = {}
-            extra_keys = [('cpu', 'int'), ('smp', 'auto'), ('mem', 'int'), ('status', 'str')]
+            extra_keys = [('cpu', 'int'), ('smp', 'auto'), ('mem', 'int'),
+                          ('status', 'str')]
             for key, value_type in extra_keys:
                 if key in data:
                     value = data[key]
@@ -543,10 +622,12 @@ class CloudSigmaBaseNodeDriver(NodeDrive
                     extra.update({key: value})
 
             if 'vnc:ip' in data and 'vnc:password' in data:
-                extra.update({'vnc_ip': data['vnc:ip'], 'vnc_password': data['vnc:password']})
+                extra.update({'vnc_ip': data['vnc:ip'],
+                              'vnc_password': data['vnc:password']})
 
             node = Node(id=data['server'], name=data['name'], state=state,
-                        public_ips=public_ips, private_ips=None, driver=self.connection.driver,
+                        public_ips=public_ips, private_ips=None,
+                        driver=self.connection.driver,
                         extra=extra)
 
             return node
@@ -557,12 +638,14 @@ class CloudSigmaBaseNodeDriver(NodeDrive
         node = [node for node in nodes if node.id == node.id]
 
         if not node:
-            raise CloudSigmaException('Node with id %s does not exist' % (node_id))
+            raise CloudSigmaException(
+                'Node with id %s does not exist' % (node_id))
 
         return node[0]
 
     def _get_node_info(self, node):
-        response = self.connection.request(action='/servers/%s/info' % (node.id))
+        response = self.connection.request(
+            action='/servers/%s/info' % (node.id))
 
         result = str2dicts(response.body)
         return result[0]

Modified: libcloud/trunk/libcloud/compute/drivers/cloudstack.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/cloudstack.py?rev=1364039&r1=1364038&r2=1364039&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/cloudstack.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/cloudstack.py Sat Jul 21 04:24:25 2012
@@ -15,8 +15,8 @@
 
 from libcloud.compute.providers import Provider
 from libcloud.common.cloudstack import CloudStackDriverMixIn
-from libcloud.compute.base import Node, NodeDriver, NodeImage, NodeLocation, \
-                                  NodeSize, StorageVolume
+from libcloud.compute.base import Node, NodeDriver, NodeImage, NodeLocation,\
+    NodeSize, StorageVolume
 from libcloud.compute.types import NodeState, LibcloudError
 
 
@@ -90,6 +90,7 @@ class CloudStackDiskOffering(object):
     def __eq__(self, other):
         return self.__class__ is other.__class__ and self.id == other.id
 
+
 class CloudStackNodeDriver(CloudStackDriverMixIn, NodeDriver):
     """Driver for the CloudStack API.
 
@@ -184,9 +185,7 @@ class CloudStackNodeDriver(CloudStackDri
                 public_ips=public_ips.get(vm['id'], {}).keys(),
                 private_ips=private_ips,
                 driver=self,
-                extra={
-                    'zoneid': vm['zoneid'],
-                }
+                extra={'zoneid': vm['zoneid'], }
             )
 
             addrs = public_ips.get(vm['id'], {}).items()
@@ -224,13 +223,10 @@ class CloudStackNodeDriver(CloudStackDri
         if 'network_id' in kwargs:
             extra_args['networkids'] = network_id
 
-        result = self._async_request('deployVirtualMachine',
-            name=name,
-            displayname=name,
-            serviceofferingid=size.id,
-            templateid=image.id,
-            zoneid=location.id,
-            **extra_args
+        result = self._async_request(
+            'deployVirtualMachine', name=name, displayname=name,
+            serviceofferingid=size.id, templateid=image.id,
+            zoneid=location.id, **extra_args
         )
 
         node = result['virtualmachine']
@@ -258,18 +254,21 @@ class CloudStackNodeDriver(CloudStackDri
         return True
 
     def ex_list_disk_offerings(self):
-        """Fetch a list of all available disk offerings."""
+        """Fetch a list of all available disk offerings.
+
+        @rtype: C{list} of L{CloudStackDiskOffering}
+        """
 
         diskOfferings = []
 
         diskOfferResponse = self._sync_request('listDiskOfferings')
         for diskOfferDict in diskOfferResponse.get('diskoffering', ()):
             diskOfferings.append(
-                    CloudStackDiskOffering(
-                        id=diskOfferDict['id'],
-                        name=diskOfferDict['name'],
-                        size=diskOfferDict['disksize'],
-                        customizable=diskOfferDict['iscustomized']))
+                CloudStackDiskOffering(
+                    id=diskOfferDict['id'],
+                    name=diskOfferDict['name'],
+                    size=diskOfferDict['disksize'],
+                    customizable=diskOfferDict['iscustomized']))
 
         return diskOfferings
 
@@ -280,25 +279,25 @@ class CloudStackNodeDriver(CloudStackDri
                 break
         else:
             raise LibcloudError(
-                    'Disk offering with size=%s not found' % size)
+                'Disk offering with size=%s not found' % size)
 
         extraParams = dict()
         if diskOffering.customizable:
             extraParams['size'] = size
 
         requestResult = self._async_request('createVolume',
-                                name=name,
-                                diskOfferingId=diskOffering.id,
-                                zoneId=location.id,
-                                **extraParams)
+                                            name=name,
+                                            diskOfferingId=diskOffering.id,
+                                            zoneId=location.id,
+                                            **extraParams)
 
         volumeResponse = requestResult['volume']
 
         return StorageVolume(id=volumeResponse['id'],
-                            name=name,
-                            size=size,
-                            driver=self,
-                            extra=dict(name=volumeResponse['name']))
+                             name=name,
+                             size=size,
+                             driver=self,
+                             extra=dict(name=volumeResponse['name']))
 
     def attach_volume(self, node, volume, device=None):
         # TODO Add handling for device name
@@ -315,13 +314,21 @@ class CloudStackNodeDriver(CloudStackDri
         return True
 
     def ex_allocate_public_ip(self, node):
-        "Allocate a public IP and bind it to a node."
+        """
+        "Allocate a public IP and bind it to a node.
+
+        @param      node: Node which should be used
+        @type       node: L{Node}
+
+        @rtype: L{CloudStackAddress}
+        """
 
         zoneid = node.extra['zoneid']
         addr = self._async_request('associateIpAddress', zoneid=zoneid)
         addr = addr['ipaddress']
-        result = self._sync_request('enableStaticNat', virtualmachineid=node.id,
-                                   ipaddressid=addr['id'])
+        result = self._sync_request('enableStaticNat',
+                                    virtualmachineid=node.id,
+                                    ipaddressid=addr['id'])
         if result.get('success', '').lower() != 'true':
             return None
 
@@ -331,7 +338,17 @@ class CloudStackNodeDriver(CloudStackDri
         return addr
 
     def ex_release_public_ip(self, node, address):
-        "Release a public IP."
+        """
+        Release a public IP.
+
+        @param      node: Node which should be used
+        @type       node: L{Node}
+
+        @param      address: CloudStackAddress which should be used
+        @type       address: L{CloudStackAddress}
+
+        @rtype: C{bool}
+        """
 
         node.extra['ip_addresses'].remove(address)
         node.public_ips.remove(address.address)
@@ -342,7 +359,26 @@ class CloudStackNodeDriver(CloudStackDri
 
     def ex_add_ip_forwarding_rule(self, node, address, protocol,
                                   start_port, end_port=None):
-        "Add a NAT/firewall forwarding rule."
+        """
+        "Add a NAT/firewall forwarding rule.
+
+        @param      node: Node which should be used
+        @type       node: L{Node}
+
+        @param      address: CloudStackAddress which should be used
+        @type       address: L{CloudStackAddress}
+
+        @param      protocol: Protocol which should be used (TCP or UDP)
+        @type       protocol: C{str}
+
+        @param      start_port: Start port which should be used
+        @type       start_port: C{int}
+
+        @param end_port: End port which should be used
+        @type end_port: C{int}
+
+        @rtype: L{CloudStackForwardingRule}
+        """
 
         protocol = protocol.upper()
         if protocol not in ('TCP', 'UDP'):
@@ -364,14 +400,37 @@ class CloudStackNodeDriver(CloudStackDri
         return rule
 
     def ex_delete_ip_forwarding_rule(self, node, rule):
-        "Remove a NAT/firewall forwarding rule."
+        """
+        Remove a NAT/firewall forwarding rule.
+
+        @param      node: Node which should be used
+        @type       node: L{Node}
+
+        @param rule: Forwarding rule which should be used
+        @type rule: L{CloudStackForwardingRule}
+
+        @rtype: C{bool}
+        """
 
         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."
+        """
+        Registers an existing ISO by URL.
+
+        @param      name: Name which should be used
+        @type       name: C{str}
+
+        @param      url: Url should be used
+        @type       url: C{str}
+
+        @param      location: Location which should be used
+        @type       location: L{NodeLocation}
+
+        @rtype: C{str}
+        """
         if location is None:
             location = self.list_locations()[0]
 

Modified: libcloud/trunk/libcloud/compute/drivers/dreamhost.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/dreamhost.py?rev=1364039&r1=1364038&r2=1364039&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/dreamhost.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/dreamhost.py Sat Jul 21 04:24:25 2012
@@ -30,45 +30,44 @@ from libcloud.compute.types import Provi
 
 DH_PS_SIZES = {
     'minimum': {
-        'id' : 'minimum',
-        'name' : 'Minimum DH PS size',
-        'ram' : 300,
-        'disk' : None,
-        'bandwidth' : None
+        'id': 'minimum',
+        'name': 'Minimum DH PS size',
+        'ram': 300,
+        'disk': None,
+        'bandwidth': None
     },
     'maximum': {
-        'id' : 'maximum',
-        'name' : 'Maximum DH PS size',
-        'ram' : 4000,
-        'disk' : None,
-        'bandwidth' : None
+        'id': 'maximum',
+        'name': 'Maximum DH PS size',
+        'ram': 4000,
+        'disk': None,
+        'bandwidth': None
     },
     'default': {
-        'id' : 'default',
-        'name' : 'Default DH PS size',
-        'ram' : 2300,
-        'disk' : None,
-        'bandwidth' : None
+        'id': 'default',
+        'name': 'Default DH PS size',
+        'ram': 2300,
+        'disk': None,
+        'bandwidth': None
     },
     'low': {
-        'id' : 'low',
-        'name' : 'DH PS with 1GB RAM',
-        'ram' : 1000,
-        'disk' : None,
-        'bandwidth' : None
+        'id': 'low',
+        'name': 'DH PS with 1GB RAM',
+        'ram': 1000,
+        'disk': None,
+        'bandwidth': None
     },
     'high': {
-        'id' : 'high',
-        'name' : 'DH PS with 3GB RAM',
-        'ram' : 3000,
-        'disk' : None,
-        'bandwidth' : None
+        'id': 'high',
+        'name': 'DH PS with 3GB RAM',
+        'ram': 3000,
+        'disk': None,
+        'bandwidth': None
     },
 }
 
 
 class DreamhostAPIException(Exception):
-
     def __str__(self):
         return self.args[0]
 
@@ -136,17 +135,17 @@ class DreamhostNodeDriver(NodeDriver):
     def create_node(self, **kwargs):
         """Create a new Dreamhost node
 
-        See L{NodeDriver.create_node} for more keyword args.
+        @inherits: L{NodeDriver.create_node}
 
         @keyword    ex_movedata: Copy all your existing users to this new PS
         @type       ex_movedata: C{str}
         """
         size = kwargs['size'].ram
         params = {
-            'cmd' : 'dreamhost_ps-add_ps',
-            'movedata' : kwargs.get('movedata', 'no'),
-            'type' : kwargs['image'].name,
-            'size' : size
+            'cmd': 'dreamhost_ps-add_ps',
+            'movedata': kwargs.get('movedata', 'no'),
+            'type': kwargs['image'].name,
+            'size': size
         }
         data = self.connection.request('/', params).object
         return Node(
@@ -157,14 +156,14 @@ class DreamhostNodeDriver(NodeDriver):
             private_ips=[],
             driver=self.connection.driver,
             extra={
-                'type' : kwargs['image'].name
+                'type': kwargs['image'].name
             }
         )
 
     def destroy_node(self, node):
         params = {
-            'cmd' : 'dreamhost_ps-remove_ps',
-            'ps' : node.id
+            'cmd': 'dreamhost_ps-remove_ps',
+            'ps': node.id
         }
         try:
             return self.connection.request('/', params).success()
@@ -173,8 +172,8 @@ class DreamhostNodeDriver(NodeDriver):
 
     def reboot_node(self, node):
         params = {
-            'cmd' : 'dreamhost_ps-reboot',
-            'ps' : node.id
+            'cmd': 'dreamhost_ps-reboot',
+            'ps': node.id
         }
         try:
             return self.connection.request('/', params).success()
@@ -212,17 +211,14 @@ class DreamhostNodeDriver(NodeDriver):
             'You cannot select a location for '
             'DreamHost Private Servers at this time.')
 
-    ############################################
-    # Private Methods (helpers and extensions) #
-    ############################################
     def _resize_node(self, node, size):
         if (size < 300 or size > 4000):
             return False
 
         params = {
-            'cmd' : 'dreamhost_ps-set_size',
-            'ps' : node.id,
-            'size' : size
+            'cmd': 'dreamhost_ps-set_size',
+            'ps': node.id,
+            'size': size
         }
         try:
             return self.connection.request('/', params).success()

Modified: libcloud/trunk/libcloud/compute/drivers/dummy.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/dummy.py?rev=1364039&r1=1364038&r2=1364039&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/dummy.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/dummy.py Sat Jul 21 04:24:25 2012
@@ -82,30 +82,30 @@ class DummyNodeDriver(NodeDriver):
             for i in range(num):
                 ip = _int_to_ip(startip + i)
                 self.nl.append(
-                Node(id=i,
-                    name='dummy-%d' % (i),
-                    state=NodeState.RUNNING,
-                    public_ips=[ip],
-                    private_ips=[],
-                    driver=self,
-                    extra={'foo': 'bar'})
+                    Node(id=i,
+                         name='dummy-%d' % (i),
+                         state=NodeState.RUNNING,
+                         public_ips=[ip],
+                         private_ips=[],
+                         driver=self,
+                         extra={'foo': 'bar'})
                 )
         else:
             self.nl = [
                 Node(id=1,
-                    name='dummy-1',
-                    state=NodeState.RUNNING,
-                    public_ips=['127.0.0.1'],
-                    private_ips=[],
-                    driver=self,
-                    extra={'foo': 'bar'}),
+                     name='dummy-1',
+                     state=NodeState.RUNNING,
+                     public_ips=['127.0.0.1'],
+                     private_ips=[],
+                     driver=self,
+                     extra={'foo': 'bar'}),
                 Node(id=2,
-                    name='dummy-2',
-                    state=NodeState.RUNNING,
-                    public_ips=['127.0.0.1'],
-                    private_ips=[],
-                    driver=self,
-                    extra={'foo': 'bar'}),
+                     name='dummy-2',
+                     state=NodeState.RUNNING,
+                     public_ips=['127.0.0.1'],
+                     private_ips=[],
+                     driver=self,
+                     extra={'foo': 'bar'}),
             ]
         self.connection = DummyConnection(self.creds)
 
@@ -237,9 +237,9 @@ class DummyNodeDriver(NodeDriver):
             NodeSize(id=4,
                      name="XXL Big",
                      ram=4096 * 2,
-                     disk=32*4,
-                     bandwidth=2500*3,
-                     price=32*2,
+                     disk=32 * 4,
+                     bandwidth=2500 * 3,
+                     price=32 * 2,
                      driver=self),
         ]
 

Modified: libcloud/trunk/libcloud/compute/drivers/ec2.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/ec2.py?rev=1364039&r1=1364038&r2=1364039&view=diff
==============================================================================
--- libcloud/trunk/libcloud/compute/drivers/ec2.py (original)
+++ libcloud/trunk/libcloud/compute/drivers/ec2.py Sat Jul 21 04:24:25 2012
@@ -255,7 +255,8 @@ class EC2Connection(ConnectionUserAndKey
         string_to_sign = '\n'.join(('GET', hostname, path, qs))
 
         b64_hmac = base64.b64encode(
-            hmac.new(b(secret_key), b(string_to_sign), digestmod=sha256).digest()
+            hmac.new(b(secret_key), b(string_to_sign),
+                     digestmod=sha256).digest()
         )
         return b64_hmac.decode('utf-8')
 
@@ -341,10 +342,10 @@ class EC2NodeDriver(NodeDriver):
 
     def _to_node(self, element, groups=None):
         try:
-            state = self.NODE_STATE_MAP[
-                    findattr(element=element, xpath="instanceState/name",
-                             namespace=NAMESPACE)
-            ]
+            state = self.NODE_STATE_MAP[findattr(element=element,
+                                                 xpath="instanceState/name",
+                                                 namespace=NAMESPACE)
+                                        ]
         except KeyError:
             state = NodeState.UNKNOWN
 
@@ -353,16 +354,18 @@ class EC2NodeDriver(NodeDriver):
         tags = dict((findtext(element=item, xpath='key', namespace=NAMESPACE),
                      findtext(element=item, xpath='value',
                               namespace=NAMESPACE))
-        for item in findall(element=element, xpath='tagSet/item',
-                            namespace=NAMESPACE))
+                    for item in findall(element=element,
+                                        xpath='tagSet/item',
+                                        namespace=NAMESPACE)
+                    )
 
         name = tags.get('Name', instance_id)
 
         public_ip = findtext(element=element, xpath='ipAddress',
-                              namespace=NAMESPACE)
+                             namespace=NAMESPACE)
         public_ips = [public_ip] if public_ip else []
         private_ip = findtext(element=element, xpath='privateIpAddress',
-                                 namespace=NAMESPACE)
+                              namespace=NAMESPACE)
         private_ips = [private_ip] if private_ip else []
 
         n = Node(
@@ -390,10 +393,11 @@ class EC2NodeDriver(NodeDriver):
                 'launchindex': findattr(element=element,
                                         xpath="amiLaunchIndex",
                                         namespace=NAMESPACE),
-                'productcode':
-                    [p.text for p in findall(element=element,
-                                    xpath="productCodesSet/item/productCode",
-                                    namespace=NAMESPACE
+                'productcode': [
+                    p.text for p in findall(
+                        element=element,
+                        xpath="productCodesSet/item/productCode",
+                        namespace=NAMESPACE
                     )],
                 'instancetype': findattr(element=element, xpath="instanceType",
                                          namespace=NAMESPACE),
@@ -415,49 +419,46 @@ class EC2NodeDriver(NodeDriver):
         return n
 
     def _to_images(self, object):
-        return [self._to_image(el)
-                for el in object.findall(
-            fixxpath(xpath='imagesSet/item', namespace=NAMESPACE)
-        )]
+        return [self._to_image(el) for el in object.findall(
+            fixxpath(xpath='imagesSet/item', namespace=NAMESPACE))
+        ]
 
     def _to_image(self, element):
-        n = NodeImage(id=findtext(element=element, xpath='imageId',
+        n = NodeImage(
+            id=findtext(element=element, xpath='imageId', namespace=NAMESPACE),
+            name=findtext(element=element, xpath='imageLocation',
+                          namespace=NAMESPACE),
+            driver=self.connection.driver,
+            extra={
+                'state': findattr(element=element, xpath="imageState",
                                   namespace=NAMESPACE),
-                      name=findtext(element=element, xpath='imageLocation',
+                'ownerid': findattr(element=element, xpath="imageOwnerId",
                                     namespace=NAMESPACE),
-                      driver=self.connection.driver,
-                      extra={
-                          'state': findattr(element=element,
-                                            xpath="imageState",
-                                            namespace=NAMESPACE),
-                          'ownerid': findattr(element=element,
-                                        xpath="imageOwnerId",
-                                        namespace=NAMESPACE),
-                          'owneralias': findattr(element=element,
-                                        xpath="imageOwnerAlias",
-                                        namespace=NAMESPACE),
-                          'ispublic': findattr(element=element,
-                                        xpath="isPublic",
-                                        namespace=NAMESPACE),
-                          'architecture': findattr(element=element,
-                                        xpath="architecture",
-                                        namespace=NAMESPACE),
-                          'imagetype': findattr(element=element,
-                                        xpath="imageType",
-                                        namespace=NAMESPACE),
-                          'platform': findattr(element=element,
-                                        xpath="platform",
-                                        namespace=NAMESPACE),
-                          'rootdevicetype': findattr(element=element,
-                                        xpath="rootDeviceType",
-                                        namespace=NAMESPACE),
-                          'virtualizationtype': findattr(element=element,
-                                        xpath="virtualizationType",
-                                        namespace=NAMESPACE),
-                          'hypervisor': findattr(element=element,
-                                        xpath="hypervisor",
-                                        namespace=NAMESPACE)
-                      }
+                'owneralias': findattr(element=element,
+                                       xpath="imageOwnerAlias",
+                                       namespace=NAMESPACE),
+                'ispublic': findattr(element=element,
+                                     xpath="isPublic",
+                                     namespace=NAMESPACE),
+                'architecture': findattr(element=element,
+                                         xpath="architecture",
+                                         namespace=NAMESPACE),
+                'imagetype': findattr(element=element,
+                                      xpath="imageType",
+                                      namespace=NAMESPACE),
+                'platform': findattr(element=element,
+                                     xpath="platform",
+                                     namespace=NAMESPACE),
+                'rootdevicetype': findattr(element=element,
+                                           xpath="rootDeviceType",
+                                           namespace=NAMESPACE),
+                'virtualizationtype': findattr(
+                    element=element, xpath="virtualizationType",
+                    namespace=NAMESPACE),
+                'hypervisor': findattr(element=element,
+                                       xpath="hypervisor",
+                                       namespace=NAMESPACE)
+            }
         )
         return n
 
@@ -466,19 +467,23 @@ class EC2NodeDriver(NodeDriver):
                          namespace=NAMESPACE)
         size = findtext(element=element, xpath='size', namespace=NAMESPACE)
 
-        return StorageVolume(
-                        id=volId,
-                        name=name,
-                        size=int(size),
-                        driver=self)
+        return StorageVolume(id=volId,
+                             name=name,
+                             size=int(size),
+                             driver=self)
 
     def list_nodes(self, ex_node_ids=None):
         """
-        @type node.id: C{list}
-        @param ex_node_ids: List of C{node.id}
-        This parameter is used to filter the list of
+        List all nodes
+
+        Ex_node_ids parameter is used to filter the list of
         nodes that should be returned. Only the nodes
         with the corresponding node ids will be returned.
+
+        @param      ex_node_ids: List of C{node.id}
+        @type       ex_node_ids: C{list} of C{str}
+
+        @rtype: C{list} of L{Node}
         """
         params = {'Action': 'DescribeInstances'}
         if ex_node_ids:
@@ -502,11 +507,11 @@ class EC2NodeDriver(NodeDriver):
     def list_sizes(self, location=None):
         # Cluster instances are not available in all the regions
         if self.region_name == 'us-east-1':
-          ignored_size_ids = None
+            ignored_size_ids = None
         elif self.region_name == 'eu-west-1':
-          ignored_size_ids = CLUSTER_INSTANCES_IDS[:-1]
+            ignored_size_ids = CLUSTER_INSTANCES_IDS[:-1]
         else:
-          ignored_size_ids = CLUSTER_INSTANCES_IDS
+            ignored_size_ids = CLUSTER_INSTANCES_IDS
 
         sizes = self._get_sizes(ignored_size_ids=ignored_size_ids)
         return sizes
@@ -531,50 +536,49 @@ class EC2NodeDriver(NodeDriver):
 
     def list_locations(self):
         locations = []
-        for index, availability_zone in \
-            enumerate(self.ex_list_availability_zones()):
-            locations.append(EC2NodeLocation(index,
-                                             self.friendly_name,
-                                             self.country,
-                                             self,
-                                             availability_zone))
+        for index, availability_zone in\
+                enumerate(self.ex_list_availability_zones()):
+                    locations.append(EC2NodeLocation(
+                        index, self.friendly_name, self.country, self,
+                        availability_zone)
+                    )
         return locations
 
     def create_volume(self, size, name, location=None, snapshot=None):
         params = {
-                'Action': 'CreateVolume',
-                'Size': str(size) }
+            'Action': 'CreateVolume',
+            'Size': str(size)}
 
         if location is not None:
             params['AvailabilityZone'] = location.availability_zone.name
 
         volume = self._to_volume(
-                   self.connection.request(self.path, params=params).object,
-                   name=name)
+            self.connection.request(self.path, params=params).object,
+            name=name)
         self.ex_create_tags(volume, {'Name': name})
         return volume
 
     def destroy_volume(self, volume):
         params = {
-                'Action': 'DeleteVolume',
-                'VolumeId': volume.id }
+            'Action': 'DeleteVolume',
+            'VolumeId': volume.id}
         response = self.connection.request(self.path, params=params).object
         return self._get_boolean(response)
 
     def attach_volume(self, node, volume, device):
         params = {
-                'Action': 'AttachVolume',
-                'VolumeId': volume.id,
-                'InstanceId': node.id,
-                'Device': device }
+            'Action': 'AttachVolume',
+            'VolumeId': volume.id,
+            'InstanceId': node.id,
+            'Device': device}
 
         self.connection.request(self.path, params=params)
         return True
 
     def detach_volume(self, volume):
         params = {
-                'Action': 'DetachVolume',
-                'VolumeId': volume.id }
+            'Action': 'DetachVolume',
+            'VolumeId': volume.id}
 
         self.connection.request(self.path, params=params)
         return True
@@ -582,18 +586,18 @@ class EC2NodeDriver(NodeDriver):
     def ex_create_keypair(self, name):
         """Creates a new keypair
 
-        @note: This is a non-standard extension API, and
-               only works for EC2.
+        @note: This is a non-standard extension API, and only works for EC2.
 
-        @type name: C{str}
-        @param name: The name of the keypair to Create. This must be
-                     unique, otherwise an InvalidKeyPair.Duplicate
-                     exception is raised.
+        @param      name: The name of the keypair to Create. This must be
+            unique, otherwise an InvalidKeyPair.Duplicate exception is raised.
+        @type       name: C{str}
+
+        @rtype: C{dict}
         """
         params = {
             'Action': 'CreateKeyPair',
             'KeyName': name,
-            }
+        }
         response = self.connection.request(self.path, params=params).object
         key_material = findtext(element=response, xpath='keyMaterial',
                                 namespace=NAMESPACE)
@@ -602,29 +606,32 @@ class EC2NodeDriver(NodeDriver):
         return {
             'keyMaterial': key_material,
             'keyFingerprint': key_fingerprint,
-            }
+        }
 
     def ex_import_keypair(self, name, keyfile):
-        """imports a new public key
+        """
+        imports a new public key
 
         @note: This is a non-standard extension API, and only works for EC2.
 
-        @type name: C{str}
-        @param name: The name of the public key to import. This must be unique,
-                     otherwise an InvalidKeyPair.Duplicate exception is raised.
+        @param      name: The name of the public key to import. This must be
+         unique, otherwise an InvalidKeyPair.Duplicate exception is raised.
+        @type       name: C{str}
 
-        @type keyfile: C{str}
-        @param keyfile: The filename with path of the public key to import.
+        @param     keyfile: The filename with path of the public key to import.
+        @type      keyfile: C{str}
 
+        @rtype: C{dict}
         """
         with open(os.path.expanduser(keyfile)) as fh:
             content = fh.read()
 
         base64key = base64.b64encode(content)
 
-        params = {'Action': 'ImportKeyPair',
-                  'KeyName': name,
-                  'PublicKeyMaterial': base64key
+        params = {
+            'Action': 'ImportKeyPair',
+            'KeyName': name,
+            'PublicKeyMaterial': base64key
         }
 
         response = self.connection.request(self.path, params=params).object
@@ -635,20 +642,23 @@ class EC2NodeDriver(NodeDriver):
         return {
             'keyName': key_name,
             'keyFingerprint': key_fingerprint,
-            }
+        }
 
     def ex_describe_keypairs(self, name):
         """Describes a keypair by name
 
         @note: This is a non-standard extension API, and only works for EC2.
 
-        @type name: C{str}
-        @param name: The name of the keypair to describe.
+        @param      name: The name of the keypair to describe.
+        @type       name: C{str}
+
+        @rtype: C{dict}
 
         """
 
-        params = {'Action': 'DescribeKeyPairs',
-                  'KeyName.1': name
+        params = {
+            'Action': 'DescribeKeyPairs',
+            'KeyName.1': name
         }
 
         response = self.connection.request(self.path, params=params).object
@@ -663,12 +673,15 @@ class EC2NodeDriver(NodeDriver):
 
         @note: This is a non-standard extension API, and only works for EC2.
 
-        @type name: C{str}
-        @param name: The name of the security group to Create.
+        @param      name: The name of the security group to Create.
                      This must be unique.
+        @type       name: C{str}
+
+        @param      description: Human readable description of a Security
+        Group.
+        @type       description: C{str}
 
-        @type description: C{str}
-        @param description: Human readable description of a Security Group.
+        @rtype: C{str}
         """
         params = {'Action': 'CreateSecurityGroup',
                   'GroupName': name,
@@ -676,12 +689,15 @@ class EC2NodeDriver(NodeDriver):
         return self.connection.request(self.path, params=params).object
 
     def ex_authorize_security_group_permissive(self, name):
-        """Edit a Security Group to allow all traffic.
+        """
+        Edit a Security Group to allow all traffic.
 
         @note: This is a non-standard extension API, and only works for EC2.
 
-        @type name: C{str}
-        @param name: The name of the security group to edit
+        @param      name: The name of the security group to edit
+        @type       name: C{str}
+
+        @rtype: C{list} of C{str}
         """
 
         results = []
@@ -733,7 +749,9 @@ class EC2NodeDriver(NodeDriver):
 
         @keyword  only_available: If true, return only availability zones
                                   with state 'available'
-        @type     only_available: C{string}
+        @type     only_available: C{str}
+
+        @rtype: C{list} of L{ExEC2AvailabilityZone}
         """
         params = {'Action': 'DescribeAvailabilityZones'}
 
@@ -771,10 +789,11 @@ class EC2NodeDriver(NodeDriver):
         """
         Return a dictionary of tags for a resource (Node or StorageVolume).
 
-        @type node: C{Node}
-        @param node: Node instance
+        @param  resource: resource which should be used
+        @type   resource: L{Node} or L{StorageVolume}
 
-        @return dict Node tags
+        @return: dict Node tags
+        @rtype: C{dict}
         """
         params = {'Action': 'DescribeTags',
                   'Filter.0.Name': 'resource-id',
@@ -800,10 +819,14 @@ class EC2NodeDriver(NodeDriver):
         """
         Create tags for a resource (Node or StorageVolume).
 
-        @type resource: EC2 resource
         @param resource: Resource to be tagged
+        @type resource: L{Node} or L{StorageVolume}
+
         @param tags: A dictionary or other mapping of strings to strings,
                      associating tag names with tag values.
+        @type tags: C{dict}
+
+        @rtype: C{bool}
         """
         if not tags:
             return
@@ -814,17 +837,24 @@ class EC2NodeDriver(NodeDriver):
             params['Tag.%d.Key' % i] = key
             params['Tag.%d.Value' % i] = tags[key]
 
-        self.connection.request(self.path,
-                                params=params.copy()).object
+        result = self.connection.request(self.path,
+                                         params=params.copy()).object
+        element = findtext(element=result, xpath='return',
+                           namespace=NAMESPACE)
+        return element == 'true'
 
     def ex_delete_tags(self, resource, tags):
         """
         Delete tags from a resource.
 
-        @type resource: EC2 resource
         @param resource: Resource to be tagged
+        @type resource: L{Node} or L{StorageVolume}
+
         @param tags: A dictionary or other mapping of strings to strings,
                      specifying the tag names and tag values to be deleted.
+        @type tags: C{dict}
+
+        @rtype: C{bool}
         """
         if not tags:
             return
@@ -835,8 +865,11 @@ class EC2NodeDriver(NodeDriver):
             params['Tag.%d.Key' % i] = key
             params['Tag.%d.Value' % i] = tags[key]
 
-        self.connection.request(self.path,
-                                params=params.copy()).object
+        result = self.connection.request(self.path,
+                                         params=params.copy()).object
+        element = findtext(element=result, xpath='return',
+                           namespace=NAMESPACE)
+        return element == 'true'
 
     def _add_instance_filter(self, params, node):
         """
@@ -852,11 +885,12 @@ class EC2NodeDriver(NodeDriver):
         Return all the Elastic IP addresses for this account
         optionally, return only the allocated addresses
 
-        @keyword  only_allocated: If true, return only those addresses
+        @param    only_allocated: If true, return only those addresses
                                   that are associated with an instance
-        @type     only_allocated: C{string}
+        @type     only_allocated: C{str}
 
-        @return   list list of elastic ips for this particular account.
+        @return:   list list of elastic ips for this particular account.
+        @rtype: C{list} of C{str}
         """
         params = {'Action': 'DescribeAddresses'}
 
@@ -885,9 +919,13 @@ class EC2NodeDriver(NodeDriver):
         """
         Associate an IP address with a particular node.
 
-        @type node: C{Node}
-        @param node: Node instance
+        @param      node: Node instance
+        @type       node: L{Node}
+
+        @param      elastic_ip_address: IP address which should be used
+        @type       elastic_ip_address: C{str}
 
+        @rtype: C{bool}
         """
         params = {'Action': 'AssociateAddress'}
 
@@ -900,12 +938,12 @@ class EC2NodeDriver(NodeDriver):
         """
         Return Elastic IP addresses for all the nodes in the provided list.
 
-        @type nodes: C{list}
-        @param nodes: List of C{Node} instances
+        @param      nodes: List of C{Node} instances
+        @type       nodes: C{list} of L{Node}
 
-        @return dict Dictionary where a key is a node ID and the value is a
-                     list with the Elastic IP addresses associated with
-                     this node.
+        @return: Dictionary where a key is a node ID and the value is a
+            list with the Elastic IP addresses associated with this node.
+        @rtype: C{dict}
         """
         if not nodes:
             return {}
@@ -940,10 +978,11 @@ class EC2NodeDriver(NodeDriver):
         """
         Return a list of Elastic IP addresses associated with this node.
 
-        @type node: C{Node}
-        @param node: Node instance
+        @param      node: Node instance
+        @type       node: L{Node}
 
-        @return list Elastic IP addresses attached to this node.
+        @return: list Elastic IP addresses attached to this node.
+        @rtype: C{list} of C{str}
         """
         node_elastic_ips = self.ex_describe_addresses([node])
         return node_elastic_ips[node.id]
@@ -953,13 +992,14 @@ class EC2NodeDriver(NodeDriver):
         Modify node attributes.
         A list of valid attributes can be found at http://goo.gl/gxcj8
 
-        @type node: C{Node}
-        @param node: Node instance
+        @param      node: Node instance
+        @type       node: L{Node}
 
-        @type attributes: C{dict}
-        @param attributes: Dictionary with node attributes
+        @param      attributes: Dictionary with node attributes
+        @type       attributes: C{dict}
 
-        @return bool True on success, False otherwise.
+        @return: True on success, False otherwise.
+        @rtype: C{bool}
         """
         attributes = attributes or {}
         attributes.update({'InstanceId': node.id})
@@ -978,13 +1018,14 @@ class EC2NodeDriver(NodeDriver):
         Change the node size.
         Note: Node must be turned of before changing the size.
 
-        @type node: C{Node}
-        @param node: Node instance
+        @param      node: Node instance
+        @type       node: L{Node}
 
-        @type new_size: C{NodeSize}
-        @param new_size: NodeSize intance
+        @param      new_size: NodeSize intance
+        @type       new_size: L{NodeSize}
 
-        @return bool True on success, False otherwise.
+        @return: True on success, False otherwise.
+        @rtype: C{bool}
         """
         if 'instancetype' in node.extra:
             current_instance_type = node.extra['instancetype']
@@ -999,9 +1040,10 @@ class EC2NodeDriver(NodeDriver):
     def create_node(self, **kwargs):
         """Create a new EC2 node
 
-        See L{NodeDriver.create_node} for more keyword args.
         Reference: http://bit.ly/8ZyPSy [docs.amazonwebservices.com]
 
+        @inherits: L{NodeDriver.create_node}
+
         @keyword    ex_mincount: Minimum number of instances to launch
         @type       ex_mincount: C{int}
 
@@ -1034,8 +1076,8 @@ class EC2NodeDriver(NodeDriver):
             if not isinstance(kwargs['ex_securitygroup'], list):
                 kwargs['ex_securitygroup'] = [kwargs['ex_securitygroup']]
             for sig in range(len(kwargs['ex_securitygroup'])):
-                params['SecurityGroup.%d' % (sig + 1,)] = \
-                            kwargs['ex_securitygroup'][sig]
+                params['SecurityGroup.%d' % (sig + 1,)] =\
+                    kwargs['ex_securitygroup'][sig]
 
         if 'location' in kwargs:
             availability_zone = getattr(kwargs['location'],
@@ -1043,15 +1085,15 @@ class EC2NodeDriver(NodeDriver):
             if availability_zone:
                 if availability_zone.region_name != self.region_name:
                     raise AttributeError('Invalid availability zone: %s'
-                    % (availability_zone.name))
+                                         % (availability_zone.name))
                 params['Placement.AvailabilityZone'] = availability_zone.name
 
         if 'ex_keyname' in kwargs:
             params['KeyName'] = kwargs['ex_keyname']
 
         if 'ex_userdata' in kwargs:
-            params['UserData'] = base64.b64encode(b(kwargs['ex_userdata'])) \
-                                       .decode('utf-8')
+            params['UserData'] = base64.b64encode(b(kwargs['ex_userdata']))\
+                .decode('utf-8')
 
         if 'ex_clienttoken' in kwargs:
             params['ClientToken'] = kwargs['ex_clienttoken']
@@ -1076,9 +1118,6 @@ class EC2NodeDriver(NodeDriver):
             return nodes
 
     def reboot_node(self, node):
-        """
-        Reboot the node by passing in the node object
-        """
         params = {'Action': 'RebootInstances'}
         params.update(self._pathlist('InstanceId', [node.id]))
         res = self.connection.request(self.path, params=params).object
@@ -1088,6 +1127,11 @@ class EC2NodeDriver(NodeDriver):
         """
         Start the node by passing in the node object, does not work with
         instance store backed instances
+
+        @param      node: Node which should be used
+        @type       node: L{Node}
+
+        @rtype: C{bool}
         """
         params = {'Action': 'StartInstances'}
         params.update(self._pathlist('InstanceId', [node.id]))
@@ -1098,6 +1142,11 @@ class EC2NodeDriver(NodeDriver):
         """
         Stop the node by passing in the node object, does not work with
         instance store backed instances
+
+        @param      node: Node which should be used
+        @type       node: L{Node}
+
+        @rtype: C{bool}
         """
         params = {'Action': 'StopInstances'}
         params.update(self._pathlist('InstanceId', [node.id]))
@@ -1105,9 +1154,6 @@ class EC2NodeDriver(NodeDriver):
         return self._get_state_boolean(res)
 
     def destroy_node(self, node):
-        """
-        Destroy node by passing in the node object
-        """
         params = {'Action': 'TerminateInstances'}
         params.update(self._pathlist('InstanceId', [node.id]))
         res = self.connection.request(self.path, params=params).object
@@ -1284,7 +1330,7 @@ class EucNodeDriver(EC2NodeDriver):
 
     def list_locations(self):
         raise NotImplementedError(
-                'list_locations not implemented for this driver')
+            'list_locations not implemented for this driver')
 
     def _add_instance_filter(self, params, node):
         """
@@ -1302,22 +1348,22 @@ NIMBUS_INSTANCE_TYPES = {
         'ram': None,
         'disk': None,
         'bandwidth': None,
-        },
+    },
     'm1.large': {
         'id': 'm1.large',
         'name': 'Large Instance',
         'ram': None,
         'disk': None,
         'bandwidth': None,
-        },
+    },
     'm1.xlarge': {
         'id': 'm1.xlarge',
         'name': 'Extra Large Instance',
         'ram': None,
         'disk': None,
         'bandwidth': None,
-        },
-    }
+    },
+}
 
 
 class NimbusConnection(EC2Connection):
@@ -1344,6 +1390,8 @@ class NimbusNodeDriver(EC2NodeDriver):
     def ex_describe_addresses(self, nodes):
         """
         Nimbus doesn't support elastic IPs, so this is a passthrough
+
+        @inherits: L{EC2NodeDriver.ex_describe_addresses}
         """
         nodes_elastic_ip_mappings = {}
         for node in nodes:
@@ -1354,5 +1402,7 @@ class NimbusNodeDriver(EC2NodeDriver):
     def ex_create_tags(self, resource, tags):
         """
         Nimbus doesn't support creating tags, so this is a passthrough
+
+        @inherits: L{EC2NodeDriver.ex_create_tags}
         """
         pass