You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2016/04/01 00:31:26 UTC

libcloud git commit: Add S3_RGW_OUTSCALE provider Closes #730

Repository: libcloud
Updated Branches:
  refs/heads/trunk 9230d9e4e -> 2a450e407


Add S3_RGW_OUTSCALE provider
Closes #730


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2a450e40
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2a450e40
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2a450e40

Branch: refs/heads/trunk
Commit: 2a450e4072c0468440877ec3decf3b21eaf369fa
Parents: 9230d9e
Author: Javier M. Mellid <jm...@igalia.com>
Authored: Wed Mar 30 15:00:03 2016 +0000
Committer: anthony-shaw <an...@gmail.com>
Committed: Fri Apr 1 09:31:00 2016 +1100

----------------------------------------------------------------------
 libcloud/storage/drivers/s3.py | 31 +++++++++++++++++++++++++++++++
 libcloud/storage/providers.py  |  2 ++
 libcloud/storage/types.py      |  2 ++
 3 files changed, 35 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/2a450e40/libcloud/storage/drivers/s3.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/s3.py b/libcloud/storage/drivers/s3.py
index 789a284..c4c249c 100644
--- a/libcloud/storage/drivers/s3.py
+++ b/libcloud/storage/drivers/s3.py
@@ -60,6 +60,15 @@ S3_AP_NORTHEAST2_HOST = 's3-ap-northeast-2.amazonaws.com'
 S3_AP_NORTHEAST_HOST = S3_AP_NORTHEAST1_HOST
 S3_SA_EAST_HOST = 's3-sa-east-1.amazonaws.com'
 
+S3_RGW_OUTSCALE_HOSTS_BY_REGION =\
+    {'eu-west-1': 'osu.eu-west-1.outscale.com',
+     'eu-west-2': 'osu.eu-west-2.outscale.com',
+     'us-west-1': 'osu.us-west-1.outscale.com',
+     'us-east-2': 'osu.us-east-2.outscale.com',
+     'cn-southeast-1': 'osu.cn-southeast-1.outscale.hk'}
+
+S3_RGW_OUTSCALE_DEFAULT_REGION = 'eu-west-2'
+
 API_VERSION = '2006-03-01'
 NAMESPACE = 'http://s3.amazonaws.com/doc/%s/' % (API_VERSION)
 
@@ -1004,3 +1013,25 @@ class S3SAEastStorageDriver(S3StorageDriver):
     name = 'Amazon S3 (sa-east-1)'
     connectionCls = S3SAEastConnection
     ex_location_name = 'sa-east-1'
+
+
+class S3RGWOutscaleConnection(S3Connection):
+    pass
+
+
+class S3RGWOutscaleStorageDriver(S3StorageDriver):
+
+    def __init__(self, key, secret=None, secure=True, host=None, port=None,
+                 api_version=None, region=S3_RGW_OUTSCALE_DEFAULT_REGION,
+                 **kwargs):
+        if region not in S3_RGW_OUTSCALE_HOSTS_BY_REGION:
+            raise LibcloudError('Unknown region (%s)' % (region), driver=self)
+        self.name = 'OUTSCALE Ceph RGW S3 (%s)' % (region)
+        self.ex_location_name = region
+        self.region_name = region
+        self.connectionCls = S3RGWOutscaleConnection
+        self.connectionCls.host = S3_RGW_OUTSCALE_HOSTS_BY_REGION[region]
+        super(S3RGWOutscaleStorageDriver, self).__init__(key, secret,
+                                                         secure, host, port,
+                                                         api_version, region,
+                                                         **kwargs)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2a450e40/libcloud/storage/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/providers.py b/libcloud/storage/providers.py
index 1cb31e4..1d38558 100644
--- a/libcloud/storage/providers.py
+++ b/libcloud/storage/providers.py
@@ -42,6 +42,8 @@ DRIVERS = {
     ('libcloud.storage.drivers.s3', 'S3APNE2StorageDriver'),
     Provider.S3_SA_EAST:
     ('libcloud.storage.drivers.s3', 'S3SAEastStorageDriver'),
+    Provider.S3_RGW_OUTSCALE:
+    ('libcloud.storage.drivers.s3', 'S3RGWOutscaleStorageDriver'),
     Provider.NINEFOLD:
     ('libcloud.storage.drivers.ninefold', 'NinefoldStorageDriver'),
     Provider.GOOGLE_STORAGE:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/2a450e40/libcloud/storage/types.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/types.py b/libcloud/storage/types.py
index 2c17ef0..131d4f6 100644
--- a/libcloud/storage/types.py
+++ b/libcloud/storage/types.py
@@ -37,6 +37,7 @@ class Provider(object):
     :cvar S3_EU_WEST: Amazon S3 EU West (Ireland)
     :cvar S3_AP_SOUTHEAST_HOST: Amazon S3 Asia South East (Singapore)
     :cvar S3_AP_NORTHEAST_HOST: Amazon S3 Asia South East (Tokyo)
+    :cvar S3_RGW_OUTSCALE: OUTSCALE RGW S3
     :cvar NINEFOLD: Ninefold
     :cvar GOOGLE_STORAGE Google Storage
     :cvar S3_US_WEST_OREGON: Amazon S3 US West 2 (Oregon)
@@ -54,6 +55,7 @@ class Provider(object):
     S3_AP_NORTHEAST1 = 's3_ap_northeast_1'
     S3_AP_NORTHEAST2 = 's3_ap_northeast_2'
     S3_SA_EAST = 's3_sa_east'
+    S3_RGW_OUTSCALE = 's3_rgw_outscale'
     NINEFOLD = 'ninefold'
     GOOGLE_STORAGE = 'google_storage'
     S3_US_WEST_OREGON = 's3_us_west_oregon'