Merge "Disable VIM monitoring of Openstack services for Kubernetes deployment"
This commit is contained in:
commit
250fb4dc31
@ -23,6 +23,7 @@ from openstack import exceptions
|
||||
from openstack import openstack
|
||||
from openstack import nova
|
||||
from openstack import rest_api
|
||||
from openstack.objects import OPENSTACK_SERVICE
|
||||
|
||||
DLOG = debug.debug_get_logger('nfv_plugins.nfvi_plugins.compute_api')
|
||||
|
||||
@ -470,6 +471,13 @@ class NFVIComputeAPI(nfvi.api.v1.NFVIComputeAPI):
|
||||
try:
|
||||
future.set_timeouts(config.CONF.get('nfvi-timeouts', None))
|
||||
|
||||
if self._directory.get_service_info(OPENSTACK_SERVICE.NOVA) \
|
||||
is None:
|
||||
DLOG.info("Compute service get-host-aggregates not available.")
|
||||
response['result-data'] = list()
|
||||
response['completed'] = True
|
||||
return
|
||||
|
||||
if self._token is None or self._token.is_expired():
|
||||
future.work(openstack.get_token, self._directory)
|
||||
future.result = (yield)
|
||||
@ -529,6 +537,13 @@ class NFVIComputeAPI(nfvi.api.v1.NFVIComputeAPI):
|
||||
try:
|
||||
future.set_timeouts(config.CONF.get('nfvi-timeouts', None))
|
||||
|
||||
if self._directory.get_service_info(OPENSTACK_SERVICE.NOVA) \
|
||||
is None:
|
||||
DLOG.info("Compute service get-hypervisors not available.")
|
||||
response['result-data'] = list()
|
||||
response['completed'] = True
|
||||
return
|
||||
|
||||
if self._token is None or self._token.is_expired():
|
||||
future.work(openstack.get_token, self._directory)
|
||||
future.result = (yield)
|
||||
@ -672,6 +687,14 @@ class NFVIComputeAPI(nfvi.api.v1.NFVIComputeAPI):
|
||||
try:
|
||||
future.set_timeouts(config.CONF.get('nfvi-timeouts', None))
|
||||
|
||||
if self._directory.get_service_info(OPENSTACK_SERVICE.NOVA) \
|
||||
is None:
|
||||
DLOG.info("Compute service get-instance-types not available.")
|
||||
response['result-data'] = list()
|
||||
response['completed'] = True
|
||||
paging.next_page = None
|
||||
return
|
||||
|
||||
if self._token is None or self._token.is_expired():
|
||||
future.work(openstack.get_token, self._directory)
|
||||
future.result = (yield)
|
||||
@ -1011,6 +1034,13 @@ class NFVIComputeAPI(nfvi.api.v1.NFVIComputeAPI):
|
||||
try:
|
||||
future.set_timeouts(config.CONF.get('nfvi-timeouts', None))
|
||||
|
||||
if self._directory.get_service_info(OPENSTACK_SERVICE.NOVA) \
|
||||
is None:
|
||||
DLOG.info("Compute service get-instance-groups not available.")
|
||||
response['result-data'] = list()
|
||||
response['completed'] = True
|
||||
return
|
||||
|
||||
if self._token is None or self._token.is_expired():
|
||||
future.work(openstack.get_token, self._directory)
|
||||
future.result = (yield)
|
||||
@ -1099,6 +1129,14 @@ class NFVIComputeAPI(nfvi.api.v1.NFVIComputeAPI):
|
||||
try:
|
||||
future.set_timeouts(config.CONF.get('nfvi-timeouts', None))
|
||||
|
||||
if self._directory.get_service_info(OPENSTACK_SERVICE.NOVA) \
|
||||
is None:
|
||||
DLOG.info("Compute service get-instances not available.")
|
||||
response['result-data'] = list()
|
||||
response['completed'] = True
|
||||
paging.next_page = None
|
||||
return
|
||||
|
||||
if self._token is None or self._token.is_expired():
|
||||
future.work(openstack.get_token, self._directory)
|
||||
future.result = (yield)
|
||||
|
@ -23,6 +23,7 @@ from openstack import mtc
|
||||
from openstack import nova
|
||||
from openstack import neutron
|
||||
from openstack import guest
|
||||
from openstack.objects import OPENSTACK_SERVICE
|
||||
|
||||
DLOG = debug.debug_get_logger('nfv_plugins.nfvi_plugins.infrastructure_api')
|
||||
|
||||
@ -119,14 +120,6 @@ class NFVIInfrastructureAPI(nfvi.api.v1.NFVIInfrastructureAPI):
|
||||
def signature(self):
|
||||
return self._signature
|
||||
|
||||
@staticmethod
|
||||
def _host_supports_neutron(personality):
|
||||
return ('compute' in personality or 'controller' in personality)
|
||||
|
||||
@staticmethod
|
||||
def _host_supports_nova_compute(personality):
|
||||
return ('compute' in personality)
|
||||
|
||||
@staticmethod
|
||||
def _host_supports_kubernetes(personality):
|
||||
# TODO: This check will disappear once kubernetes is the default
|
||||
@ -150,6 +143,20 @@ class NFVIInfrastructureAPI(nfvi.api.v1.NFVIInfrastructureAPI):
|
||||
self._data_port_fault_handling_enabled = False
|
||||
self._host_listener = None
|
||||
|
||||
def _host_supports_neutron(self, personality):
|
||||
return (('compute' in personality or 'controller' in personality) and
|
||||
(self._directory.get_service_info(OPENSTACK_SERVICE.NEUTRON) is not None))
|
||||
|
||||
def _host_supports_nova_compute(self, personality):
|
||||
return (('compute' in personality) and
|
||||
(self._directory.get_service_info(OPENSTACK_SERVICE.NOVA) is not None))
|
||||
|
||||
def _neutron_enabled(self):
|
||||
return (self._directory.get_service_info(OPENSTACK_SERVICE.NEUTRON) is not None)
|
||||
|
||||
def _nova_enabled(self):
|
||||
return (self._directory.get_service_info(OPENSTACK_SERVICE.NOVA) is not None)
|
||||
|
||||
def get_system_info(self, future, callback):
|
||||
"""
|
||||
Get information about the system from the plugin
|
||||
@ -1424,6 +1431,10 @@ class NFVIInfrastructureAPI(nfvi.api.v1.NFVIInfrastructureAPI):
|
||||
try:
|
||||
future.set_timeouts(config.CONF.get('nfvi-timeouts', None))
|
||||
|
||||
if not (self._neutron_enabled() and self._nova_enabled()):
|
||||
response['completed'] = True
|
||||
return
|
||||
|
||||
if self._token is None or self._token.is_expired():
|
||||
future.work(openstack.get_token, self._directory)
|
||||
future.result = (yield)
|
||||
@ -1523,6 +1534,10 @@ class NFVIInfrastructureAPI(nfvi.api.v1.NFVIInfrastructureAPI):
|
||||
try:
|
||||
future.set_timeouts(config.CONF.get('nfvi-timeouts', None))
|
||||
|
||||
if not (self._neutron_enabled() and self._nova_enabled()):
|
||||
response['completed'] = True
|
||||
return
|
||||
|
||||
if self._token is None or self._token.is_expired():
|
||||
future.work(openstack.get_token, self._directory)
|
||||
future.result = (yield)
|
||||
@ -1622,6 +1637,10 @@ class NFVIInfrastructureAPI(nfvi.api.v1.NFVIInfrastructureAPI):
|
||||
try:
|
||||
future.set_timeouts(config.CONF.get('nfvi-timeouts', None))
|
||||
|
||||
if not (self._neutron_enabled() and self._nova_enabled()):
|
||||
response['completed'] = True
|
||||
return
|
||||
|
||||
if self._token is None or self._token.is_expired():
|
||||
future.work(openstack.get_token, self._directory)
|
||||
future.result = (yield)
|
||||
@ -1720,6 +1739,10 @@ class NFVIInfrastructureAPI(nfvi.api.v1.NFVIInfrastructureAPI):
|
||||
try:
|
||||
future.set_timeouts(config.CONF.get('nfvi-timeouts', None))
|
||||
|
||||
if not (self._neutron_enabled() and self._nova_enabled()):
|
||||
response['completed'] = True
|
||||
return
|
||||
|
||||
if self._token is None or self._token.is_expired():
|
||||
future.work(openstack.get_token, self._directory)
|
||||
future.result = (yield)
|
||||
@ -1818,6 +1841,10 @@ class NFVIInfrastructureAPI(nfvi.api.v1.NFVIInfrastructureAPI):
|
||||
try:
|
||||
future.set_timeouts(config.CONF.get('nfvi-timeouts', None))
|
||||
|
||||
if not (self._neutron_enabled() and self._nova_enabled()):
|
||||
response['completed'] = True
|
||||
return
|
||||
|
||||
if self._token is None or self._token.is_expired():
|
||||
future.work(openstack.get_token, self._directory)
|
||||
future.result = (yield)
|
||||
@ -1868,6 +1895,10 @@ class NFVIInfrastructureAPI(nfvi.api.v1.NFVIInfrastructureAPI):
|
||||
try:
|
||||
future.set_timeouts(config.CONF.get('nfvi-timeouts', None))
|
||||
|
||||
if not (self._neutron_enabled() and self._nova_enabled()):
|
||||
response['completed'] = True
|
||||
return
|
||||
|
||||
if self._token is None or self._token.is_expired():
|
||||
future.work(openstack.get_token, self._directory)
|
||||
future.result = (yield)
|
||||
|
Loading…
x
Reference in New Issue
Block a user