notifier: simply notifier_strategy compat support

In order to handle the deprecated notifier_strategy configuration option
we just need to translate the notifier_strategy value as follows:

  default -> transport_url=None, driver='noop'
  noop -> transport_url=None, driver='noop'
  logging -> transport_url=None, driver='log'
  rabbit -> transport_url=rabbit:///, driver='messaging'
  qpid -> transport_url=qpid:///, driver='messaging'
  None -> transport_url=None, driver=None

where the last bit simply means that the user hasn't specified any
notifier_strategy and we should just have oslo.messaging load a notifier
based on oslo.messaging's config options.

It really doesn't need to be any more complicated than that, and we
certainly shouldn't need to poke at what the user may have configured
for transport_url in their config file.

The reason this is important is that CONF.transport_url is a private
configuration option which soon will not be visible to users of the
oslo.messaging API. See I9c3bf74f13a820ce295aa77a2bbcd781778b5926.

Also, simplify the testing of this stuff by mocking the oslo.messaging
APIs used and using the test scenarios outlined above. This also means
we stop poking around in oslo.messaging internals like:

       self.assertEqual(str(nfier._transport._driver._url),
                        'qpid:///')

Naughty, naughty!

Note: it's arguable we should just remove notifier_strategy in Juno
since we deprecated it in Icehouse, but this patch will be useful to
backport to stable/icehouse in any case.

Change-Id: I067248974baee50a2a0afb38bf022b65d1bea57a
Do not call configure several times at startup

At startup, Glance first creates the stores and then verifies
the default store. Each of these operations will indirectly
trigger the creation of store objects which is triggering configure
and configure_add calls.
configure and configure_add can potentially contain remote calls
going through the network: we should avoid having these methods
called two times for nothing.

This patch adds a parameter in the store init method to specify
if the configuration of the store should happen. In case of verify
default store, the configuration should not happen.

Closes-Bug: #1315237

Change-Id: I329730a3351cd7b78de27a88a7f669ae32b2f100
Fixes v2 return status on unauthorized download

If a user is not allowed to download an image because of a policy,
glance v2 API responds with a  HTTP 200 status and no data instead
of HTTP 403 for no cache only.
The problem is that get_data implementation for notification
proxy is a generator, this situation delays the other proxies
get_data calls (including the policy proxy) for the first time
data is retrieved.
Hence, there is a delay in enforcing policy, so 200 is sent before
the API gets the chance to catch the policy exception.

DocImpact
Closes-Bug: #1326781
Change-Id: I1e50a069a6b7f9eed7160cd5908a5fa30274e227
Merge "notifier: simply notifier_strategy compat support"
Merge "Fixes v2 return status on unauthorized download"