Allow cinderv2 endpoints within the request context catalog

This partially reverts commit a03976ee89.

During a P to Q upgrade it is common to have the control services
upgraded to Q ahead of the computes. During this time the Q n-api
services will provide request contexts over the wire to these P computes
where the service catalog held within does not contain any cinderv2 type
endpoints, as cinderv2 support has been removed from Nova in Q.

This becomes a problem if the P computes are specifically looking for a
cinderv2 type endpoint via [cinder]catalog_info within nova.conf.  For
example with TripleO deployed Pike environments this has a default value
of 'volumev2:cinderv2:internalURL'.

This change ensures cinderv2 type endpoints are still provided by Queens
n-api control services to Pike computes during an upgrade. This is only
required on stable/queens as we only support N-1 running computes during
an upgrade and so we don't need to land anything in R to support P
computes.

Closes-bug: #1775075
Change-Id: I45299df2bf095c12bfce5b1ac3e5460a11dd0131
This commit is contained in:
Lee Yarwood 2018-06-04 22:12:18 +01:00
parent 5a92a3393e
commit c7d87f6691
2 changed files with 9 additions and 2 deletions

View File

@ -117,9 +117,14 @@ class RequestContext(context.RequestContext):
if service_catalog:
# Only include required parts of service_catalog
# NOTE(lyarwood): While volumev2 is no longer supported with Queens
# we still provide it as part of the service catalog as the request
# context may end up being sent over the wire to a Pike compute
# that is specifically looking for a cinderv2 type via catalog_info
self.service_catalog = [s for s in service_catalog
if s.get('type') in ('image', 'block-storage', 'volumev3',
'key-manager', 'placement', 'network')]
if s.get('type') in ('image', 'block-storage', 'volumev2',
'volumev3', 'key-manager', 'placement',
'network')]
else:
# if list is empty or none
self.service_catalog = []

View File

@ -102,6 +102,7 @@ class ContextTestCase(test.NoDBTestCase):
{u'type': u'compute', u'name': u'nova'},
{u'type': u's3', u'name': u's3'},
{u'type': u'image', u'name': u'glance'},
{u'type': u'volumev2', u'name': u'cinderv2'},
{u'type': u'volumev3', u'name': u'cinderv3'},
{u'type': u'network', u'name': u'neutron'},
{u'type': u'ec2', u'name': u'ec2'},
@ -112,6 +113,7 @@ class ContextTestCase(test.NoDBTestCase):
{u'type': u'vo', u'name': u'S_partofvolume'}]
volume_catalog = [{u'type': u'image', u'name': u'glance'},
{u'type': u'volumev2', u'name': u'cinderv2'},
{u'type': u'volumev3', u'name': u'cinderv3'},
{u'type': u'network', u'name': u'neutron'},
{u'type': u'block-storage', u'name': u'cinder'}]