fix(shards): guard against registering bad shard URIs
Whenever an admin would attempt to register a new shard, the shard was
admitted whether or not the shard URI actually existed, and whether or
not marconi could handle shards of that type.
This patch makes it so that a DataDriver instance is temporarily
instantiated prior to storing the shard entry. This instance uses
is_alive() to determine whether or not the shard can be reached/is
supported. This applies to both PUT/PATCH. HTTP 400 is returned if the
registration fails, as a result.
To enable this change, the ability to create a dynamic configuration
object was extracted from sharding.Catalog. Tests were written for
this new function.
The unit tests were updated accordingly, expanding the coverage of
test_shards to include the new failure cases.
Some changes needed to be made to handle new oslo.cache interface:
- cache.unset doesn't exist - now using cache.unset_many
- cache.get_cache() takes a URI, not a ConfigOpts
Reviewed: https:/ /review. openstack. org/68267 /git.openstack. org/cgit/ openstack/ marconi/ commit/ ?id=280da9d054a 521652e9a3c6cb9 5001fed2985eab
Committed: https:/
Submitter: Jenkins
Branch: master
commit 280da9d054a5216 52e9a3c6cb95001 fed2985eab
Author: Alejandro Cabrera <email address hidden>
Date: Tue Jan 21 16:13:23 2014 -0500
fix(shards): guard against registering bad shard URIs
Whenever an admin would attempt to register a new shard, the shard was
admitted whether or not the shard URI actually existed, and whether or
not marconi could handle shards of that type.
This patch makes it so that a DataDriver instance is temporarily
instantiated prior to storing the shard entry. This instance uses
is_alive() to determine whether or not the shard can be reached/is
supported. This applies to both PUT/PATCH. HTTP 400 is returned if the
registration fails, as a result.
To enable this change, the ability to create a dynamic configuration
object was extracted from sharding.Catalog. Tests were written for
this new function.
The unit tests were updated accordingly, expanding the coverage of
test_shards to include the new failure cases.
Some changes needed to be made to handle new oslo.cache interface:
- cache.unset doesn't exist - now using cache.unset_many
- cache.get_cache() takes a URI, not a ConfigOpts
Change-Id: I40509f525466da 01baad2a5aef81c 7b99c8d2f97
Closes-Bug: #1258591
Closes-Bug: #1273376
Closes-Bug: #1273377