Merge "Remove per-service auto_create_account_prefix"
This commit is contained in:
commit
966340aeed
@ -179,8 +179,6 @@ Logging level. The default is INFO.
|
|||||||
Enables request logging. The default is True.
|
Enables request logging. The default is True.
|
||||||
.IP "\fBset log_address\fR
|
.IP "\fBset log_address\fR
|
||||||
Logging address. The default is /dev/log.
|
Logging address. The default is /dev/log.
|
||||||
.IP "\fBauto_create_account_prefix [deprecated]\fR"
|
|
||||||
The default is ".". Should be configured in swift.conf instead.
|
|
||||||
.IP "\fBreplication_server\fR
|
.IP "\fBreplication_server\fR
|
||||||
Configure parameter for creating specific server.
|
Configure parameter for creating specific server.
|
||||||
To handle all verbs, including replication verbs, do not specify
|
To handle all verbs, including replication verbs, do not specify
|
||||||
|
@ -191,8 +191,6 @@ Request timeout to external services. The default is 3 seconds.
|
|||||||
Connection timeout to external services. The default is 0.5 seconds.
|
Connection timeout to external services. The default is 0.5 seconds.
|
||||||
.IP \fBallow_versions\fR
|
.IP \fBallow_versions\fR
|
||||||
The default is false.
|
The default is false.
|
||||||
.IP "\fBauto_create_account_prefix [deprecated]\fR"
|
|
||||||
The default is '.'. Should be configured in swift.conf instead.
|
|
||||||
.IP \fBreplication_server\fR
|
.IP \fBreplication_server\fR
|
||||||
Configure parameter for creating specific server.
|
Configure parameter for creating specific server.
|
||||||
To handle all verbs, including replication verbs, do not specify
|
To handle all verbs, including replication verbs, do not specify
|
||||||
|
@ -202,8 +202,6 @@ This is normally \fBegg:swift#proxy_logging\fR. See proxy-server.conf-sample for
|
|||||||
.RS 3
|
.RS 3
|
||||||
.IP \fBinterval\fR
|
.IP \fBinterval\fR
|
||||||
Replaces run_pause with the more standard "interval", which means the replicator won't pause unless it takes less than the interval set. The default is 300.
|
Replaces run_pause with the more standard "interval", which means the replicator won't pause unless it takes less than the interval set. The default is 300.
|
||||||
.IP "\fBauto_create_account_prefix [deprecated]\fR"
|
|
||||||
The default is ".". Should be configured in swift.conf instead.
|
|
||||||
.IP \fBexpiring_objects_account_name\fR
|
.IP \fBexpiring_objects_account_name\fR
|
||||||
The default is 'expiring_objects'.
|
The default is 'expiring_objects'.
|
||||||
.IP \fBreport_interval\fR
|
.IP \fBreport_interval\fR
|
||||||
|
@ -220,8 +220,6 @@ On PUTs, sync data every n MB. The default is 512.
|
|||||||
Comma separated list of headers that can be set in metadata on an object.
|
Comma separated list of headers that can be set in metadata on an object.
|
||||||
This list is in addition to X-Object-Meta-* headers and cannot include Content-Type, etag, Content-Length, or deleted.
|
This list is in addition to X-Object-Meta-* headers and cannot include Content-Type, etag, Content-Length, or deleted.
|
||||||
The default is 'Content-Disposition, Content-Encoding, X-Delete-At, X-Object-Manifest, X-Static-Large-Object, Cache-Control, Content-Language, Expires, X-Robots-Tag'.
|
The default is 'Content-Disposition, Content-Encoding, X-Delete-At, X-Object-Manifest, X-Static-Large-Object, Cache-Control, Content-Language, Expires, X-Robots-Tag'.
|
||||||
.IP "\fBauto_create_account_prefix [deprecated]\fR"
|
|
||||||
The default is '.'. Should be configured in swift.conf instead.
|
|
||||||
.IP "\fBreplication_server\fR"
|
.IP "\fBreplication_server\fR"
|
||||||
Configure parameter for creating specific server
|
Configure parameter for creating specific server
|
||||||
To handle all verbs, including replication verbs, do not specify
|
To handle all verbs, including replication verbs, do not specify
|
||||||
|
@ -1037,9 +1037,6 @@ is false.
|
|||||||
.IP \fBaccount_autocreate\fR
|
.IP \fBaccount_autocreate\fR
|
||||||
If set to 'true' authorized accounts that do not yet exist within the Swift cluster
|
If set to 'true' authorized accounts that do not yet exist within the Swift cluster
|
||||||
will be automatically created. The default is set to false.
|
will be automatically created. The default is set to false.
|
||||||
.IP "\fBauto_create_account_prefix [deprecated]\fR"
|
|
||||||
Prefix used when automatically creating accounts. The default is '.'. Should
|
|
||||||
be configured in swift.conf instead.
|
|
||||||
.IP \fBmax_containers_per_account\fR
|
.IP \fBmax_containers_per_account\fR
|
||||||
If set to a positive value, trying to create a container when the account
|
If set to a positive value, trying to create a container when the account
|
||||||
already has at least this maximum containers will result in a 403 Forbidden.
|
already has at least this maximum containers will result in a 403 Forbidden.
|
||||||
|
@ -31,7 +31,5 @@ extra_header_count 0 By default the maximum number of allowed
|
|||||||
If for some reason this is not enough (custom
|
If for some reason this is not enough (custom
|
||||||
middleware for example) it can be increased
|
middleware for example) it can be increased
|
||||||
with the extra_header_count constraint.
|
with the extra_header_count constraint.
|
||||||
auto_create_account_prefix . Prefix used when automatically creating
|
|
||||||
accounts.
|
|
||||||
========================== ========== =============================================
|
========================== ========== =============================================
|
||||||
|
|
||||||
|
@ -85,17 +85,7 @@ class AccountController(BaseStorageServer):
|
|||||||
self.replicator_rpc = ReplicatorRpc(self.root, DATADIR, AccountBroker,
|
self.replicator_rpc = ReplicatorRpc(self.root, DATADIR, AccountBroker,
|
||||||
self.mount_check,
|
self.mount_check,
|
||||||
logger=self.logger)
|
logger=self.logger)
|
||||||
if conf.get('auto_create_account_prefix'):
|
self.auto_create_account_prefix = AUTO_CREATE_ACCOUNT_PREFIX
|
||||||
self.logger.warning('Option auto_create_account_prefix is '
|
|
||||||
'deprecated. Configure '
|
|
||||||
'auto_create_account_prefix under the '
|
|
||||||
'swift-constraints section of '
|
|
||||||
'swift.conf. This option will '
|
|
||||||
'be ignored in a future release.')
|
|
||||||
self.auto_create_account_prefix = \
|
|
||||||
conf['auto_create_account_prefix']
|
|
||||||
else:
|
|
||||||
self.auto_create_account_prefix = AUTO_CREATE_ACCOUNT_PREFIX
|
|
||||||
|
|
||||||
swift.common.db.DB_PREALLOCATION = \
|
swift.common.db.DB_PREALLOCATION = \
|
||||||
config_true_value(conf.get('db_preallocation', 'f'))
|
config_true_value(conf.get('db_preallocation', 'f'))
|
||||||
|
@ -1230,12 +1230,7 @@ class StaticLargeObject(object):
|
|||||||
delete_concurrency=delete_concurrency,
|
delete_concurrency=delete_concurrency,
|
||||||
logger=self.logger)
|
logger=self.logger)
|
||||||
|
|
||||||
# Need to know how to expire things to do async deletes
|
prefix = AUTO_CREATE_ACCOUNT_PREFIX
|
||||||
if conf.get('auto_create_account_prefix'):
|
|
||||||
# proxy app will log about how this should get moved to swift.conf
|
|
||||||
prefix = conf['auto_create_account_prefix']
|
|
||||||
else:
|
|
||||||
prefix = AUTO_CREATE_ACCOUNT_PREFIX
|
|
||||||
self.expiring_objects_account = prefix + (
|
self.expiring_objects_account = prefix + (
|
||||||
conf.get('expiring_objects_account_name') or 'expiring_objects')
|
conf.get('expiring_objects_account_name') or 'expiring_objects')
|
||||||
self.expiring_objects_container_divisor = int(
|
self.expiring_objects_container_divisor = int(
|
||||||
|
@ -141,17 +141,7 @@ class ContainerController(BaseStorageServer):
|
|||||||
self.replicator_rpc = ContainerReplicatorRpc(
|
self.replicator_rpc = ContainerReplicatorRpc(
|
||||||
self.root, DATADIR, ContainerBroker, self.mount_check,
|
self.root, DATADIR, ContainerBroker, self.mount_check,
|
||||||
logger=self.logger)
|
logger=self.logger)
|
||||||
if conf.get('auto_create_account_prefix'):
|
self.auto_create_account_prefix = AUTO_CREATE_ACCOUNT_PREFIX
|
||||||
self.logger.warning('Option auto_create_account_prefix is '
|
|
||||||
'deprecated. Configure '
|
|
||||||
'auto_create_account_prefix under the '
|
|
||||||
'swift-constraints section of '
|
|
||||||
'swift.conf. This option will '
|
|
||||||
'be ignored in a future release.')
|
|
||||||
self.auto_create_account_prefix = \
|
|
||||||
conf['auto_create_account_prefix']
|
|
||||||
else:
|
|
||||||
self.auto_create_account_prefix = AUTO_CREATE_ACCOUNT_PREFIX
|
|
||||||
self.shards_account_prefix = (
|
self.shards_account_prefix = (
|
||||||
self.auto_create_account_prefix + 'shards_')
|
self.auto_create_account_prefix + 'shards_')
|
||||||
if config_true_value(conf.get('allow_versions', 'f')):
|
if config_true_value(conf.get('allow_versions', 'f')):
|
||||||
|
@ -854,18 +854,7 @@ class ContainerSharder(ContainerSharderConf, ContainerReplicator):
|
|||||||
ContainerReplicator.__init__(self, conf, logger=logger)
|
ContainerReplicator.__init__(self, conf, logger=logger)
|
||||||
ContainerSharderConf.__init__(self, conf)
|
ContainerSharderConf.__init__(self, conf)
|
||||||
ContainerSharderConf.validate_conf(self)
|
ContainerSharderConf.validate_conf(self)
|
||||||
if conf.get('auto_create_account_prefix'):
|
self.shards_account_prefix = (AUTO_CREATE_ACCOUNT_PREFIX + 'shards_')
|
||||||
self.logger.warning('Option auto_create_account_prefix is '
|
|
||||||
'deprecated. Configure '
|
|
||||||
'auto_create_account_prefix under the '
|
|
||||||
'swift-constraints section of '
|
|
||||||
'swift.conf. This option will '
|
|
||||||
'be ignored in a future release.')
|
|
||||||
auto_create_account_prefix = \
|
|
||||||
self.conf['auto_create_account_prefix']
|
|
||||||
else:
|
|
||||||
auto_create_account_prefix = AUTO_CREATE_ACCOUNT_PREFIX
|
|
||||||
self.shards_account_prefix = (auto_create_account_prefix + 'shards_')
|
|
||||||
self.sharding_candidates = []
|
self.sharding_candidates = []
|
||||||
self.shrinking_candidates = []
|
self.shrinking_candidates = []
|
||||||
replica_count = self.ring.replica_count
|
replica_count = self.ring.replica_count
|
||||||
|
@ -114,19 +114,7 @@ class ObjectExpirer(Daemon):
|
|||||||
self.reclaim_age = int(conf.get('reclaim_age', 604800))
|
self.reclaim_age = int(conf.get('reclaim_age', 604800))
|
||||||
|
|
||||||
def read_conf_for_queue_access(self, swift):
|
def read_conf_for_queue_access(self, swift):
|
||||||
if self.conf.get('auto_create_account_prefix'):
|
self.expiring_objects_account = AUTO_CREATE_ACCOUNT_PREFIX + \
|
||||||
self.logger.warning('Option auto_create_account_prefix is '
|
|
||||||
'deprecated. Configure '
|
|
||||||
'auto_create_account_prefix under the '
|
|
||||||
'swift-constraints section of '
|
|
||||||
'swift.conf. This option will '
|
|
||||||
'be ignored in a future release.')
|
|
||||||
auto_create_account_prefix = \
|
|
||||||
self.conf['auto_create_account_prefix']
|
|
||||||
else:
|
|
||||||
auto_create_account_prefix = AUTO_CREATE_ACCOUNT_PREFIX
|
|
||||||
|
|
||||||
self.expiring_objects_account = auto_create_account_prefix + \
|
|
||||||
(self.conf.get('expiring_objects_account_name') or
|
(self.conf.get('expiring_objects_account_name') or
|
||||||
'expiring_objects')
|
'expiring_objects')
|
||||||
|
|
||||||
|
@ -173,18 +173,8 @@ class ObjectController(BaseStorageServer):
|
|||||||
for header in extra_allowed_headers:
|
for header in extra_allowed_headers:
|
||||||
if header not in RESERVED_DATAFILE_META:
|
if header not in RESERVED_DATAFILE_META:
|
||||||
self.allowed_headers.add(header)
|
self.allowed_headers.add(header)
|
||||||
if conf.get('auto_create_account_prefix'):
|
|
||||||
self.logger.warning('Option auto_create_account_prefix is '
|
|
||||||
'deprecated. Configure '
|
|
||||||
'auto_create_account_prefix under the '
|
|
||||||
'swift-constraints section of '
|
|
||||||
'swift.conf. This option will '
|
|
||||||
'be ignored in a future release.')
|
|
||||||
self.auto_create_account_prefix = \
|
|
||||||
conf['auto_create_account_prefix']
|
|
||||||
else:
|
|
||||||
self.auto_create_account_prefix = AUTO_CREATE_ACCOUNT_PREFIX
|
|
||||||
|
|
||||||
|
self.auto_create_account_prefix = AUTO_CREATE_ACCOUNT_PREFIX
|
||||||
self.expiring_objects_account = self.auto_create_account_prefix + \
|
self.expiring_objects_account = self.auto_create_account_prefix + \
|
||||||
(conf.get('expiring_objects_account_name') or 'expiring_objects')
|
(conf.get('expiring_objects_account_name') or 'expiring_objects')
|
||||||
self.expiring_objects_container_divisor = \
|
self.expiring_objects_container_divisor = \
|
||||||
|
@ -480,8 +480,7 @@ def get_container_info(env, app, swift_source=None, cache_only=False):
|
|||||||
# account is successful whether the account actually has .db files
|
# account is successful whether the account actually has .db files
|
||||||
# on disk or not.
|
# on disk or not.
|
||||||
is_autocreate_account = account.startswith(
|
is_autocreate_account = account.startswith(
|
||||||
getattr(proxy_app, 'auto_create_account_prefix',
|
constraints.AUTO_CREATE_ACCOUNT_PREFIX)
|
||||||
constraints.AUTO_CREATE_ACCOUNT_PREFIX))
|
|
||||||
if not is_autocreate_account:
|
if not is_autocreate_account:
|
||||||
account_info = get_account_info(env, logged_app, swift_source)
|
account_info = get_account_info(env, logged_app, swift_source)
|
||||||
if not account_info or not is_success(account_info['status']):
|
if not account_info or not is_success(account_info['status']):
|
||||||
|
@ -260,18 +260,8 @@ class Application(object):
|
|||||||
[os.path.join(swift_dir, 'mime.types')])
|
[os.path.join(swift_dir, 'mime.types')])
|
||||||
self.account_autocreate = \
|
self.account_autocreate = \
|
||||||
config_true_value(conf.get('account_autocreate', 'no'))
|
config_true_value(conf.get('account_autocreate', 'no'))
|
||||||
if conf.get('auto_create_account_prefix'):
|
self.auto_create_account_prefix = \
|
||||||
self.logger.warning('Option auto_create_account_prefix is '
|
constraints.AUTO_CREATE_ACCOUNT_PREFIX
|
||||||
'deprecated. Configure '
|
|
||||||
'auto_create_account_prefix under the '
|
|
||||||
'swift-constraints section of '
|
|
||||||
'swift.conf. This option will '
|
|
||||||
'be ignored in a future release.')
|
|
||||||
self.auto_create_account_prefix = \
|
|
||||||
conf['auto_create_account_prefix']
|
|
||||||
else:
|
|
||||||
self.auto_create_account_prefix = \
|
|
||||||
constraints.AUTO_CREATE_ACCOUNT_PREFIX
|
|
||||||
self.expiring_objects_account = self.auto_create_account_prefix + \
|
self.expiring_objects_account = self.auto_create_account_prefix + \
|
||||||
(conf.get('expiring_objects_account_name') or 'expiring_objects')
|
(conf.get('expiring_objects_account_name') or 'expiring_objects')
|
||||||
self.expiring_objects_container_divisor = \
|
self.expiring_objects_container_divisor = \
|
||||||
|
@ -71,14 +71,6 @@ class TestAccountController(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
AccountController(conf, logger=self.logger)
|
AccountController(conf, logger=self.logger)
|
||||||
self.assertEqual(self.logger.get_lines_for_level('warning'), [])
|
self.assertEqual(self.logger.get_lines_for_level('warning'), [])
|
||||||
conf['auto_create_account_prefix'] = '-'
|
|
||||||
AccountController(conf, logger=self.logger)
|
|
||||||
self.assertEqual(self.logger.get_lines_for_level('warning'), [
|
|
||||||
'Option auto_create_account_prefix is deprecated. '
|
|
||||||
'Configure auto_create_account_prefix under the '
|
|
||||||
'swift-constraints section of swift.conf. This option '
|
|
||||||
'will be ignored in a future release.'
|
|
||||||
])
|
|
||||||
|
|
||||||
def test_OPTIONS(self):
|
def test_OPTIONS(self):
|
||||||
server_handler = AccountController(
|
server_handler = AccountController(
|
||||||
|
@ -239,7 +239,6 @@ class TestInternalClient(unittest.TestCase):
|
|||||||
|
|
||||||
[app:proxy-server]
|
[app:proxy-server]
|
||||||
use = egg:swift#proxy
|
use = egg:swift#proxy
|
||||||
auto_create_account_prefix = -
|
|
||||||
|
|
||||||
[filter:cache]
|
[filter:cache]
|
||||||
use = egg:swift#memcache
|
use = egg:swift#memcache
|
||||||
@ -261,11 +260,6 @@ class TestInternalClient(unittest.TestCase):
|
|||||||
with mock.patch('swift.proxy.server.get_logger',
|
with mock.patch('swift.proxy.server.get_logger',
|
||||||
lambda *a, **kw: logger):
|
lambda *a, **kw: logger):
|
||||||
client = internal_client.InternalClient(conf_path, 'test', 1)
|
client = internal_client.InternalClient(conf_path, 'test', 1)
|
||||||
self.assertEqual(logger.get_lines_for_level('warning'), [
|
|
||||||
'Option auto_create_account_prefix is deprecated. '
|
|
||||||
'Configure auto_create_account_prefix under the '
|
|
||||||
'swift-constraints section of swift.conf. This option will '
|
|
||||||
'be ignored in a future release.'])
|
|
||||||
self.assertEqual(client.account_ring,
|
self.assertEqual(client.account_ring,
|
||||||
client.app.app.app.account_ring)
|
client.app.app.app.account_ring)
|
||||||
self.assertEqual(client.account_ring.serialized_path,
|
self.assertEqual(client.account_ring.serialized_path,
|
||||||
@ -279,7 +273,6 @@ class TestInternalClient(unittest.TestCase):
|
|||||||
object_ring)
|
object_ring)
|
||||||
self.assertEqual(object_ring.serialized_path,
|
self.assertEqual(object_ring.serialized_path,
|
||||||
object_ring_path)
|
object_ring_path)
|
||||||
self.assertEqual(client.auto_create_account_prefix, '-')
|
|
||||||
|
|
||||||
@mock.patch('swift.common.utils.HASH_PATH_SUFFIX', new=b'endcap')
|
@mock.patch('swift.common.utils.HASH_PATH_SUFFIX', new=b'endcap')
|
||||||
@with_tempdir
|
@with_tempdir
|
||||||
@ -303,7 +296,6 @@ class TestInternalClient(unittest.TestCase):
|
|||||||
|
|
||||||
[app:proxy-server]
|
[app:proxy-server]
|
||||||
use = egg:swift#proxy
|
use = egg:swift#proxy
|
||||||
auto_create_account_prefix = -
|
|
||||||
|
|
||||||
[filter:cache]
|
[filter:cache]
|
||||||
use = egg:swift#memcache
|
use = egg:swift#memcache
|
||||||
@ -332,7 +324,6 @@ class TestInternalClient(unittest.TestCase):
|
|||||||
|
|
||||||
[app:proxy-server]
|
[app:proxy-server]
|
||||||
use = egg:swift#proxy
|
use = egg:swift#proxy
|
||||||
auto_create_account_prefix = -
|
|
||||||
|
|
||||||
[filter:cache]
|
[filter:cache]
|
||||||
use = egg:swift#memcache
|
use = egg:swift#memcache
|
||||||
@ -361,7 +352,6 @@ class TestInternalClient(unittest.TestCase):
|
|||||||
|
|
||||||
[app:proxy-server]
|
[app:proxy-server]
|
||||||
use = egg:swift#proxy
|
use = egg:swift#proxy
|
||||||
auto_create_account_prefix = -
|
|
||||||
|
|
||||||
[filter:cache]
|
[filter:cache]
|
||||||
use = egg:swift#memcache
|
use = egg:swift#memcache
|
||||||
|
@ -121,14 +121,6 @@ class TestContainerController(unittest.TestCase):
|
|||||||
{'node_timeout': '3.5'}, logger=self.logger)
|
{'node_timeout': '3.5'}, logger=self.logger)
|
||||||
self.assertEqual(app.node_timeout, 3.5)
|
self.assertEqual(app.node_timeout, 3.5)
|
||||||
self.assertEqual(self.logger.get_lines_for_level('warning'), [])
|
self.assertEqual(self.logger.get_lines_for_level('warning'), [])
|
||||||
app = container_server.ContainerController(
|
|
||||||
{'auto_create_account_prefix': '-'}, logger=self.logger)
|
|
||||||
self.assertEqual(self.logger.get_lines_for_level('warning'), [
|
|
||||||
'Option auto_create_account_prefix is deprecated. '
|
|
||||||
'Configure auto_create_account_prefix under the '
|
|
||||||
'swift-constraints section of swift.conf. This option '
|
|
||||||
'will be ignored in a future release.'
|
|
||||||
])
|
|
||||||
|
|
||||||
def test_get_and_validate_policy_index(self):
|
def test_get_and_validate_policy_index(self):
|
||||||
# no policy is OK
|
# no policy is OK
|
||||||
|
@ -205,6 +205,7 @@ class TestSharder(BaseTestSharder):
|
|||||||
'/etc/swift/internal-client.conf', 'Swift Container Sharder', 3,
|
'/etc/swift/internal-client.conf', 'Swift Container Sharder', 3,
|
||||||
use_replication_network=True,
|
use_replication_network=True,
|
||||||
global_conf={'log_name': 'container-sharder-ic'})
|
global_conf={'log_name': 'container-sharder-ic'})
|
||||||
|
self.assertEqual(self.logger.get_lines_for_level('warning'), [])
|
||||||
|
|
||||||
# non-default shard_container_threshold influences other defaults
|
# non-default shard_container_threshold influences other defaults
|
||||||
conf = {'shard_container_threshold': 20000000}
|
conf = {'shard_container_threshold': 20000000}
|
||||||
@ -219,6 +220,7 @@ class TestSharder(BaseTestSharder):
|
|||||||
'/etc/swift/internal-client.conf', 'Swift Container Sharder', 3,
|
'/etc/swift/internal-client.conf', 'Swift Container Sharder', 3,
|
||||||
use_replication_network=True,
|
use_replication_network=True,
|
||||||
global_conf={'log_name': 'container-sharder-ic'})
|
global_conf={'log_name': 'container-sharder-ic'})
|
||||||
|
self.assertEqual(self.logger.get_lines_for_level('warning'), [])
|
||||||
|
|
||||||
# non-default values
|
# non-default values
|
||||||
conf = {
|
conf = {
|
||||||
@ -238,7 +240,6 @@ class TestSharder(BaseTestSharder):
|
|||||||
'request_tries': 2,
|
'request_tries': 2,
|
||||||
'internal_client_conf_path': '/etc/swift/my-sharder-ic.conf',
|
'internal_client_conf_path': '/etc/swift/my-sharder-ic.conf',
|
||||||
'recon_cache_path': '/var/cache/swift-alt',
|
'recon_cache_path': '/var/cache/swift-alt',
|
||||||
'auto_create_account_prefix': '...',
|
|
||||||
'auto_shard': 'yes',
|
'auto_shard': 'yes',
|
||||||
'recon_candidates_limit': 10,
|
'recon_candidates_limit': 10,
|
||||||
'recon_sharded_timeout': 7200,
|
'recon_sharded_timeout': 7200,
|
||||||
@ -265,7 +266,7 @@ class TestSharder(BaseTestSharder):
|
|||||||
'cleave_batch_size': 4,
|
'cleave_batch_size': 4,
|
||||||
'shard_scanner_batch_size': 8,
|
'shard_scanner_batch_size': 8,
|
||||||
'rcache': '/var/cache/swift-alt/container.recon',
|
'rcache': '/var/cache/swift-alt/container.recon',
|
||||||
'shards_account_prefix': '...shards_',
|
'shards_account_prefix': '.shards_',
|
||||||
'auto_shard': True,
|
'auto_shard': True,
|
||||||
'recon_candidates_limit': 10,
|
'recon_candidates_limit': 10,
|
||||||
'recon_sharded_timeout': 7200,
|
'recon_sharded_timeout': 7200,
|
||||||
@ -280,24 +281,14 @@ class TestSharder(BaseTestSharder):
|
|||||||
'/etc/swift/my-sharder-ic.conf', 'Swift Container Sharder', 2,
|
'/etc/swift/my-sharder-ic.conf', 'Swift Container Sharder', 2,
|
||||||
use_replication_network=True,
|
use_replication_network=True,
|
||||||
global_conf={'log_name': 'container-sharder-ic'})
|
global_conf={'log_name': 'container-sharder-ic'})
|
||||||
self.assertEqual(self.logger.get_lines_for_level('warning'), [
|
self.assertEqual(self.logger.get_lines_for_level('warning'), [])
|
||||||
'Option auto_create_account_prefix is deprecated. '
|
|
||||||
'Configure auto_create_account_prefix under the '
|
|
||||||
'swift-constraints section of swift.conf. This option '
|
|
||||||
'will be ignored in a future release.'])
|
|
||||||
|
|
||||||
expected.update({'shard_replication_quorum': 3,
|
expected.update({'shard_replication_quorum': 3,
|
||||||
'existing_shard_replication_quorum': 3})
|
'existing_shard_replication_quorum': 3})
|
||||||
conf.update({'shard_replication_quorum': 4,
|
conf.update({'shard_replication_quorum': 4,
|
||||||
'existing_shard_replication_quorum': 4})
|
'existing_shard_replication_quorum': 4})
|
||||||
self._do_test_init(conf, expected)
|
self._do_test_init(conf, expected)
|
||||||
warnings = self.logger.get_lines_for_level('warning')
|
self.assertEqual(self.logger.get_lines_for_level('warning'), [
|
||||||
self.assertEqual(warnings[:1], [
|
|
||||||
'Option auto_create_account_prefix is deprecated. '
|
|
||||||
'Configure auto_create_account_prefix under the '
|
|
||||||
'swift-constraints section of swift.conf. This option '
|
|
||||||
'will be ignored in a future release.'])
|
|
||||||
self.assertEqual(warnings[1:], [
|
|
||||||
'shard_replication_quorum of 4 exceeds replica count 3, '
|
'shard_replication_quorum of 4 exceeds replica count 3, '
|
||||||
'reducing to 3',
|
'reducing to 3',
|
||||||
'existing_shard_replication_quorum of 4 exceeds replica count 3, '
|
'existing_shard_replication_quorum of 4 exceeds replica count 3, '
|
||||||
@ -5098,10 +5089,10 @@ class TestSharder(BaseTestSharder):
|
|||||||
self.assertEqual(2, len(broker.get_shard_ranges()))
|
self.assertEqual(2, len(broker.get_shard_ranges()))
|
||||||
expected_ranges = [
|
expected_ranges = [
|
||||||
ShardRange(
|
ShardRange(
|
||||||
ShardRange.make_path('.int_shards_a', 'c', cont, now, 0),
|
ShardRange.make_path('.shards_a', 'c', cont, now, 0),
|
||||||
now, lower, objects[98][0], 99),
|
now, lower, objects[98][0], 99),
|
||||||
ShardRange(
|
ShardRange(
|
||||||
ShardRange.make_path('.int_shards_a', 'c', cont, now, 1),
|
ShardRange.make_path('.shards_a', 'c', cont, now, 1),
|
||||||
now, objects[98][0], upper, 1),
|
now, objects[98][0], upper, 1),
|
||||||
]
|
]
|
||||||
self._assert_shard_ranges_equal(expected_ranges,
|
self._assert_shard_ranges_equal(expected_ranges,
|
||||||
@ -5112,8 +5103,7 @@ class TestSharder(BaseTestSharder):
|
|||||||
account, cont, lower, upper)
|
account, cont, lower, upper)
|
||||||
with self._mock_sharder(conf={'shard_container_threshold': 199,
|
with self._mock_sharder(conf={'shard_container_threshold': 199,
|
||||||
'minimum_shard_size': 1,
|
'minimum_shard_size': 1,
|
||||||
'shrink_threshold': 0,
|
'shrink_threshold': 0}
|
||||||
'auto_create_account_prefix': '.int_'}
|
|
||||||
) as sharder:
|
) as sharder:
|
||||||
with mock_timestamp_now() as now:
|
with mock_timestamp_now() as now:
|
||||||
num_found = sharder._find_shard_ranges(broker)
|
num_found = sharder._find_shard_ranges(broker)
|
||||||
@ -5129,8 +5119,7 @@ class TestSharder(BaseTestSharder):
|
|||||||
# second invocation finds none
|
# second invocation finds none
|
||||||
with self._mock_sharder(conf={'shard_container_threshold': 199,
|
with self._mock_sharder(conf={'shard_container_threshold': 199,
|
||||||
'minimum_shard_size': 1,
|
'minimum_shard_size': 1,
|
||||||
'shrink_threshold': 0,
|
'shrink_threshold': 0}
|
||||||
'auto_create_account_prefix': '.int_'}
|
|
||||||
) as sharder:
|
) as sharder:
|
||||||
num_found = sharder._find_shard_ranges(broker)
|
num_found = sharder._find_shard_ranges(broker)
|
||||||
self.assertEqual(0, num_found)
|
self.assertEqual(0, num_found)
|
||||||
@ -5201,10 +5190,10 @@ class TestSharder(BaseTestSharder):
|
|||||||
self.assertEqual(2, len(broker.get_shard_ranges()))
|
self.assertEqual(2, len(broker.get_shard_ranges()))
|
||||||
expected_ranges = [
|
expected_ranges = [
|
||||||
ShardRange(
|
ShardRange(
|
||||||
ShardRange.make_path('.int_shards_a', 'c', cont, now, 0),
|
ShardRange.make_path('.shards_a', 'c', cont, now, 0),
|
||||||
now, lower, objects[98][0], 99),
|
now, lower, objects[98][0], 99),
|
||||||
ShardRange(
|
ShardRange(
|
||||||
ShardRange.make_path('.int_shards_a', 'c', cont, now, 1),
|
ShardRange.make_path('.shards_a', 'c', cont, now, 1),
|
||||||
now, objects[98][0], upper, 1),
|
now, objects[98][0], upper, 1),
|
||||||
]
|
]
|
||||||
self._assert_shard_ranges_equal(expected_ranges,
|
self._assert_shard_ranges_equal(expected_ranges,
|
||||||
@ -5215,8 +5204,7 @@ class TestSharder(BaseTestSharder):
|
|||||||
account, cont, lower, upper)
|
account, cont, lower, upper)
|
||||||
with self._mock_sharder(conf={'shard_container_threshold': 199,
|
with self._mock_sharder(conf={'shard_container_threshold': 199,
|
||||||
'minimum_shard_size': 1,
|
'minimum_shard_size': 1,
|
||||||
'shrink_threshold': 0,
|
'shrink_threshold': 0},
|
||||||
'auto_create_account_prefix': '.int_'}
|
|
||||||
) as sharder:
|
) as sharder:
|
||||||
with mock_timestamp_now() as now:
|
with mock_timestamp_now() as now:
|
||||||
num_found = sharder._find_shard_ranges(broker)
|
num_found = sharder._find_shard_ranges(broker)
|
||||||
@ -5230,8 +5218,7 @@ class TestSharder(BaseTestSharder):
|
|||||||
self.assertGreaterEqual(stats['max_time'], stats['min_time'])
|
self.assertGreaterEqual(stats['max_time'], stats['min_time'])
|
||||||
|
|
||||||
# second invocation finds none
|
# second invocation finds none
|
||||||
with self._mock_sharder(conf={'shard_container_threshold': 199,
|
with self._mock_sharder(conf={'shard_container_threshold': 199}
|
||||||
'auto_create_account_prefix': '.int_'}
|
|
||||||
) as sharder:
|
) as sharder:
|
||||||
num_found = sharder._find_shard_ranges(broker)
|
num_found = sharder._find_shard_ranges(broker)
|
||||||
self.assertEqual(0, num_found)
|
self.assertEqual(0, num_found)
|
||||||
|
@ -178,16 +178,6 @@ class TestObjectExpirer(TestCase):
|
|||||||
self.assertEqual(x.expiring_objects_account, '.expiring_objects')
|
self.assertEqual(x.expiring_objects_account, '.expiring_objects')
|
||||||
self.assertIs(x.swift, self.fake_swift)
|
self.assertIs(x.swift, self.fake_swift)
|
||||||
|
|
||||||
x = expirer.ObjectExpirer({'auto_create_account_prefix': '-'},
|
|
||||||
logger=self.logger, swift=self.fake_swift)
|
|
||||||
self.assertEqual(self.logger.get_lines_for_level('warning'), [
|
|
||||||
'Option auto_create_account_prefix is deprecated. '
|
|
||||||
'Configure auto_create_account_prefix under the '
|
|
||||||
'swift-constraints section of swift.conf. This option '
|
|
||||||
'will be ignored in a future release.'
|
|
||||||
])
|
|
||||||
self.assertEqual(x.expiring_objects_account, '-expiring_objects')
|
|
||||||
|
|
||||||
def test_init_internal_client_log_name(self):
|
def test_init_internal_client_log_name(self):
|
||||||
def _do_test_init_ic_log_name(conf, exp_internal_client_log_name):
|
def _do_test_init_ic_log_name(conf, exp_internal_client_log_name):
|
||||||
with mock.patch(
|
with mock.patch(
|
||||||
|
@ -186,16 +186,6 @@ class TestObjectController(BaseTestCase):
|
|||||||
self.assertEqual(app.auto_create_account_prefix, '.')
|
self.assertEqual(app.auto_create_account_prefix, '.')
|
||||||
self.assertEqual(self.logger.get_lines_for_level('warning'), [])
|
self.assertEqual(self.logger.get_lines_for_level('warning'), [])
|
||||||
|
|
||||||
conf['auto_create_account_prefix'] = '-'
|
|
||||||
app = object_server.ObjectController(conf, logger=self.logger)
|
|
||||||
self.assertEqual(app.auto_create_account_prefix, '-')
|
|
||||||
self.assertEqual(self.logger.get_lines_for_level('warning'), [
|
|
||||||
'Option auto_create_account_prefix is deprecated. '
|
|
||||||
'Configure auto_create_account_prefix under the '
|
|
||||||
'swift-constraints section of swift.conf. This option '
|
|
||||||
'will be ignored in a future release.'
|
|
||||||
])
|
|
||||||
|
|
||||||
def check_all_api_methods(self, obj_name='o', alt_res=None):
|
def check_all_api_methods(self, obj_name='o', alt_res=None):
|
||||||
path = '/sda1/p/a/c/%s' % obj_name
|
path = '/sda1/p/a/c/%s' % obj_name
|
||||||
body = b'SPECIAL_STRING'
|
body = b'SPECIAL_STRING'
|
||||||
|
@ -593,15 +593,6 @@ class TestProxyServerConfiguration(unittest.TestCase):
|
|||||||
self.assertEqual(app.auto_create_account_prefix, '.')
|
self.assertEqual(app.auto_create_account_prefix, '.')
|
||||||
self.assertEqual(self.logger.get_lines_for_level('warning'), [])
|
self.assertEqual(self.logger.get_lines_for_level('warning'), [])
|
||||||
|
|
||||||
app = self._make_app({'auto_create_account_prefix': '-'})
|
|
||||||
self.assertEqual(app.auto_create_account_prefix, '-')
|
|
||||||
self.assertEqual(self.logger.get_lines_for_level('warning'), [
|
|
||||||
'Option auto_create_account_prefix is deprecated. '
|
|
||||||
'Configure auto_create_account_prefix under the '
|
|
||||||
'swift-constraints section of swift.conf. This option '
|
|
||||||
'will be ignored in a future release.'
|
|
||||||
])
|
|
||||||
|
|
||||||
def test_node_timeout(self):
|
def test_node_timeout(self):
|
||||||
# later config should be extended to assert more config options
|
# later config should be extended to assert more config options
|
||||||
app = self._make_app({'node_timeout': '3.5',
|
app = self._make_app({'node_timeout': '3.5',
|
||||||
|
Loading…
Reference in New Issue
Block a user