libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1439028 - in /libcloud/branches/0.12.x: ./ libcloud/compute/ libcloud/compute/drivers/ libcloud/storage/ libcloud/storage/drivers/ libcloud/test/compute/ libcloud/test/compute/fixtures/openstack/ libcloud/test/storage/
Date Sun, 27 Jan 2013 05:57:52 GMT
Author: tomaz
Date: Sun Jan 27 05:57:51 2013
New Revision: 1439028

URL: http://svn.apache.org/viewvc?rev=1439028&view=rev
Log:
Remove "datacenter" related changes and improvements in the compute and storage
drivers. Some of those changes are backward incompatible and are still work in
progress. They will be included in the next major release.

Added:
    libcloud/branches/0.12.x/libcloud/compute/drivers/rackspacenova.py
    libcloud/branches/0.12.x/libcloud/test/compute/test_rackspacenova.py
Modified:
    libcloud/branches/0.12.x/CHANGES
    libcloud/branches/0.12.x/libcloud/compute/drivers/ec2.py
    libcloud/branches/0.12.x/libcloud/compute/drivers/rackspace.py
    libcloud/branches/0.12.x/libcloud/compute/providers.py
    libcloud/branches/0.12.x/libcloud/compute/types.py
    libcloud/branches/0.12.x/libcloud/storage/drivers/cloudfiles.py
    libcloud/branches/0.12.x/libcloud/storage/providers.py
    libcloud/branches/0.12.x/libcloud/storage/types.py
    libcloud/branches/0.12.x/libcloud/test/compute/fixtures/openstack/_v1_1__auth.json
    libcloud/branches/0.12.x/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json
    libcloud/branches/0.12.x/libcloud/test/compute/test_deployment.py
    libcloud/branches/0.12.x/libcloud/test/compute/test_ec2.py
    libcloud/branches/0.12.x/libcloud/test/compute/test_rackspace.py
    libcloud/branches/0.12.x/libcloud/test/storage/test_cloudfiles.py

Modified: libcloud/branches/0.12.x/CHANGES
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/CHANGES?rev=1439028&r1=1439027&r2=1439028&view=diff
==============================================================================
--- libcloud/branches/0.12.x/CHANGES (original)
+++ libcloud/branches/0.12.x/CHANGES Sun Jan 27 05:57:51 2013
@@ -33,16 +33,6 @@ Changes with Apache Libcloud 0.12.0:
       (LIBCLOUD-245)
       [Tomaz Muraus]
 
-    - Refactor Rackspace driver classes and make them easier to use. Now there
-      are two rackspace constants - Provider.RACKSPACE which represents new
-      next-gen OpenStack servers and Provider.RACKSPACE_FIRST_GEN which
-      represents old cloud servers.
-
-      Note: This change is backward incompatible. For more information on those
-      changes and how to upgrade your code to make it work with it, please visit
-      TODO.
-      [Tomaz Muraus]
-
     - Improvements and additions in vCloud driver:
       - Expose generic query method (ex_query)
       - Provide functionality to get and set control access for vApps. This way
@@ -127,15 +117,6 @@ Changes with Apache Libcloud 0.12.0:
       (LIBCLOUD-267)
       [Tomaz Muraus]
 
-    - Deprecate CLOUDFILES_US and CLOUDFILES_UK storage provider constants and
-      add a new CLOUDFILES constant.
-      Driver referenced by this constant takes a "datacenter" keyword argument
-      and can be one of 'ord', 'dfw' or 'lon'.
-
-      Note: Deprecated constants will continue to work for the foreseeable
-      future.
-      [Tomaz Muraus]
-
     - Support for multipart uploads and other improvemetns in the S3 driver
       so it can more easily be re-used with other implementations (e.g. Google
       Storage, etc.).

Modified: libcloud/branches/0.12.x/libcloud/compute/drivers/ec2.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/compute/drivers/ec2.py?rev=1439028&r1=1439027&r2=1439028&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/compute/drivers/ec2.py (original)
+++ libcloud/branches/0.12.x/libcloud/compute/drivers/ec2.py Sun Jan 27 05:57:51 2013
@@ -1412,53 +1412,149 @@ class IdempotentParamError(LibcloudError
         return repr(self.value)
 
 
+class EC2EUConnection(EC2Connection):
+    """
+    Connection class for EC2 in the Western Europe Region
+    """
+    host = REGION_DETAILS['eu-west-1']['endpoint']
+
+
 class EC2EUNodeDriver(EC2NodeDriver):
     """
     Driver class for EC2 in the Western Europe Region.
     """
-    _datacenter = 'eu-west-1'
+    api_name = 'ec2_eu_west'
+    name = 'Amazon EC2 (eu-west-1)'
+    friendly_name = 'Amazon Europe Ireland'
+    country = 'IE'
+    region_name = 'eu-west-1'
+    connectionCls = EC2EUConnection
+
+
+class EC2USWestConnection(EC2Connection):
+    """
+    Connection class for EC2 in the Western US Region
+    """
+
+    host = REGION_DETAILS['us-west-1']['endpoint']
 
 
 class EC2USWestNodeDriver(EC2NodeDriver):
     """
     Driver class for EC2 in the Western US Region
     """
-    _datacenter = 'us-west-1'
+
+    api_name = 'ec2_us_west'
+    name = 'Amazon EC2 (us-west-1)'
+    friendly_name = 'Amazon US N. California'
+    country = 'US'
+    region_name = 'us-west-1'
+    connectionCls = EC2USWestConnection
+
+
+class EC2USWestOregonConnection(EC2Connection):
+    """
+    Connection class for EC2 in the Western US Region (Oregon).
+    """
+
+    host = REGION_DETAILS['us-west-2']['endpoint']
 
 
 class EC2USWestOregonNodeDriver(EC2NodeDriver):
     """
     Driver class for EC2 in the US West Oregon region.
     """
-    _datacenter = 'us-west-2'
+
+    api_name = 'ec2_us_west_oregon'
+    name = 'Amazon EC2 (us-west-2)'
+    friendly_name = 'Amazon US West - Oregon'
+    country = 'US'
+    region_name = 'us-west-2'
+    connectionCls = EC2USWestOregonConnection
+
+
+class EC2APSEConnection(EC2Connection):
+    """
+    Connection class for EC2 in the Southeast Asia Pacific Region.
+    """
+
+    host = REGION_DETAILS['ap-southeast-1']['endpoint']
+
+
+class EC2APNEConnection(EC2Connection):
+    """
+    Connection class for EC2 in the Northeast Asia Pacific Region.
+    """
+
+    host = REGION_DETAILS['ap-northeast-1']['endpoint']
 
 
 class EC2APSENodeDriver(EC2NodeDriver):
     """
     Driver class for EC2 in the Southeast Asia Pacific Region.
     """
-    _datacenter = 'ap-southeast-1'
+
+    api_name = 'ec2_ap_southeast'
+    name = 'Amazon EC2 (ap-southeast-1)'
+    friendly_name = 'Amazon Asia-Pacific Singapore'
+    country = 'SG'
+    region_name = 'ap-southeast-1'
+    connectionCls = EC2APSEConnection
 
 
 class EC2APNENodeDriver(EC2NodeDriver):
     """
     Driver class for EC2 in the Northeast Asia Pacific Region.
     """
-    _datacenter = 'ap-northeast-1'
+
+    api_name = 'ec2_ap_northeast'
+    name = 'Amazon EC2 (ap-northeast-1)'
+    friendly_name = 'Amazon Asia-Pacific Tokyo'
+    country = 'JP'
+    region_name = 'ap-northeast-1'
+    connectionCls = EC2APNEConnection
+
+
+class EC2SAEastConnection(EC2Connection):
+    """
+    Connection class for EC2 in the South America (Sao Paulo) Region.
+    """
+
+    host = REGION_DETAILS['sa-east-1']['endpoint']
 
 
 class EC2SAEastNodeDriver(EC2NodeDriver):
     """
     Driver class for EC2 in the South America (Sao Paulo) Region.
     """
-    _datacenter = 'sa-east-1'
+
+    api_name = 'ec2_sa_east'
+    name = 'Amazon EC2 (sa-east-1)'
+    friendly_name = 'Amazon South America Sao Paulo'
+    country = 'BR'
+    region_name = 'sa-east-1'
+    connectionCls = EC2SAEastConnection
+
+
+class EC2APSESydneyConnection(EC2Connection):
+    """
+    Connection class for EC2 in the Southeast Asia Pacific (Sydney) Region.
+    """
+
+    host = REGION_DETAILS['ap-southeast-2']['endpoint']
 
 
 class EC2APSESydneyNodeDriver(EC2NodeDriver):
     """
     Driver class for EC2 in the Southeast Asia Pacific (Sydney) Region.
     """
-    _datacenter = 'ap-southeast-2'
+
+    api_name = 'ec2_ap_southeast_2'
+    name = 'Amazon EC2 (ap-southeast-2)'
+    friendly_name = 'Amazon Asia-Pacific Sydney'
+    country = 'AU'
+    region_name = 'ap-southeast-2'
+    connectionCls = EC2APSESydneyConnection
 
 
 class EucConnection(EC2Connection):

Modified: libcloud/branches/0.12.x/libcloud/compute/drivers/rackspace.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/compute/drivers/rackspace.py?rev=1439028&r1=1439027&r2=1439028&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/compute/drivers/rackspace.py (original)
+++ libcloud/branches/0.12.x/libcloud/compute/drivers/rackspace.py Sun Jan 27 05:57:51 2013
@@ -19,35 +19,22 @@ from libcloud.compute.types import Provi
 from libcloud.compute.base import NodeLocation
 from libcloud.compute.drivers.openstack import OpenStack_1_0_Connection,\
     OpenStack_1_0_NodeDriver, OpenStack_1_0_Response
-from libcloud.compute.drivers.openstack import OpenStack_1_1_Connection,\
-    OpenStack_1_1_NodeDriver
 
 from libcloud.common.rackspace import (
     AUTH_URL_US, AUTH_URL_UK)
 
 
-ENDPOINT_ARGS_MAP = {
-    'dfw': {'service_type': 'compute',
-            'name': 'cloudServersOpenStack',
-            'region': 'DFW'},
-    'ord': {'service_type': 'compute',
-            'name': 'cloudServersOpenStack',
-            'region': 'ORD'},
-    'lon': {'service_type': 'compute',
-            'name': 'cloudServersOpenStack',
-            'region': 'LON'}
-}
-
-
-class RackspaceFirstGenConnection(OpenStack_1_0_Connection):
+class RackspaceConnection(OpenStack_1_0_Connection):
     """
-    Connection class for the Rackspace first-gen driver.
+    Connection class for the Rackspace driver
     """
+
     responseCls = OpenStack_1_0_Response
     auth_url = AUTH_URL_US
     XML_NAMESPACE = 'http://docs.rackspacecloud.com/servers/api/v1.0'
 
     def get_endpoint(self):
+
         ep = {}
         if '2.0' in self._auth_version:
             ep = self.service_catalog.get_endpoint(service_type='compute',
@@ -61,112 +48,37 @@ class RackspaceFirstGenConnection(OpenSt
         raise LibcloudError('Could not find specified endpoint')
 
 
-class RackspaceFirstGenNodeDriver(OpenStack_1_0_NodeDriver):
-    name = 'Rackspace Cloud'
-    website = 'http://www.rackspace.com'
-    connectionCls = RackspaceFirstGenConnection
-    type = Provider.RACKSPACE_FIRST_GEN
+class RackspaceNodeDriver(OpenStack_1_0_NodeDriver):
+    name = 'Rackspace'
+    website = 'http://www.rackspace.com/'
+    connectionCls = RackspaceConnection
+    type = Provider.RACKSPACE
     api_name = 'rackspace'
 
-    def __init__(self, key, secret=None, secure=True, host=None, port=None,
-                 region='us', **kwargs):
-        """
-        @inherits:  L{NodeDriver.__init__}
-
-        @param region: Region ID which should be used
-        @type region: C{str}
-        """
-        if region not in ['us', 'uk']:
-            raise ValueError('Invalid region: %s' % (region))
-
-        if region == 'us':
-            self.connectionCls.auth_url = AUTH_URL_US
-        elif region == 'uk':
-            self.connectionCls.auth_url = AUTH_URL_UK
-
-        self.region = region
-
-        super(RackspaceFirstGenNodeDriver, self).__init__(key=key,
-                                                          secret=secret,
-                                                          secure=secure,
-                                                          host=host,
-                                                          port=port, **kwargs)
-
     def list_locations(self):
-        """
-        Lists available locations
+        """Lists available locations
 
         Locations cannot be set or retrieved via the API, but currently
         there are two locations, DFW and ORD.
 
         @inherits: L{OpenStack_1_0_NodeDriver.list_locations}
         """
-        if self.region == 'us':
-            locations = [NodeLocation(0, "Rackspace DFW1/ORD1", 'US', self)]
-        elif self.region == 'uk':
-            locations = [NodeLocation(0, 'Rackspace UK London', 'UK', self)]
-
-        return locations
+        return [NodeLocation(0, "Rackspace DFW1/ORD1", 'US', self)]
 
 
-class RackspaceConnection(OpenStack_1_1_Connection):
+class RackspaceUKConnection(RackspaceConnection):
     """
-    Connection class for the Rackspace next-gen OpenStack base driver.
+    Connection class for the Rackspace UK driver
     """
-    get_endpoint_args = {}
-
-    def get_endpoint(self):
-        if not self.get_endpoint_args:
-            raise LibcloudError(
-                'RackspaceConnection must have get_endpoint_args set')
-
-        # Only support auth 2.0_*
-        if '2.0' in self._auth_version:
-            ep = self.service_catalog.get_endpoint(**self.get_endpoint_args)
-        else:
-            raise LibcloudError(
-                'Auth version "%s" not supported' % (self._auth_version))
-
-        # It's possible to authenticate but the service catalog not have
-        # the correct endpoint for this driver, so we throw here.
-        if 'publicURL' in ep:
-            return ep['publicURL']
-        else:
-            raise LibcloudError('Could not find specified endpoint')
-
+    auth_url = AUTH_URL_UK
 
-class RackspaceNodeDriver(OpenStack_1_1_NodeDriver):
-    name = 'Rackspace Cloud'
-    website = 'http://www.rackspace.com'
-    connectionCls = RackspaceConnection
-    type = Provider.RACKSPACE
-    api_name = None
-
-    def __init__(self, key, secret=None, secure=True, host=None, port=None,
-                 datacenter='dfw', **kwargs):
-        """
-        @inherits:  L{NodeDriver.__init__}
 
-        @param datacenter: Datacenter ID which should be used
-        @type datacenter: C{str}
-        """
+class RackspaceUKNodeDriver(RackspaceNodeDriver):
+    """Driver for Rackspace in the UK (London)
+    """
 
-        if datacenter not in ['dfw', 'ord', 'lon']:
-            raise ValueError('Invalid datacenter: %s' % (datacenter))
+    name = 'Rackspace (UK)'
+    connectionCls = RackspaceUKConnection
 
-        if datacenter in ['dfw', 'ord']:
-            self.connectionCls.auth_url = AUTH_URL_US
-            self.api_name = 'rackspacenovaus'
-        elif datacenter == 'lon':
-            self.connectionCls.auth_url = AUTH_URL_UK
-            self.api_name = 'rackspacenovalon'
-
-        self.connectionCls._auth_version = '2.0'
-        self.connectionCls.get_endpoint_args = \
-            ENDPOINT_ARGS_MAP[datacenter]
-
-        self.datacenter = datacenter
-
-        super(RackspaceNodeDriver, self).__init__(key=key, secret=secret,
-                                                  secure=secure, host=host,
-                                                  port=port, **kwargs)
+    def list_locations(self):
+        return [NodeLocation(0, 'Rackspace UK London', 'UK', self)]

Added: libcloud/branches/0.12.x/libcloud/compute/drivers/rackspacenova.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/compute/drivers/rackspacenova.py?rev=1439028&view=auto
==============================================================================
--- libcloud/branches/0.12.x/libcloud/compute/drivers/rackspacenova.py (added)
+++ libcloud/branches/0.12.x/libcloud/compute/drivers/rackspacenova.py Sun Jan 27 05:57:51 2013
@@ -0,0 +1,104 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+"""
+Rackspace driver
+"""
+from libcloud.compute.providers import Provider
+from libcloud.compute.drivers.openstack import OpenStack_1_1_Connection,\
+    OpenStack_1_1_NodeDriver
+from libcloud.common.types import LibcloudError
+
+
+class RackspaceNovaConnection(OpenStack_1_1_Connection):
+    get_endpoint_args = {}
+
+    def get_endpoint(self):
+        if not self.get_endpoint_args:
+            raise LibcloudError(
+                'RackspaceNovaConnection must have get_endpoint_args set')
+
+        # Only support auth 2.0_*
+        if '2.0' in self._auth_version:
+            ep = self.service_catalog.get_endpoint(**self.get_endpoint_args)
+        else:
+            raise LibcloudError(
+                'Auth version "%s" not supported' % (self._auth_version))
+
+        # It's possible to authenticate but the service catalog not have
+        # the correct endpoint for this driver, so we throw here.
+        if 'publicURL' in ep:
+            return ep['publicURL']
+        else:
+            raise LibcloudError('Could not find specified endpoint')
+
+
+class RackspaceNovaBetaConnection(RackspaceNovaConnection):
+
+    get_endpoint_args = {'service_type': 'compute',
+                         'name': 'cloudServersPreprod',
+                         'region': 'DFW'}
+
+
+class RackspaceNovaDfwConnection(RackspaceNovaConnection):
+
+    get_endpoint_args = {'service_type': 'compute',
+                         'name': 'cloudServersOpenStack',
+                         'region': 'DFW'}
+
+
+class RackspaceNovaLonConnection(RackspaceNovaConnection):
+
+    get_endpoint_args = {'service_type': 'compute',
+                         'name': 'cloudServersOpenStack',
+                         'region': 'LON'}
+
+
+class RackspaceNovaDfwNodeDriver(OpenStack_1_1_NodeDriver):
+    name = 'RackspaceNovadfw'
+    website = 'http://www.rackspace.com/'
+    connectionCls = RackspaceNovaDfwConnection
+    type = Provider.RACKSPACE_NOVA_DFW
+    api_name = 'rackspacenovaus'
+
+
+class RackspaceNovaOrdConnection(RackspaceNovaConnection):
+
+    get_endpoint_args = {'service_type': 'compute',
+                         'name': 'cloudServersOpenStack',
+                         'region': 'ORD'}
+
+
+class RackspaceNovaOrdNodeDriver(OpenStack_1_1_NodeDriver):
+    name = 'RackspaceNovaord'
+    website = 'http://www.rackspace.com/'
+    connectionCls = RackspaceNovaOrdConnection
+    type = Provider.RACKSPACE_NOVA_ORD
+    api_name = 'rackspacenovaus'
+
+
+class RackspaceNovaLonNodeDriver(OpenStack_1_1_NodeDriver):
+    name = 'RackspaceNovalon'
+    website = 'http://www.rackspace.com/'
+    connectionCls = RackspaceNovaLonConnection
+    type = Provider.RACKSPACE_NOVA_LON
+    api_name = 'rackspacenovauk'
+
+
+class RackspaceNovaBetaNodeDriver(OpenStack_1_1_NodeDriver):
+    name = 'RackspaceNovaBeta'
+    website = 'http://www.rackspace.com/'
+    connectionCls = RackspaceNovaBetaConnection
+    type = Provider.RACKSPACE_NOVA_BETA
+    api_name = 'rackspacenovabeta'

Modified: libcloud/branches/0.12.x/libcloud/compute/providers.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/compute/providers.py?rev=1439028&r1=1439027&r2=1439028&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/compute/providers.py (original)
+++ libcloud/branches/0.12.x/libcloud/compute/providers.py Sun Jan 27 05:57:51 2013
@@ -18,8 +18,7 @@ Provider related utilities
 
 from libcloud.utils.misc import get_driver as _get_provider_driver
 from libcloud.utils.misc import set_driver as _set_provider_driver
-from libcloud.compute.types import Provider, DEPRECATED_RACKSPACE_PROVIDERS
-from libcloud.compute.types import OLD_CONSTANT_TO_NEW_MAPPING
+from libcloud.compute.types import Provider
 
 __all__ = [
     "Provider",
@@ -69,8 +68,8 @@ DRIVERS = {
         ('libcloud.compute.drivers.gogrid', 'GoGridNodeDriver'),
     Provider.RACKSPACE:
         ('libcloud.compute.drivers.rackspace', 'RackspaceNodeDriver'),
-    Provider.RACKSPACE_FIRST_GEN:
-        ('libcloud.compute.drivers.rackspace', 'RackspaceFirstGenNodeDriver'),
+    Provider.RACKSPACE_UK:
+        ('libcloud.compute.drivers.rackspace', 'RackspaceUKNodeDriver'),
     Provider.SLICEHOST:
         ('libcloud.compute.drivers.slicehost', 'SlicehostNodeDriver'),
     Provider.VPSNET:
@@ -111,6 +110,14 @@ DRIVERS = {
         ('libcloud.compute.drivers.vcloud', 'TerremarkDriver'),
     Provider.CLOUDSTACK:
         ('libcloud.compute.drivers.cloudstack', 'CloudStackNodeDriver'),
+    Provider.RACKSPACE_NOVA_BETA:
+        ('libcloud.compute.drivers.rackspacenova', 'RackspaceNovaBetaNodeDriver'),
+    Provider.RACKSPACE_NOVA_DFW:
+        ('libcloud.compute.drivers.rackspacenova', 'RackspaceNovaDfwNodeDriver'),
+    Provider.RACKSPACE_NOVA_ORD:
+        ('libcloud.compute.drivers.rackspacenova', 'RackspaceNovaOrdNodeDriver'),
+    Provider.RACKSPACE_NOVA_LON:
+        ('libcloud.compute.drivers.rackspacenova', 'RackspaceNovaLonNodeDriver'),
     Provider.LIBVIRT:
         ('libcloud.compute.drivers.libvirt_driver', 'LibvirtNodeDriver'),
     Provider.JOYENT:
@@ -127,17 +134,6 @@ DRIVERS = {
 
 
 def get_driver(provider):
-    if provider in DEPRECATED_RACKSPACE_PROVIDERS:
-        id_to_name_map = dict([(v, k) for k, v in Provider.__dict__.items()])
-        old_name = id_to_name_map[provider]
-        new_name = id_to_name_map[OLD_CONSTANT_TO_NEW_MAPPING[provider]]
-
-        msg = 'Provider constant %s has been removed. New constant ' \
-              'is now called %s.\n' \
-              'For more information on this change and how to modify your ' \
-              'code to work with it, please visit: TODO' % (old_name, new_name)
-        raise Exception(msg)
-
     return _get_provider_driver(DRIVERS, provider)
 
 def set_driver(provider, module, klass):

Modified: libcloud/branches/0.12.x/libcloud/compute/types.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/compute/types.py?rev=1439028&r1=1439027&r2=1439028&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/compute/types.py (original)
+++ libcloud/branches/0.12.x/libcloud/compute/types.py Sun Jan 27 05:57:51 2013
@@ -30,8 +30,6 @@ __all__ = [
     "MalformedResponseError",
     "InvalidCredsError",
     "InvalidCredsException",
-    "DEPRECATED_RACKSPACE_PROVIDERS",
-    "OLD_CONSTANT_TO_NEW_MAPPING"
     ]
 
 
@@ -73,7 +71,6 @@ class Provider(object):
     """
     DUMMY = 'dummy'
     EC2 = 'ec2'
-    RACKSPACE = 'rackspace'
     SLICEHOST = 'slicehost'
     GOGRID = 'gogrid'
     VPSNET = 'vpsnet'
@@ -111,11 +108,9 @@ class Provider(object):
     VCL = 'vcl'
     KTUCLOUD = 'ktucloud'
     GRIDSPOT = 'gridspot'
-    RACKSPACE_FIRST_GEN = 'rackspace_first_gen'
     HOSTVIRTUAL = 'hostvirtual'
     ABIQUO = 'abiquo'
 
-    # Deprecated constants which are still supported
     EC2_US_EAST = 'ec2_us_east'
     EC2_EU = 'ec2_eu'  # deprecated name
     EC2_EU_WEST = 'ec2_eu_west'
@@ -126,7 +121,7 @@ class Provider(object):
     EC2_SA_EAST = 'ec2_sa_east'
     EC2_AP_SOUTHEAST2 = 'ec2_ap_southeast_2'
 
-    # Deprecated constants which aren't supported anymore
+    RACKSPACE = 'rackspace'
     RACKSPACE_UK = 'rackspace_uk'
     RACKSPACE_NOVA_BETA = 'rackspace_nova_beta'
     RACKSPACE_NOVA_DFW = 'rackspace_nova_dfw'
@@ -134,22 +129,6 @@ class Provider(object):
     RACKSPACE_NOVA_ORD = 'rackspace_nova_ord'
 
 
-DEPRECATED_RACKSPACE_PROVIDERS = [Provider.RACKSPACE_UK,
-                                  Provider.RACKSPACE_NOVA_BETA,
-                                  Provider.RACKSPACE_NOVA_DFW,
-                                  Provider.RACKSPACE_NOVA_LON,
-                                  Provider.RACKSPACE_NOVA_ORD]
-OLD_CONSTANT_TO_NEW_MAPPING = {
-    Provider.RACKSPACE: Provider.RACKSPACE_FIRST_GEN,
-    Provider.RACKSPACE_UK: Provider.RACKSPACE_FIRST_GEN,
-
-    Provider.RACKSPACE_NOVA_BETA: Provider.RACKSPACE,
-    Provider.RACKSPACE_NOVA_DFW: Provider.RACKSPACE,
-    Provider.RACKSPACE_NOVA_LON: Provider.RACKSPACE,
-    Provider.RACKSPACE_NOVA_ORD: Provider.RACKSPACE
-}
-
-
 class NodeState(object):
     """
     Standard states for a node

Modified: libcloud/branches/0.12.x/libcloud/storage/drivers/cloudfiles.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/storage/drivers/cloudfiles.py?rev=1439028&r1=1439027&r2=1439028&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/storage/drivers/cloudfiles.py (original)
+++ libcloud/branches/0.12.x/libcloud/storage/drivers/cloudfiles.py Sun Jan 27 05:57:51 2013
@@ -45,6 +45,7 @@ from libcloud.storage.types import Conta
 from libcloud.storage.types import ObjectDoesNotExistError
 from libcloud.storage.types import ObjectHashMismatchError
 from libcloud.storage.types import InvalidContainerNameError
+from libcloud.common.types import LazyList
 from libcloud.common.openstack import OpenStackBaseConnection
 from libcloud.common.openstack import OpenStackDriverMixin
 
@@ -101,14 +102,13 @@ class CloudFilesConnection(OpenStackBase
     Base connection class for the Cloudfiles driver.
     """
 
+    auth_url = AUTH_URL_US
     responseCls = CloudFilesResponse
     rawResponseCls = CloudFilesRawResponse
 
-    def __init__(self, user_id, key, secure=True, auth_url=AUTH_URL_US,
-                 **kwargs):
+    def __init__(self, user_id, key, secure=True, **kwargs):
         super(CloudFilesConnection, self).__init__(user_id, key, secure=secure,
                                                    **kwargs)
-        self.auth_url = auth_url
         self.api_version = API_VERSION
         self.accept_format = 'application/json'
         self.cdn_request = False
@@ -131,15 +131,10 @@ class CloudFilesConnection(OpenStackBase
         if self.cdn_request:
             eps = cdn_eps
 
-        if self._ex_force_service_region:
-            eps = [ep for ep in eps if ep['region'].lower() == self._ex_force_service_region.lower()]
-
         if len(eps) == 0:
-            # TODO: Better error message
             raise LibcloudError('Could not find specified endpoint')
 
         ep = eps[0]
-
         if 'publicURL' in ep:
             return ep['publicURL']
         else:
@@ -165,6 +160,22 @@ class CloudFilesConnection(OpenStackBase
             raw=raw)
 
 
+class CloudFilesUSConnection(CloudFilesConnection):
+    """
+    Connection class for the Cloudfiles US endpoint.
+    """
+
+    auth_url = AUTH_URL_US
+
+
+class CloudFilesUKConnection(CloudFilesConnection):
+    """
+    Connection class for the Cloudfiles UK endpoint.
+    """
+
+    auth_url = AUTH_URL_UK
+
+
 class CloudFilesSwiftConnection(CloudFilesConnection):
     """
     Connection class for the Cloudfiles Swift endpoint.
@@ -192,7 +203,10 @@ class CloudFilesSwiftConnection(CloudFil
 
 class CloudFilesStorageDriver(StorageDriver, OpenStackDriverMixin):
     """
-    CloudFiles driver.
+    Base CloudFiles driver.
+
+    You should never create an instance of this class directly but use US/US
+    class.
     """
     name = 'CloudFiles'
     website = 'http://www.rackspace.com/'
@@ -201,29 +215,11 @@ class CloudFilesStorageDriver(StorageDri
     hash_type = 'md5'
     supports_chunked_encoding = True
 
-    def __init__(self, key, secret=None, secure=True, host=None, port=None,
-                 datacenter='ord', **kwargs):
-        """
-        @inherits:  L{StorageDriver.__init__}
-
-        @param datacenter: Datacenter ID which should be used.
-        @type datacenter: C{str}
-        """
-        if hasattr(self, '_datacenter'):
-            datacenter = self._datacenter
-
-        # This is here for backard compatibility
-        if 'ex_force_service_region' in kwargs:
-            datacenter = kwargs['ex_force_service_region']
-
-        self.datacenter = datacenter
-
-        OpenStackDriverMixin.__init__(self, (), **kwargs)
-        super(CloudFilesStorageDriver, self).__init__(key=key, secret=secret,
-                                            secure=secure, host=host,
-                                            port=port, **kwargs)
+    def __init__(self, *args, **kwargs):
+        OpenStackDriverMixin.__init__(self, *args, **kwargs)
+        super(CloudFilesStorageDriver, self).__init__(*args, **kwargs)
 
-    def iterate_containers(self):
+    def list_containers(self):
         response = self.connection.request('')
 
         if response.status == httplib.NO_CONTENT:
@@ -233,6 +229,10 @@ class CloudFilesStorageDriver(StorageDri
 
         raise LibcloudError('Unexpected status code: %s' % (response.status))
 
+    def list_container_objects(self, container):
+        value_dict = {'container': container}
+        return LazyList(get_more=self._get_more, value_dict=value_dict)
+
     def get_container(self, container_name):
         response = self.connection.request('/%s' % (container_name),
                                            method='HEAD')
@@ -409,26 +409,6 @@ class CloudFilesStorageDriver(StorageDri
 
         raise LibcloudError('Unexpected status code: %s' % (response.status))
 
-    def ex_purge_object_from_cdn(self, obj, email=None):
-        """
-        Purge edge cache for the specified object.
-
-        @param email: Email where a notification will be sent when the job
-        completes. (optional)
-        @type email: C{str}
-        """
-        container_name = self._clean_container_name(obj.container.name)
-        object_name = self._clean_object_name(obj.name)
-        headers = {'X-Purge-Email': email} if email else {}
-
-        response = self.connection.request('/%s/%s' % (container_name,
-                                                       object_name),
-                                           method='DELETE',
-                                           headers=headers,
-                                           cdn_request=True)
-
-        return response.status == httplib.NO_CONTENT
-
     def ex_get_meta_data(self):
         """
         Get meta data
@@ -638,30 +618,30 @@ class CloudFilesStorageDriver(StorageDri
 
         return obj
 
-    def iterate_container_objects(self, container):
+    def _get_more(self, last_key, value_dict):
+        container = value_dict['container']
         params = {}
 
-        while True:
-            response = self.connection.request('/%s' % (container.name),
-                                               params=params)
-
-            if response.status == httplib.NO_CONTENT:
-                # Empty or non-existent container
-                break
-            elif response.status == httplib.OK:
-                objects = self._to_object_list(json.loads(response.body),
-                                               container)
-
-                if len(objects) == 0:
-                    break
-
-                for obj in objects:
-                    yield obj
-                params['marker'] = obj.name
-
-            else:
-                raise LibcloudError('Unexpected status code: %s' %
-                                    (response.status))
+        if last_key:
+            params['marker'] = last_key
+
+        response = self.connection.request('/%s' % (container.name),
+                                           params=params)
+
+        if response.status == httplib.NO_CONTENT:
+            # Empty or inexistent container
+            return [], None, True
+        elif response.status == httplib.OK:
+            objects = self._to_object_list(json.loads(response.body),
+                                           container)
+
+            # TODO: Is this really needed?
+            if len(objects) == 0:
+                return [], None, True
+
+            return objects, objects[-1].name, False
+
+        raise LibcloudError('Unexpected status code: %s' % (response.status))
 
     def _put_object(self, container, object_name, upload_func,
                     upload_func_kwargs, extra=None, file_path=None,
@@ -738,10 +718,15 @@ class CloudFilesStorageDriver(StorageDri
 
     def _to_container_list(self, response):
         # @TODO: Handle more then 10k containers - use "lazy list"?
+        containers = []
+
         for container in response:
             extra = {'object_count': int(container['count']),
                      'size': int(container['bytes'])}
-            yield Container(name=container['name'], extra=extra, driver=self)
+            containers.append(Container(name=container['name'], extra=extra,
+                                        driver=self))
+
+        return containers
 
     def _to_object_list(self, response, container):
         objects = []
@@ -786,15 +771,7 @@ class CloudFilesStorageDriver(StorageDri
         return obj
 
     def _ex_connection_class_kwargs(self):
-        kwargs = {'ex_force_service_region': self.datacenter}
-
-        if self.datacenter in ['dfw', 'ord']:
-            kwargs['auth_url'] = AUTH_URL_US
-        elif self.datacenter == 'lon':
-            kwargs['auth_url'] = AUTH_URL_UK
-
-        kwargs.update(self.openstack_connection_kwargs())
-        return kwargs
+        return self.openstack_connection_kwargs()
 
 
 class CloudFilesUSStorageDriver(CloudFilesStorageDriver):
@@ -804,7 +781,7 @@ class CloudFilesUSStorageDriver(CloudFil
 
     type = Provider.CLOUDFILES_US
     name = 'CloudFiles (US)'
-    _datacenter = 'ord'
+    connectionCls = CloudFilesUSConnection
 
 
 class CloudFilesSwiftStorageDriver(CloudFilesStorageDriver):
@@ -833,7 +810,7 @@ class CloudFilesUKStorageDriver(CloudFil
 
     type = Provider.CLOUDFILES_UK
     name = 'CloudFiles (UK)'
-    _datacenter = 'lon'
+    connectionCls = CloudFilesUKConnection
 
 
 class FileChunkReader(object):
@@ -885,7 +862,7 @@ class ChunkStreamReader(object):
             raise StopIteration
 
         block_size = self.chunk_size
-        if self.bytes_read + block_size > \
+        if self.bytes_read + block_size >\
                 self.end_block - self.start_block:
             block_size = self.end_block - self.start_block - self.bytes_read
             self.stop_iteration = True

Modified: libcloud/branches/0.12.x/libcloud/storage/providers.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/storage/providers.py?rev=1439028&r1=1439027&r2=1439028&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/storage/providers.py (original)
+++ libcloud/branches/0.12.x/libcloud/storage/providers.py Sun Jan 27 05:57:51 2013
@@ -20,8 +20,6 @@ from libcloud.storage.types import Provi
 DRIVERS = {
     Provider.DUMMY:
         ('libcloud.storage.drivers.dummy', 'DummyStorageDriver'),
-    Provider.CLOUDFILES:
-        ('libcloud.storage.drivers.cloudfiles', 'CloudFilesStorageDriver'),
     Provider.S3:
         ('libcloud.storage.drivers.s3', 'S3StorageDriver'),
     Provider.S3_US_WEST:
@@ -38,19 +36,18 @@ DRIVERS = {
         ('libcloud.storage.drivers.ninefold', 'NinefoldStorageDriver'),
     Provider.GOOGLE_STORAGE:
         ('libcloud.storage.drivers.google_storage', 'GoogleStorageDriver'),
-    Provider.CLOUDFILES_SWIFT:
-        ('libcloud.storage.drivers.cloudfiles',
-         'CloudFilesSwiftStorageDriver'),
     Provider.NIMBUS:
         ('libcloud.storage.drivers.nimbus', 'NimbusStorageDriver'),
     Provider.LOCAL:
         ('libcloud.storage.drivers.local', 'LocalStorageDriver'),
 
-    # Deprecated
     Provider.CLOUDFILES_US:
         ('libcloud.storage.drivers.cloudfiles', 'CloudFilesUSStorageDriver'),
     Provider.CLOUDFILES_UK:
-        ('libcloud.storage.drivers.cloudfiles', 'CloudFilesUKStorageDriver')
+        ('libcloud.storage.drivers.cloudfiles', 'CloudFilesUKStorageDriver'),
+    Provider.CLOUDFILES_SWIFT:
+        ('libcloud.storage.drivers.cloudfiles',
+         'CloudFilesSwiftStorageDriver')
 }
 
 

Modified: libcloud/branches/0.12.x/libcloud/storage/types.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/storage/types.py?rev=1439028&r1=1439027&r2=1439028&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/storage/types.py (original)
+++ libcloud/branches/0.12.x/libcloud/storage/types.py Sun Jan 27 05:57:51 2013
@@ -53,14 +53,12 @@ class Provider(object):
     NINEFOLD = 'ninefold'
     GOOGLE_STORAGE = 'google_storage'
     S3_US_WEST_OREGON = 's3_us_west_oregon'
-    CLOUDFILES_SWIFT = 'cloudfiles_swift'
     NIMBUS = 'nimbus'
     LOCAL = 'local'
-    CLOUDFILES = 'cloudfiles'
 
-    # Deperecated
     CLOUDFILES_US = 'cloudfiles_us'
     CLOUDFILES_UK = 'cloudfiles_uk'
+    CLOUDFILES_SWIFT = 'cloudfiles_swift'
 
 
 class ContainerError(LibcloudError):

Modified: libcloud/branches/0.12.x/libcloud/test/compute/fixtures/openstack/_v1_1__auth.json
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/test/compute/fixtures/openstack/_v1_1__auth.json?rev=1439028&r1=1439027&r2=1439028&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/test/compute/fixtures/openstack/_v1_1__auth.json (original)
+++ libcloud/branches/0.12.x/libcloud/test/compute/fixtures/openstack/_v1_1__auth.json Sun Jan 27 05:57:51 2013
@@ -10,11 +10,6 @@
                     "region": "ORD",
                     "publicURL": "https://cdn2.clouddrive.com/v1/MossoCloudFS",
                     "v1Default": true
-                },
-                {
-                    "region": "LON",
-                    "publicURL": "https://cdn2.clouddrive.com/v1/MossoCloudFS",
-                    "v1Default": false
                 }
             ],
             "cloudFiles": [
@@ -23,12 +18,6 @@
                     "publicURL": "https://storage101.ord1.clouddrive.com/v1/MossoCloudFS",
                     "v1Default": true,
                     "internalURL": "https://snet-storage101.ord1.clouddrive.com/v1/MossoCloudFS"
-                },
-                {
-                    "region": "LON",
-                    "publicURL": "https://storage101.lon1.clouddrive.com/v1/MossoCloudFS",
-                    "v1Default": false,
-                    "internalURL": "https://snet-storage101.lon1.clouddrive.com/v1/MossoCloudFS"
                 }
             ],
             "cloudServers": [

Modified: libcloud/branches/0.12.x/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json?rev=1439028&r1=1439027&r2=1439028&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json (original)
+++ libcloud/branches/0.12.x/libcloud/test/compute/fixtures/openstack/_v2_0__auth.json Sun Jan 27 05:57:51 2013
@@ -28,12 +28,6 @@
                         "tenantId": "MossoCloudFS_11111-111111111-1111111111-1111111",
                         "publicURL": "https://storage101.ord1.clouddrive.com/v1/MossoCloudFS_11111-111111111-1111111111-1111111",
                         "internalURL": "https://snet-storage101.ord1.clouddrive.com/v1/MossoCloudFS_11111-111111111-1111111111-1111111"
-                    },
-                    {
-                        "region": "LON",
-                        "tenantId": "MossoCloudFS_11111-111111111-1111111111-1111111",
-                        "publicURL": "https://storage101.lon1.clouddrive.com/v1/MossoCloudFS_11111-111111111-1111111111-1111111",
-                        "internalURL": "https://snet-storage101.lon1.clouddrive.com/v1/MossoCloudFS_11111-111111111-1111111111-1111111"
                     }
                 ],
                 "name": "cloudFiles",

Modified: libcloud/branches/0.12.x/libcloud/test/compute/test_deployment.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/test/compute/test_deployment.py?rev=1439028&r1=1439027&r2=1439028&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/test/compute/test_deployment.py (original)
+++ libcloud/branches/0.12.x/libcloud/test/compute/test_deployment.py Sun Jan 27 05:57:51 2013
@@ -28,7 +28,7 @@ from libcloud.compute.deployment import 
 from libcloud.compute.base import Node
 from libcloud.compute.types import NodeState, DeploymentError, LibcloudError
 from libcloud.compute.ssh import BaseSSHClient
-from libcloud.compute.drivers.rackspace import RackspaceFirstGenNodeDriver as Rackspace
+from libcloud.compute.drivers.rackspace import RackspaceNodeDriver as Rackspace
 
 from libcloud.test import MockHttp, XML_HEADERS
 from libcloud.test.file_fixtures import ComputeFileFixtures, OpenStackFixtures

Modified: libcloud/branches/0.12.x/libcloud/test/compute/test_ec2.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/test/compute/test_ec2.py?rev=1439028&r1=1439027&r2=1439028&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/test/compute/test_ec2.py (original)
+++ libcloud/branches/0.12.x/libcloud/test/compute/test_ec2.py Sun Jan 27 05:57:51 2013
@@ -45,36 +45,15 @@ except AttributeError:
     parse_qsl = cgi.parse_qsl
 
 
-class BaseEC2Tests(LibcloudTestCase):
-    def test_instantiate_driver_valid_datacenters(self):
-        datacenters = REGION_DETAILS.keys()
-        datacenters = [d for d in datacenters if d != 'nimbus']
-
-        for datacenter in datacenters:
-            EC2NodeDriver(*EC2_PARAMS, **{'datacenter': datacenter})
-
-    def test_instantiate_driver_invalid_datacenters(self):
-        for datacenter in ['invalid', 'nimbus']:
-            try:
-                EC2NodeDriver(*EC2_PARAMS, **{'datacenter': datacenter})
-            except ValueError:
-                pass
-            else:
-                self.fail('Invalid region, but exception was not thrown')
-
-
 class EC2Tests(LibcloudTestCase, TestCaseMixin):
     image_name = 'ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml'
-    datacenter = 'us-east-1'
 
     def setUp(self):
         EC2MockHttp.test = self
         EC2NodeDriver.connectionCls.conn_classes = (None, EC2MockHttp)
         EC2MockHttp.use_param = 'Action'
         EC2MockHttp.type = None
-
-        self.driver = EC2NodeDriver(*EC2_PARAMS,
-                                    **{'datacenter': self.datacenter})
+        self.driver = EC2NodeDriver(*EC2_PARAMS)
 
     def test_create_node(self):
         image = NodeImage(id='ami-be3adfd7',
@@ -396,75 +375,6 @@ class EC2Tests(LibcloudTestCase, TestCas
         self.assertTrue(retValue)
 
 
-class EC2USWest1Tests(EC2Tests):
-    datacenter = 'us-west-1'
-
-
-class EC2USWest2Tests(EC2Tests):
-    datacenter = 'us-west-2'
-
-
-class EC2EUWestTests(EC2Tests):
-    datacenter = 'eu-west-1'
-
-
-class EC2APSE1Tests(EC2Tests):
-    datacenter = 'ap-southeast-1'
-
-
-class EC2APNETests(EC2Tests):
-    datacenter = 'ap-northeast-1'
-
-
-class EC2APSE2Tests(EC2Tests):
-    datacenter = 'ap-southeast-2'
-
-
-class EC2SAEastTests(EC2Tests):
-    datacenter = 'sa-east-1'
-
-
-# Tests for the old, deprecated way of instantiating a driver.
-class EC2OldStyleModelTests(EC2Tests):
-    driver_klass = EC2USWestNodeDriver
-
-    def setUp(self):
-        EC2MockHttp.test = self
-        EC2NodeDriver.connectionCls.conn_classes = (None, EC2MockHttp)
-        EC2MockHttp.use_param = 'Action'
-        EC2MockHttp.type = None
-
-        self.driver = self.driver_klass(*EC2_PARAMS)
-
-
-class EC2USWest1OldStyleModelTests(EC2OldStyleModelTests):
-    driver_klass = EC2USWestNodeDriver
-
-
-class EC2USWest2OldStyleModelTests(EC2OldStyleModelTests):
-    driver_klass = EC2USWestOregonNodeDriver
-
-
-class EC2EUWestOldStyleModelTests(EC2OldStyleModelTests):
-    driver_klass = EC2EUNodeDriver
-
-
-class EC2APSE1OldStyleModelTests(EC2OldStyleModelTests):
-    driver_klass = EC2APSENodeDriver
-
-
-class EC2APNEOldStyleModelTests(EC2OldStyleModelTests):
-    driver_klass = EC2APNENodeDriver
-
-
-class EC2APSE2OldStyleModelTests(EC2OldStyleModelTests):
-    driver_klass = EC2APSESydneyNodeDriver
-
-
-class EC2SAEastOldStyleModelTests(EC2OldStyleModelTests):
-    driver_klass = EC2SAEastNodeDriver
-
-
 class EC2MockHttp(MockHttpTestCase):
     fixtures = ComputeFileFixtures('ec2')
 

Modified: libcloud/branches/0.12.x/libcloud/test/compute/test_rackspace.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/test/compute/test_rackspace.py?rev=1439028&r1=1439027&r2=1439028&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/test/compute/test_rackspace.py (original)
+++ libcloud/branches/0.12.x/libcloud/test/compute/test_rackspace.py Sun Jan 27 05:57:51 2013
@@ -15,182 +15,25 @@
 import sys
 import unittest
 
-from libcloud.utils.py3 import method_type
-from libcloud.utils.py3 import httplib
-from libcloud.compute.providers import DEPRECATED_RACKSPACE_PROVIDERS
-from libcloud.compute.providers import get_driver
-from libcloud.compute.drivers.rackspace import RackspaceFirstGenNodeDriver
 from libcloud.compute.drivers.rackspace import RackspaceNodeDriver
 from libcloud.test.compute.test_openstack import OpenStack_1_0_Tests
-from libcloud.test.compute.test_openstack import OpenStack_1_1_Tests, \
-                                                 OpenStack_1_1_MockHttp
-from libcloud.pricing import clear_pricing_data
 
-from libcloud.test.secrets import RACKSPACE_NOVA_PARAMS
 from libcloud.test.secrets import RACKSPACE_PARAMS
 
 
-class RackspaceusFirstGenUsTests(OpenStack_1_0_Tests):
+class RackspaceTests(OpenStack_1_0_Tests):
     should_list_locations = True
     should_have_pricing = True
 
-    driver_klass = RackspaceFirstGenNodeDriver
-    driver_type = RackspaceFirstGenNodeDriver
-    driver_args = RACKSPACE_PARAMS
-    driver_kwargs = {'region': 'us'}
-
-    def test_error_is_thrown_on_accessing_old_constant(self):
-        for provider in DEPRECATED_RACKSPACE_PROVIDERS:
-            try:
-                get_driver(provider)
-            except Exception:
-                e = sys.exc_info()[1]
-                self.assertTrue(str(e).find('has been removed') != -1)
-            else:
-                self.fail('Exception was not thrown')
-
-    def test_list_sizes_pricing(self):
-        sizes = self.driver.list_sizes()
-
-        for size in sizes:
-            self.assertTrue(size.price > 0)
-
-
-class RackspaceusFirstGenUkTests(OpenStack_1_0_Tests):
-    should_list_locations = True
-    should_have_pricing = True
-
-    driver_klass = RackspaceFirstGenNodeDriver
-    driver_type = RackspaceFirstGenNodeDriver
-    driver_args = RACKSPACE_PARAMS
-    driver_kwargs = {'region': 'uk'}
-
-    def test_list_sizes_pricing(self):
-        sizes = self.driver.list_sizes()
-
-        for size in sizes:
-            self.assertTrue(size.price > 0)
-
-
-class RackspaceNovaMockHttp(OpenStack_1_1_MockHttp):
-    def __init__(self, *args, **kwargs):
-        super(RackspaceNovaMockHttp, self).__init__(*args, **kwargs)
-
-        methods1 = OpenStack_1_1_MockHttp.__dict__
-
-        names1 = [m for m in methods1 if m.find('_v1_1') == 0]
-
-        for name in names1:
-            method = methods1[name]
-            new_name = name.replace('_v1_1_slug_', '_v2_1337_')
-            setattr(self, new_name, method_type(method, self,
-                RackspaceNovaMockHttp))
-
-
-class RackspaceNovaLonMockHttp(RackspaceNovaMockHttp):
-
-    def _v2_0_tokens(self, method, url, body, headers):
-        body = self.auth_fixtures.load('_v2_0__auth_lon.json')
-        return (httplib.OK, body, self.json_content_headers,
-                httplib.responses[httplib.OK])
-
-
-
-class RackspaceNovaDfwTests(OpenStack_1_1_Tests):
-
-    driver_klass = RackspaceNodeDriver
-    driver_type = RackspaceNodeDriver
-    driver_args = RACKSPACE_NOVA_PARAMS
-    driver_kwargs = {'datacenter': 'dfw'}
-
-    @classmethod
-    def create_driver(self):
-        return self.driver_type(*self.driver_args, **self.driver_kwargs)
-
-    def setUp(self):
-        self.driver_klass.connectionCls.conn_classes = (RackspaceNovaMockHttp,
-                                                        RackspaceNovaMockHttp)
-        self.driver_klass.connectionCls.auth_url = \
-                'https://auth.api.example.com/v2.0/'
-        self.driver = self.create_driver()
-        # normally authentication happens lazily, but we force it here
-        self.driver.connection._populate_hosts_and_request_paths()
-        clear_pricing_data()
-        self.node = self.driver.list_nodes()[1]
-
-    def test_service_catalog(self):
-        self.assertEqual(
-                'https://dfw.servers.api.rackspacecloud.com/v2/1337',
-                self.driver.connection.get_endpoint())
-
-
-class RackspaceNovaOrdTests(OpenStack_1_1_Tests):
-
     driver_klass = RackspaceNodeDriver
     driver_type = RackspaceNodeDriver
-    driver_args = RACKSPACE_NOVA_PARAMS
-    driver_kwargs = {'datacenter': 'ord'}
-
-    @classmethod
-    def create_driver(self):
-        return self.driver_type(*self.driver_args, **self.driver_kwargs)
-
-    def setUp(self):
-        self.driver_klass.connectionCls.conn_classes = (RackspaceNovaMockHttp,
-                                                        RackspaceNovaMockHttp)
-        self.driver_klass.connectionCls.auth_url = \
-                'https://auth.api.example.com/v2.0/'
-        self.driver = self.create_driver()
-        # normally authentication happens lazily, but we force it here
-        self.driver.connection._populate_hosts_and_request_paths()
-        clear_pricing_data()
-        self.node = self.driver.list_nodes()[1]
-
-    def test_list_sizes_pricing(self):
-        sizes = self.driver.list_sizes()
-
-        for size in sizes:
-            if size.ram > 256:
-                self.assertTrue(size.price > 0)
-
-    def test_service_catalog(self):
-        self.assertEqual('https://ord.servers.api.rackspacecloud.com/v2/1337',
-                         self.driver.connection.get_endpoint())
-
-
-class RackspaceNovaLonTests(OpenStack_1_1_Tests):
-
-    driver_klass = RackspaceNodeDriver
-    driver_type = RackspaceNodeDriver
-    driver_args = RACKSPACE_NOVA_PARAMS
-    driver_kwargs = {'datacenter': 'lon'}
-
-    @classmethod
-    def create_driver(self):
-        return self.driver_type(*self.driver_args, **self.driver_kwargs)
-
-    def setUp(self):
-        self.driver_klass.connectionCls.conn_classes = \
-                (RackspaceNovaLonMockHttp, RackspaceNovaLonMockHttp)
-        self.driver_klass.connectionCls.auth_url = \
-                'https://lon.auth.api.example.com/v2.0/'
-        self.driver = self.create_driver()
-        # normally authentication happens lazily, but we force it here
-        self.driver.connection._populate_hosts_and_request_paths()
-        clear_pricing_data()
-        self.node = self.driver.list_nodes()[1]
+    driver_args = RACKSPACE_PARAMS
 
     def test_list_sizes_pricing(self):
         sizes = self.driver.list_sizes()
 
         for size in sizes:
-            if size.ram > 256:
-                self.assertTrue(size.price > 0)
-
-    def test_service_catalog(self):
-        self.assertEqual('https://lon.servers.api.rackspacecloud.com/v2/1337',
-                         self.driver.connection.get_endpoint())
-
+            self.assertTrue(size.price > 0)
 
 if __name__ == '__main__':
     sys.exit(unittest.main())

Added: libcloud/branches/0.12.x/libcloud/test/compute/test_rackspacenova.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/test/compute/test_rackspacenova.py?rev=1439028&view=auto
==============================================================================
--- libcloud/branches/0.12.x/libcloud/test/compute/test_rackspacenova.py (added)
+++ libcloud/branches/0.12.x/libcloud/test/compute/test_rackspacenova.py Sun Jan 27 05:57:51 2013
@@ -0,0 +1,149 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import sys
+import unittest
+
+from libcloud.utils.py3 import method_type
+from libcloud.utils.py3 import httplib
+from libcloud.compute.drivers.rackspacenova import RackspaceNovaBetaNodeDriver, \
+                                                   RackspaceNovaDfwNodeDriver, \
+                                                   RackspaceNovaOrdNodeDriver, \
+                                                   RackspaceNovaLonNodeDriver
+from libcloud.test.compute.test_openstack import OpenStack_1_1_Tests, OpenStack_1_1_MockHttp
+from libcloud.pricing import clear_pricing_data
+
+from libcloud.test.secrets import RACKSPACE_NOVA_PARAMS
+
+
+class RackspaceNovaMockHttp(OpenStack_1_1_MockHttp):
+    def __init__(self, *args, **kwargs):
+        super(RackspaceNovaMockHttp, self).__init__(*args, **kwargs)
+
+        methods1 = OpenStack_1_1_MockHttp.__dict__
+
+        names1 = [m for m in methods1 if m.find('_v1_1') == 0]
+
+        for name in names1:
+            method = methods1[name]
+            new_name = name.replace('_v1_1_slug_', '_v2_1337_')
+            setattr(self, new_name, method_type(method, self,
+                RackspaceNovaMockHttp))
+
+
+class RackspaceNovaLonMockHttp(RackspaceNovaMockHttp):
+
+    def _v2_0_tokens(self, method, url, body, headers):
+        body = self.auth_fixtures.load('_v2_0__auth_lon.json')
+        return (httplib.OK, body, self.json_content_headers, httplib.responses[httplib.OK])
+
+
+class RackspaceNovaBetaTests(OpenStack_1_1_Tests):
+
+    driver_klass = RackspaceNovaBetaNodeDriver
+    driver_type = RackspaceNovaBetaNodeDriver
+    driver_args = RACKSPACE_NOVA_PARAMS + ('1.1',)
+    driver_kwargs = {'ex_force_auth_version': '2.0'}
+
+    @classmethod
+    def create_driver(self):
+        return self.driver_type(*self.driver_args, **self.driver_kwargs)
+
+    def setUp(self):
+        self.driver_klass.connectionCls.conn_classes = (RackspaceNovaMockHttp, RackspaceNovaMockHttp)
+        self.driver_klass.connectionCls.auth_url = "https://auth.api.example.com/v2.0/"
+        self.driver = self.create_driver()
+        # normally authentication happens lazily, but we force it here
+        self.driver.connection._populate_hosts_and_request_paths()
+        clear_pricing_data()
+        self.node = self.driver.list_nodes()[1]
+
+    def test_service_catalog(self):
+        self.assertEqual('https://preprod.dfw.servers.api.rackspacecloud.com/v2/1337', self.driver.connection.get_endpoint())
+
+
+class RackspaceNovaDfwTests(OpenStack_1_1_Tests):
+
+    driver_klass = RackspaceNovaDfwNodeDriver
+    driver_type = RackspaceNovaDfwNodeDriver
+    driver_args = RACKSPACE_NOVA_PARAMS + ('1.1',)
+    driver_kwargs = {'ex_force_auth_version': '2.0'}
+
+    @classmethod
+    def create_driver(self):
+        return self.driver_type(*self.driver_args, **self.driver_kwargs)
+
+    def setUp(self):
+        self.driver_klass.connectionCls.conn_classes = (RackspaceNovaMockHttp, RackspaceNovaMockHttp)
+        self.driver_klass.connectionCls.auth_url = "https://auth.api.example.com/v2.0/"
+        self.driver = self.create_driver()
+        # normally authentication happens lazily, but we force it here
+        self.driver.connection._populate_hosts_and_request_paths()
+        clear_pricing_data()
+        self.node = self.driver.list_nodes()[1]
+
+    def test_service_catalog(self):
+        self.assertEqual('https://dfw.servers.api.rackspacecloud.com/v2/1337', self.driver.connection.get_endpoint())
+
+
+class RackspaceNovaOrdTests(OpenStack_1_1_Tests):
+
+    driver_klass = RackspaceNovaOrdNodeDriver
+    driver_type = RackspaceNovaOrdNodeDriver
+    driver_args = RACKSPACE_NOVA_PARAMS + ('1.1',)
+    driver_kwargs = {'ex_force_auth_version': '2.0'}
+
+    @classmethod
+    def create_driver(self):
+        return self.driver_type(*self.driver_args, **self.driver_kwargs)
+
+    def setUp(self):
+        self.driver_klass.connectionCls.conn_classes = (RackspaceNovaMockHttp, RackspaceNovaMockHttp)
+        self.driver_klass.connectionCls.auth_url = "https://auth.api.example.com/v2.0/"
+        self.driver = self.create_driver()
+        # normally authentication happens lazily, but we force it here
+        self.driver.connection._populate_hosts_and_request_paths()
+        clear_pricing_data()
+        self.node = self.driver.list_nodes()[1]
+
+    def test_service_catalog(self):
+        self.assertEqual('https://ord.servers.api.rackspacecloud.com/v2/1337', self.driver.connection.get_endpoint())
+
+
+class RackspaceNovaLonTests(OpenStack_1_1_Tests):
+
+    driver_klass = RackspaceNovaLonNodeDriver
+    driver_type = RackspaceNovaLonNodeDriver
+    driver_args = RACKSPACE_NOVA_PARAMS + ('1.1',)
+    driver_kwargs = {'ex_force_auth_version': '2.0'}
+
+    @classmethod
+    def create_driver(self):
+        return self.driver_type(*self.driver_args, **self.driver_kwargs)
+
+    def setUp(self):
+        self.driver_klass.connectionCls.conn_classes = (RackspaceNovaLonMockHttp, RackspaceNovaLonMockHttp)
+        self.driver_klass.connectionCls.auth_url = "https://lon.auth.api.example.com/v2.0/"
+        self.driver = self.create_driver()
+        # normally authentication happens lazily, but we force it here
+        self.driver.connection._populate_hosts_and_request_paths()
+        clear_pricing_data()
+        self.node = self.driver.list_nodes()[1]
+
+    def test_service_catalog(self):
+        self.assertEqual('https://lon.servers.api.rackspacecloud.com/v2/1337', self.driver.connection.get_endpoint())
+
+
+if __name__ == '__main__':
+    sys.exit(unittest.main())

Modified: libcloud/branches/0.12.x/libcloud/test/storage/test_cloudfiles.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.12.x/libcloud/test/storage/test_cloudfiles.py?rev=1439028&r1=1439027&r2=1439028&view=diff
==============================================================================
--- libcloud/branches/0.12.x/libcloud/test/storage/test_cloudfiles.py (original)
+++ libcloud/branches/0.12.x/libcloud/test/storage/test_cloudfiles.py Sun Jan 27 05:57:51 2013
@@ -41,31 +41,24 @@ from libcloud.storage.types import Objec
 from libcloud.storage.types import ObjectHashMismatchError
 from libcloud.storage.types import InvalidContainerNameError
 from libcloud.storage.drivers.cloudfiles import CloudFilesStorageDriver
-from libcloud.storage.drivers.cloudfiles import CloudFilesUSStorageDriver
-from libcloud.storage.drivers.cloudfiles import CloudFilesUKStorageDriver
 from libcloud.storage.drivers.dummy import DummyIterator
 
 from libcloud.test import StorageMockHttp, MockRawResponse # pylint: disable-msg=E0611
-from libcloud.test import MockHttpTestCase # pylint: disable-msg=E0611
 from libcloud.test.file_fixtures import StorageFileFixtures, OpenStackFixtures # pylint: disable-msg=E0611
 
+current_hash = None
+
 
 class CloudFilesTests(unittest.TestCase):
-    driver_klass = CloudFilesStorageDriver
-    driver_args = ('dummy', 'dummy')
-    driver_kwargs = {}
-    datacenter = 'ord'
 
     def setUp(self):
-        self.driver_klass.connectionCls.conn_classes = (
+        CloudFilesStorageDriver.connectionCls.conn_classes = (
             None, CloudFilesMockHttp)
-        self.driver_klass.connectionCls.rawResponseCls = \
+        CloudFilesStorageDriver.connectionCls.rawResponseCls = \
                                               CloudFilesMockRawResponse
         CloudFilesMockHttp.type = None
         CloudFilesMockRawResponse.type = None
-        self.driver = self.driver_klass(*self.driver_args,
-                                        **self.driver_kwargs)
-
+        self.driver = CloudFilesStorageDriver('dummy', 'dummy')
         # normally authentication happens lazily, but we force it here
         self.driver.connection._populate_hosts_and_request_paths()
         self._remove_test_file()
@@ -73,23 +66,6 @@ class CloudFilesTests(unittest.TestCase)
     def tearDown(self):
         self._remove_test_file()
 
-    def test_invalid_ex_force_service_region(self):
-        driver = CloudFilesStorageDriver('driver', 'dummy',
-                ex_force_service_region='invalid')
-
-        try:
-            driver.list_containers()
-        except:
-            e = sys.exc_info()[1]
-            self.assertEquals(e.value, 'Could not find specified endpoint')
-        else:
-            self.fail('Exception was not thrown')
-
-    def test_ex_force_service_region(self):
-        driver = CloudFilesStorageDriver('driver', 'dummy',
-                ex_force_service_region='ORD')
-        driver.list_containers()
-
     def test_force_auth_token_kwargs(self):
         base_url = 'https://cdn2.clouddrive.com/v1/MossoCloudFS'
         kwargs = {
@@ -128,10 +104,8 @@ class CloudFilesTests(unittest.TestCase)
             self.fail('Exception was not thrown')
 
     def test_service_catalog(self):
-        url = 'https://storage101.%s1.clouddrive.com/v1/MossoCloudFS' % \
-              (self.datacenter)
         self.assertEqual(
-             url,
+             'https://storage101.ord1.clouddrive.com/v1/MossoCloudFS',
              self.driver.connection.get_endpoint())
 
         self.driver.connection.cdn_request = True
@@ -292,7 +266,7 @@ class CloudFilesTests(unittest.TestCase)
                                              destination_path=destination_path,
                                              overwrite_existing=False,
                                              delete_on_failure=True)
-        self.assertTrue(result)
+        #self.assertTrue(result)
 
     def test_download_object_invalid_file_size(self):
         CloudFilesMockRawResponse.type = 'INVALID_SIZE'
@@ -523,26 +497,6 @@ class CloudFilesTests(unittest.TestCase)
         self.assertTrue('bytes_used' in meta_data)
         self.assertTrue('temp_url_key' in meta_data)
 
-    def test_ex_purge_object_from_cdn(self):
-        CloudFilesMockHttp.type = 'PURGE_SUCCESS'
-        container = Container(name='foo_bar_container', extra={},
-                              driver=self.driver)
-        obj = Object(name='object', size=1000, hash=None, extra={},
-                     container=container, meta_data=None,
-                     driver=self)
-
-        self.assertTrue(self.driver.ex_purge_object_from_cdn(obj=obj))
-
-    def test_ex_purge_object_from_cdn_with_email(self):
-        CloudFilesMockHttp.type = 'PURGE_SUCCESS_EMAIL'
-        container = Container(name='foo_bar_container', extra={},
-                              driver=self.driver)
-        obj = Object(name='object', size=1000, hash=None, extra={},
-                     container=container, meta_data=None,
-                     driver=self)
-        self.assertTrue(self.driver.ex_purge_object_from_cdn(obj=obj,
-                                                       email='test@test.com'))
-
     @mock.patch('os.path.getsize')
     def test_ex_multipart_upload_object_for_small_files(self, getsize_mock):
         getsize_mock.return_value = 0
@@ -684,9 +638,9 @@ class CloudFilesTests(unittest.TestCase)
                                     "/v1/MossoCloudFS/foo_bar_container/foo_bar_object")
         sig = hmac.new(b('foo'), b(hmac_body), sha1).hexdigest()
         ret = self.driver.ex_get_object_temp_url(obj, 'GET')
-        temp_url = 'https://storage101.%s1.clouddrive.com/v1/MossoCloudFS/foo_bar_container/foo_bar_object?temp_url_expires=60&temp_url_sig=%s' % (self.datacenter, sig)
+        temp_url = 'https://storage101.ord1.clouddrive.com/v1/MossoCloudFS/foo_bar_container/foo_bar_object?temp_url_expires=60&temp_url_sig=%s' % (sig)
 
-        self.assertEquals(''.join(sorted(ret)), ''.join(sorted(temp_url)))
+        self.assertEquals(ret, temp_url)
 
     def test_ex_get_object_temp_url_no_key_raises_key_error(self):
         self.driver.ex_get_meta_data = mock.Mock()
@@ -709,17 +663,7 @@ class CloudFilesTests(unittest.TestCase)
             pass
 
 
-class CloudFilesDeprecatedUSTests(CloudFilesTests):
-    driver_klass = CloudFilesUSStorageDriver
-    datacenter = 'ord'
-
-
-class CloudFilesDeprecatedUKTests(CloudFilesTests):
-    driver_klass = CloudFilesUKStorageDriver
-    datacenter = 'lon'
-
-
-class CloudFilesMockHttp(StorageMockHttp, MockHttpTestCase):
+class CloudFilesMockHttp(StorageMockHttp):
 
     fixtures = StorageFileFixtures('cloudfiles')
     auth_fixtures = OpenStackFixtures()
@@ -889,25 +833,6 @@ class CloudFilesMockHttp(StorageMockHttp
             status_code = httplib.ACCEPTED
         return (status_code, body, headers, httplib.responses[httplib.OK])
 
-    def _v1_MossoCloudFS_foo_bar_container_object_PURGE_SUCCESS(
-        self, method, url, body, headers):
-
-        if method == 'DELETE':
-            # test_ex_purge_from_cdn
-            headers = self.base_headers
-            status_code = httplib.NO_CONTENT
-        return (status_code, body, headers, httplib.responses[httplib.OK])
-
-    def _v1_MossoCloudFS_foo_bar_container_object_PURGE_SUCCESS_EMAIL(
-        self, method, url, body, headers):
-
-        if method == 'DELETE':
-            # test_ex_purge_from_cdn_with_email
-            self.assertEqual(headers['X-Purge-Email'], 'test@test.com')
-            headers = self.base_headers
-            status_code = httplib.NO_CONTENT
-        return (status_code, body, headers, httplib.responses[httplib.OK])
-
     def _v1_MossoCloudFS_foo_bar_container_NOT_FOUND(
         self, method, url, body, headers):
 
@@ -992,7 +917,8 @@ class CloudFilesMockRawResponse(MockRawR
         self, method, url, body, headers):
 
         # test_download_object_success
-        body = self._generate_random_data(1000)
+        body = 'test'
+        self._data = self._generate_random_data(1000)
         return (httplib.OK,
                 body,
                 self.base_headers,
@@ -1001,7 +927,8 @@ class CloudFilesMockRawResponse(MockRawR
     def _v1_MossoCloudFS_foo_bar_container_foo_bar_object_INVALID_SIZE(
         self, method, url, body, headers):
         # test_download_object_invalid_file_size
-        body = self._generate_random_data(100)
+        body = 'test'
+        self._data = self._generate_random_data(100)
         return (httplib.OK, body,
                 self.base_headers,
                 httplib.responses[httplib.OK])



Mime
View raw message