Last active
March 16, 2017 01:20
-
-
Save naototty/8f40a53f82e130f1a1f4 to your computer and use it in GitHub Desktop.
ConoHaのVMでUbuntu 14.04を使ってs3qlでSwift Object Storageをマウントする ref: http://qiita.com/naoto_gohko/items/e8b662ae9e19fc1c859a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
backends/__init__.py - this file is part of S3QL. | |
Copyright © 2008 Nikolaus Rath <Nikolaus@rath.org> | |
This work can be distributed under the terms of the GNU GPLv3. | |
''' | |
from . import local, s3, gs, s3c, swift, rackspace, swiftks, conohaswift | |
#: Mapping from storage URL prefixes to backend classes | |
prefix_map = { 's3': s3.Backend, | |
'local': local.Backend, | |
'gs': gs.Backend, | |
's3c': s3c.Backend, | |
'swift': swift.Backend, | |
'conohaswift': conohaswift.Backend, | |
'swiftks': swiftks.Backend, | |
'rackspace': rackspace.Backend } | |
__all__ = [ 'common', 'pool', 'comprenc' ] + list(prefix_map.keys()) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
conohaswift.py - this file is part of S3QL. | |
Copyright © 215 n-gohko | |
This work can be distributed under the terms of the GNU GPLv3. | |
''' | |
from ..logging import logging, QuietError # Ensure use of custom logger class | |
from . import swiftks | |
from ..inherit_docstrings import copy_ancestor_docstring | |
import re | |
log = logging.getLogger(__name__) | |
class Backend(swiftks.Backend): | |
"""A backend to store data in ConoHa swift Object Storage""" | |
@copy_ancestor_docstring | |
def _parse_storage_url(self, storage_url, ssl_context): | |
hit = re.match(r'^conohaswift://' # Backend | |
r'([^/:]+)' # Region | |
r'/([^/]+)' # Bucketname | |
r'(?:/(.*))?$', # Prefix | |
storage_url) | |
if not hit: | |
raise QuietError('Invalid storage URL', exitcode=2) | |
region = hit.group(1) | |
containername = hit.group(2) | |
prefix = hit.group(3) or '' | |
if ssl_context: | |
port = 443 | |
else: | |
port = 80 | |
port = 443 | |
self.hostname = 'identity.tyo1.conoha.io' | |
self.port = port | |
self.container_name = containername | |
self.prefix = prefix | |
self.region = region | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[n-gohko@163-44-112-214] $ swift list --lh s3ql_pool 2>/dev/null | grep '_data_' | head -n 3 | |
116 2015-12-13 12:55:30 s3ql_data_1 | |
746K 2015-12-13 12:55:35 s3ql_data_10 | |
79K 2015-12-13 12:56:36 s3ql_data_100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment