Example #1
0
    def __call__(self, env, start_response):
        if not plugin_enabled():
            return self.app(env, start_response)
        env['Gluster_enabled'] = True
        fs_object = getattr(plugins, self.fs_name, False)
        if not fs_object:
            raise Exception('%s plugin not found', self.fs_name)

        env['fs_object'] = fs_object()
        fs_conf = ConfigParser()
        if fs_conf.read('/etc/swift/fs.conf'):
            try:
                env['root'] = fs_conf.get('DEFAULT', 'mount_path')
            except NoSectionError, NoOptionError:
                self.logger.exception(_('ERROR mount_path not present'))
Example #2
0
    def __call__(self, env, start_response):
        if not plugin_enabled():
            return self.app(env, start_response)
        env['Gluster_enabled'] =True
        fs_object = getattr(plugins, self.fs_name, False)
        if not fs_object:
            raise Exception('%s plugin not found', self.fs_name)

        env['fs_object'] = fs_object()
        fs_conf = ConfigParser()
        if fs_conf.read('/etc/swift/fs.conf'):
            try:
                env['root'] = fs_conf.get ('DEFAULT', 'mount_path')
            except NoSectionError, NoOptionError:
                self.logger.exception(_('ERROR mount_path not present'))
Example #3
0
from eventlet import Timeout
from webob import Request, Response
from webob.exc import HTTPAccepted, HTTPBadRequest, \
    HTTPCreated, HTTPForbidden, HTTPInternalServerError, \
    HTTPMethodNotAllowed, HTTPNoContent, HTTPNotFound, \
    HTTPPreconditionFailed, HTTPConflict
import simplejson

from swift.common.db import AccountBroker
from swift.common.utils import get_logger, get_param, hash_path, \
    normalize_timestamp, split_path, storage_directory, plugin_enabled
from swift.common.constraints import ACCOUNT_LISTING_LIMIT, \
    check_mount, check_float, check_utf8
from swift.common.db_replicator import ReplicatorRpc
if plugin_enabled():
    from swift.plugins.DiskDir import DiskAccount

DATADIR = 'accounts'


class AccountController(object):
    """WSGI controller for the account server."""

    def __init__(self, conf):
        self.logger = get_logger(conf, log_route='account-server')
        self.root = conf.get('devices', '/srv/node')
        self.mount_check = conf.get('mount_check', 'true').lower() in \
                              ('true', 't', '1', 'on', 'yes', 'y')
        self.replicator_rpc = ReplicatorRpc(self.root, DATADIR, AccountBroker,
            self.mount_check, logger=self.logger)
Example #4
0
from eventlet import Timeout
from webob import Request, Response
from webob.exc import HTTPAccepted, HTTPBadRequest, HTTPConflict, \
    HTTPCreated, HTTPInternalServerError, HTTPNoContent, \
    HTTPNotFound, HTTPPreconditionFailed, HTTPMethodNotAllowed

from swift.common.db import ContainerBroker
from swift.common.utils import get_logger, get_param, hash_path, \
    normalize_timestamp, storage_directory, split_path, validate_sync_to, \
    plugin_enabled
from swift.common.constraints import CONTAINER_LISTING_LIMIT, \
    check_mount, check_float, check_utf8
from swift.common.bufferedhttp import http_connect
from swift.common.exceptions import ConnectionTimeout
from swift.common.db_replicator import ReplicatorRpc
if plugin_enabled():
    from swift.plugins.DiskDir import DiskDir
DATADIR = 'containers'

class ContainerController(object):
    """WSGI Controller for the container server."""

    # Ensure these are all lowercase
    save_headers = ['x-container-read', 'x-container-write',
                    'x-container-sync-key', 'x-container-sync-to']

    def __init__(self, conf):
        self.logger = get_logger(conf, log_route='container-server')
        self.root = conf.get('devices', '/srv/node/')
        self.mount_check = conf.get('mount_check', 'true').lower() in \
                              ('true', 't', '1', 'on', 'yes', 'y')