Support secondary services

The data now allows marking a service as secondary to support
placement/compute in nova. Support that in by_project.

Adds placement to the built-in data so that we can see the testing of
it. We should not approve this patch until approving the Add placement
service patch.

Change-Id: I01ad2934bdcb9346f4af88520f572d9b4f852b5d
This commit is contained in:
Monty Taylor 2017-08-12 13:17:49 -05:00 committed by Eric Fried
parent 7980f17df9
commit 3e8e86bdb5
3 changed files with 103 additions and 77 deletions

View File

@ -1,13 +1,9 @@
{ {
"forward": { "forward": {
"message": [ "block-storage": [
"messaging" "volumev3",
], "volumev2",
"root-cause-analysis": [ "volume"
"rca"
],
"application-deployment": [
"application_deployment"
], ],
"multi-region-network-automation": [ "multi-region-network-automation": [
"tricircle" "tricircle"
@ -15,41 +11,45 @@
"container-infrastructure-management": [ "container-infrastructure-management": [
"container-infrastructure" "container-infrastructure"
], ],
"meter": [ "workflow": [
"metering" "workflowv2"
], ],
"shared-file-system": [ "shared-file-system": [
"sharev2", "sharev2",
"share" "share"
], ],
"operator-policy": [
"policy"
],
"application-container": [
"container"
],
"block-storage": [
"volumev3",
"volumev2",
"volume"
],
"alarm": [ "alarm": [
"alarming" "alarming"
], ],
"meter": [
"metering"
],
"root-cause-analysis": [
"rca"
],
"monitoring-logging": [ "monitoring-logging": [
"monitoring-log-api" "monitoring-log-api"
], ],
"workflow": [ "resource-optimization": [
"workflowv2" "infra-optim"
],
"event": [
"events"
], ],
"resource-cluster": [ "resource-cluster": [
"clustering" "clustering"
], ],
"resource-optimization": [ "application-container": [
"infra-optim" "container"
],
"message": [
"messaging"
],
"event": [
"events"
],
"operator-policy": [
"policy"
],
"application-deployment": [
"application_deployment"
] ]
}, },
"services": [ "services": [
@ -79,11 +79,11 @@
"api_reference": "https://developer.openstack.org/api-ref/object-storage/" "api_reference": "https://developer.openstack.org/api-ref/object-storage/"
}, },
{ {
"service_type": "resource-cluster",
"project": "senlin",
"aliases": [ "aliases": [
"clustering" "clustering"
], ],
"project": "senlin",
"service_type": "resource-cluster",
"api_reference": "https://developer.openstack.org/api-ref/clustering/" "api_reference": "https://developer.openstack.org/api-ref/clustering/"
}, },
{ {
@ -112,19 +112,19 @@
"api_reference": "https://developer.openstack.org/api-ref/ec2-api/" "api_reference": "https://developer.openstack.org/api-ref/ec2-api/"
}, },
{ {
"service_type": "resource-optimization",
"project": "watcher",
"aliases": [ "aliases": [
"infra-optim" "infra-optim"
], ],
"project": "watcher",
"service_type": "resource-optimization",
"api_reference": "https://docs.openstack.org/developer/watcher/webapi/v1.html" "api_reference": "https://docs.openstack.org/developer/watcher/webapi/v1.html"
}, },
{ {
"service_type": "message",
"project": "zaqar",
"aliases": [ "aliases": [
"messaging" "messaging"
], ],
"project": "zaqar",
"service_type": "message",
"api_reference": "https://developer.openstack.org/api-ref/messaging/" "api_reference": "https://developer.openstack.org/api-ref/messaging/"
}, },
{ {
@ -133,11 +133,11 @@
"api_reference": "https://developer.openstack.org/api-ref/application-catalog/" "api_reference": "https://developer.openstack.org/api-ref/application-catalog/"
}, },
{ {
"service_type": "container-infrastructure-management",
"project": "magnum",
"aliases": [ "aliases": [
"container-infrastructure" "container-infrastructure"
], ],
"project": "magnum",
"service_type": "container-infrastructure-management",
"api_reference": "https://developer.openstack.org/api-ref/container-infrastructure-management/" "api_reference": "https://developer.openstack.org/api-ref/container-infrastructure-management/"
}, },
{ {
@ -151,11 +151,11 @@
"api_reference": "https://developer.openstack.org/api-ref/dns/" "api_reference": "https://developer.openstack.org/api-ref/dns/"
}, },
{ {
"service_type": "workflow",
"project": "mistral",
"aliases": [ "aliases": [
"workflowv2" "workflowv2"
], ],
"project": "mistral",
"service_type": "workflow",
"api_reference": "https://docs.openstack.org/developer/mistral/developer/webapi/index.html" "api_reference": "https://docs.openstack.org/developer/mistral/developer/webapi/index.html"
}, },
{ {
@ -164,20 +164,20 @@
"api_reference": "https://docs.openstack.org/developer/cloudkitty/webapi/root.html" "api_reference": "https://docs.openstack.org/developer/cloudkitty/webapi/root.html"
}, },
{ {
"service_type": "operator-policy",
"project": "congress",
"aliases": [ "aliases": [
"policy" "policy"
], ],
"project": "congress",
"service_type": "operator-policy",
"api_reference": "https://docs.openstack.org/developer/congress/api.html" "api_reference": "https://docs.openstack.org/developer/congress/api.html"
}, },
{ {
"service_type": "shared-file-system",
"project": "manila",
"aliases": [ "aliases": [
"sharev2", "sharev2",
"share" "share"
], ],
"project": "manila",
"service_type": "shared-file-system",
"api_reference": "https://developer.openstack.org/api-ref/shared-file-systems/" "api_reference": "https://developer.openstack.org/api-ref/shared-file-systems/"
}, },
{ {
@ -191,53 +191,53 @@
"api_reference": "https://developer.openstack.org/api-ref/orchestration/" "api_reference": "https://developer.openstack.org/api-ref/orchestration/"
}, },
{ {
"service_type": "block-storage",
"project": "cinder",
"aliases": [ "aliases": [
"volumev3", "volumev3",
"volumev2", "volumev2",
"volume" "volume"
], ],
"project": "cinder",
"service_type": "block-storage",
"api_reference": "https://developer.openstack.org/api-ref/block-storage/" "api_reference": "https://developer.openstack.org/api-ref/block-storage/"
}, },
{ {
"service_type": "alarm",
"project": "aodh",
"aliases": [ "aliases": [
"alarming" "alarming"
], ],
"project": "aodh",
"service_type": "alarm",
"api_reference": "https://docs.openstack.org/developer/aodh/webapi/index.html" "api_reference": "https://docs.openstack.org/developer/aodh/webapi/index.html"
}, },
{ {
"service_type": "meter",
"project": "ceilometer",
"aliases": [ "aliases": [
"metering" "metering"
], ],
"project": "ceilometer",
"service_type": "meter",
"api_reference": "https://docs.openstack.org/developer/ceilometer/webapi/index.html" "api_reference": "https://docs.openstack.org/developer/ceilometer/webapi/index.html"
}, },
{ {
"service_type": "event",
"project": "panko",
"aliases": [ "aliases": [
"events" "events"
], ],
"project": "panko",
"service_type": "event",
"api_reference": "https://docs.openstack.org/developer/panko/webapi/index.html" "api_reference": "https://docs.openstack.org/developer/panko/webapi/index.html"
}, },
{ {
"service_type": "application-deployment",
"project": "solum",
"aliases": [ "aliases": [
"application_deployment" "application_deployment"
], ],
"project": "solum",
"service_type": "application-deployment",
"api_reference": "https://docs.openstack.org/developer/solum/develop_applications/webapi/index.html" "api_reference": "https://docs.openstack.org/developer/solum/develop_applications/webapi/index.html"
}, },
{ {
"service_type": "multi-region-network-automation",
"project": "tricircle",
"aliases": [ "aliases": [
"tricircle" "tricircle"
], ],
"project": "tricircle",
"service_type": "multi-region-network-automation",
"api_reference": "https://docs.openstack.org/developer/tricircle/api_v1.html" "api_reference": "https://docs.openstack.org/developer/tricircle/api_v1.html"
}, },
{ {
@ -246,19 +246,19 @@
"api_reference": "https://developer.openstack.org/api-ref/database/" "api_reference": "https://developer.openstack.org/api-ref/database/"
}, },
{ {
"service_type": "application-container",
"project": "zun",
"aliases": [ "aliases": [
"container" "container"
], ],
"project": "zun",
"service_type": "application-container",
"api_reference": "https://git.openstack.org/cgit/openstack/zun/tree/api-ref/source" "api_reference": "https://git.openstack.org/cgit/openstack/zun/tree/api-ref/source"
}, },
{ {
"service_type": "root-cause-analysis",
"project": "vitrage",
"aliases": [ "aliases": [
"rca" "rca"
], ],
"project": "vitrage",
"service_type": "root-cause-analysis",
"api_reference": "https://docs.openstack.org/developer/vitrage/vitrage-api.html" "api_reference": "https://docs.openstack.org/developer/vitrage/vitrage-api.html"
}, },
{ {
@ -267,9 +267,9 @@
"api_reference": "https://developer.openstack.org/api-ref/nfv-orchestration/" "api_reference": "https://developer.openstack.org/api-ref/nfv-orchestration/"
}, },
{ {
"api_reference_project": "neutron-lib",
"project": "neutron", "project": "neutron",
"service_type": "network", "service_type": "network",
"api_reference_project": "neutron-lib",
"api_reference": "https://developer.openstack.org/api-ref/networking/" "api_reference": "https://developer.openstack.org/api-ref/networking/"
}, },
{ {
@ -278,11 +278,11 @@
"api_reference": "https://developer.openstack.org/api-ref/backup/" "api_reference": "https://developer.openstack.org/api-ref/backup/"
}, },
{ {
"service_type": "monitoring-logging",
"project": "monasca-log-api",
"aliases": [ "aliases": [
"monitoring-log-api" "monitoring-log-api"
], ],
"project": "monasca-log-api",
"service_type": "monitoring-logging",
"api_reference": "https://developer.openstack.org/api-ref/monitoring-log-api/" "api_reference": "https://developer.openstack.org/api-ref/monitoring-log-api/"
}, },
{ {
@ -294,29 +294,35 @@
"project": "monasca-events-api", "project": "monasca-events-api",
"service_type": "monitoring-events", "service_type": "monitoring-events",
"api_reference": "https://developer.openstack.org/api-ref/monitoring-events-api/" "api_reference": "https://developer.openstack.org/api-ref/monitoring-events-api/"
},
{
"project": "nova",
"service_type": "placement",
"api_reference": "https://developer.openstack.org/api-ref/placement/",
"secondary": true
} }
], ],
"version": "2017-08-13T15:16:51.109325",
"reverse": { "reverse": {
"rca": "root-cause-analysis", "rca": "root-cause-analysis",
"container-infrastructure": "container-infrastructure-management",
"volumev3": "block-storage",
"workflowv2": "workflow",
"policy": "operator-policy",
"monitoring-log-api": "monitoring-logging",
"alarming": "alarm",
"tricircle": "multi-region-network-automation",
"clustering": "resource-cluster",
"messaging": "message",
"sharev2": "shared-file-system",
"volume": "block-storage",
"share": "shared-file-system", "share": "shared-file-system",
"events": "event", "events": "event",
"application_deployment": "application-deployment",
"metering": "meter", "metering": "meter",
"volumev2": "block-storage", "alarming": "alarm",
"policy": "operator-policy",
"application_deployment": "application-deployment",
"container-infrastructure": "container-infrastructure-management",
"sharev2": "shared-file-system",
"infra-optim": "resource-optimization", "infra-optim": "resource-optimization",
"clustering": "resource-cluster",
"volumev2": "block-storage",
"volume": "block-storage",
"tricircle": "multi-region-network-automation",
"workflowv2": "workflow",
"monitoring-log-api": "monitoring-logging",
"messaging": "message",
"volumev3": "block-storage",
"container": "application-container" "container": "application-container"
}, },
"version": "2017-08-13T15:10:21.840336", "sha": "3aa676c9c3132f8a08357afbde5e0255f68df843"
"sha": "23ee356235096fc990a53e5cf3ce947f560358dc"
} }

View File

@ -66,6 +66,9 @@ class ServiceTypes(object):
by_project = {} by_project = {}
for s in self._service_types_data['services']: for s in self._service_types_data['services']:
# Skip secondary projects
if s.get('secondary', False):
continue
for key in ['project', 'api_reference_project']: for key in ['project', 'api_reference_project']:
name = s.get(key) name = s.get(key)
if name: if name:

View File

@ -50,18 +50,21 @@ class ServiceDataMixin(object):
service_type='compute', official='compute', aliases=[], service_type='compute', official='compute', aliases=[],
all_types=['compute'], all_types=['compute'],
api_reference='compute', api_reference_project=None, api_reference='compute', api_reference_project=None,
is_secondary=False,
is_known=True, is_alias=False, is_official=True, project='nova')), is_known=True, is_alias=False, is_official=True, project='nova')),
('volumev2', dict( ('volumev2', dict(
service_type='volumev2', official='block-storage', aliases=[], service_type='volumev2', official='block-storage', aliases=[],
all_types=['block-storage', 'volumev3', 'volumev2', 'volume'], all_types=['block-storage', 'volumev3', 'volumev2', 'volume'],
api_reference='block-storage', api_reference_project=None, api_reference='block-storage', api_reference_project=None,
is_known=True, is_alias=True, is_official=False, is_known=True, is_alias=True, is_official=False,
is_secondary=False,
project='cinder')), project='cinder')),
('volumev3', dict( ('volumev3', dict(
service_type='volumev3', official='block-storage', aliases=[], service_type='volumev3', official='block-storage', aliases=[],
all_types=['block-storage', 'volumev3', 'volumev2', 'volume'], all_types=['block-storage', 'volumev3', 'volumev2', 'volume'],
api_reference='block-storage', api_reference_project=None, api_reference='block-storage', api_reference_project=None,
is_known=True, is_alias=True, is_official=False, is_known=True, is_alias=True, is_official=False,
is_secondary=False,
project='cinder')), project='cinder')),
('block-storage', dict( ('block-storage', dict(
service_type='block-storage', official='block-storage', service_type='block-storage', official='block-storage',
@ -69,19 +72,28 @@ class ServiceDataMixin(object):
api_reference='block-storage', api_reference_project=None, api_reference='block-storage', api_reference_project=None,
aliases=['volumev3', 'volumev2', 'volume'], aliases=['volumev3', 'volumev2', 'volume'],
is_known=True, is_alias=False, is_official=True, is_known=True, is_alias=False, is_official=True,
is_secondary=False,
project='cinder')), project='cinder')),
('network', dict( ('network', dict(
service_type='network', official='network', aliases=[], service_type='network', official='network', aliases=[],
all_types=['network'], all_types=['network'],
api_reference='networking', api_reference_project='neutron-lib', api_reference='networking', api_reference_project='neutron-lib',
is_known=True, is_alias=False, is_official=True, is_known=True, is_alias=False, is_official=True,
is_secondary=False,
project='neutron')), project='neutron')),
('placement', dict(
service_type='placement', official='placement', aliases=[],
all_types=['placement'],
api_reference='placement', api_reference_project=None,
is_known=True, is_alias=False, is_official=True, is_secondary=True,
project='nova')),
('missing', dict( ('missing', dict(
service_type='missing', official=None, service_type='missing', official=None,
aliases=[], aliases=[],
all_types=['missing'], all_types=['missing'],
api_reference=None, api_reference_project=None, api_reference=None, api_reference_project=None,
is_known=False, is_alias=False, is_official=False, is_known=False, is_alias=False, is_official=False,
is_secondary=False,
project=None)), project=None)),
] ]
@ -164,7 +176,12 @@ class ServiceDataMixin(object):
self.project) self.project)
def test_get_service_data_for_project(self): def test_get_service_data_for_project(self):
if not self.project: if self.is_secondary:
self.assertNotIn(
self.service_type,
self.service_types._service_types_data['by_project'].values())
return
elif not self.project:
self.skipTest("Empty project is invalid but tested elsewhere.") self.skipTest("Empty project is invalid but tested elsewhere.")
return return