Disable VIM plugins for Kubernetes deployment

Do not load vim plugins and disable vim audits instead of
just disabling the endpoints as was previously done in
Change 599741.  Leave setting of (new) Nova and (pre-existing)
Neutron endpoint disabled flags for infrastructure host services usage.

Story: 2002876
Task: 26573

Change-Id: Ic00a6c1c8814bcc4e06c78ea61edd7666e40e56d
Signed-off-by: Kevin Smith <kevin.smith@windriver.com>
Depends-On: https://review.openstack.org/#/c/604372/
This commit is contained in:
Kevin Smith 2018-09-21 10:14:33 -04:00
parent b51a44c5e1
commit 80a73c0af6
11 changed files with 199 additions and 149 deletions

View File

@ -24,7 +24,6 @@ from nfv_plugins.nfvi_plugins.openstack import exceptions
from nfv_plugins.nfvi_plugins.openstack import openstack
from nfv_plugins.nfvi_plugins.openstack import nova
from nfv_plugins.nfvi_plugins.openstack import rest_api
from nfv_plugins.nfvi_plugins.openstack.objects import OPENSTACK_SERVICE
DLOG = debug.debug_get_logger('nfv_plugins.nfvi_plugins.compute_api')
@ -472,13 +471,6 @@ 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)
@ -538,13 +530,6 @@ 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)
@ -688,14 +673,6 @@ 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)
@ -1035,13 +1012,6 @@ 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)
@ -1130,14 +1100,6 @@ 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)

View File

@ -810,7 +810,8 @@ def _audit_nfvi():
while True:
timer_id = (yield)
DLOG.verbose("Audit system information called, timer_id=%s." % timer_id)
DLOG.verbose("Audit system information called, timer_id=%s."
% timer_id)
nfvi.nfvi_get_system_info(_audit_nfvi_system_info_callback(timer_id))
_main_audit_inprogress = True
@ -824,20 +825,23 @@ def _audit_nfvi():
while _main_audit_inprogress:
timer_id = (yield)
DLOG.verbose("Audit host aggregates called, timer_id=%s." % timer_id)
nfvi.nfvi_get_host_aggregates(
_audit_nfvi_host_aggregates_callback(timer_id))
if not nfvi.nfvi_compute_plugin_disabled():
DLOG.verbose("Audit host aggregates called, timer_id=%s."
% timer_id)
nfvi.nfvi_get_host_aggregates(
_audit_nfvi_host_aggregates_callback(timer_id))
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
DLOG.verbose("Audit hypervisors called, timer_id=%s." % timer_id)
nfvi.nfvi_get_hypervisors(_audit_nfvi_hypervisors_callback(timer_id))
DLOG.verbose("Audit hypervisors called, timer_id=%s." % timer_id)
nfvi.nfvi_get_hypervisors(
_audit_nfvi_hypervisors_callback(timer_id))
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
DLOG.verbose("Audit tenants called, timer_id=%s." % timer_id)
nfvi.nfvi_get_tenants(_audit_nfvi_tenants_callback(timer_id))
@ -846,70 +850,77 @@ def _audit_nfvi():
while _main_audit_inprogress:
timer_id = (yield)
DLOG.verbose("Audit instance types called, timer_id=%s." % timer_id)
nfvi.nfvi_get_instance_types(
_nfvi_instance_types_paging,
_audit_nfvi_instance_types_callback(timer_id))
if not nfvi.nfvi_compute_plugin_disabled():
DLOG.verbose("Audit instance types called, timer_id=%s."
% timer_id)
nfvi.nfvi_get_instance_types(
_nfvi_instance_types_paging,
_audit_nfvi_instance_types_callback(timer_id))
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
DLOG.info("Audit instances called, timer_id=%s." % timer_id)
nfvi.nfvi_get_instances(_nfvi_instances_paging,
_audit_nfvi_instances_callback(timer_id))
DLOG.info("Audit instances called, timer_id=%s." % timer_id)
nfvi.nfvi_get_instances(_nfvi_instances_paging,
_audit_nfvi_instances_callback(timer_id))
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
DLOG.verbose("Audit instance groups called, timer_id=%s." % timer_id)
nfvi.nfvi_get_instance_groups(
_audit_nfvi_instance_groups_callback(timer_id))
DLOG.verbose("Audit instance groups called, timer_id=%s."
% timer_id)
nfvi.nfvi_get_instance_groups(
_audit_nfvi_instance_groups_callback(timer_id))
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
DLOG.verbose("Audit images called, timer_id=%s." % timer_id)
nfvi.nfvi_get_images(_nfvi_images_paging,
_audit_nfvi_images_callback(timer_id))
if not nfvi.nfvi_image_plugin_disabled():
DLOG.verbose("Audit images called, timer_id=%s." % timer_id)
nfvi.nfvi_get_images(_nfvi_images_paging,
_audit_nfvi_images_callback(timer_id))
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
DLOG.verbose("Audit volumes called, timer_id=%s." % timer_id)
nfvi.nfvi_get_volumes(_nfvi_volumes_paging,
_audit_nfvi_volumes_callback(timer_id))
if not nfvi.nfvi_block_storage_plugin_disabled():
DLOG.verbose("Audit volumes called, timer_id=%s." % timer_id)
nfvi.nfvi_get_volumes(_nfvi_volumes_paging,
_audit_nfvi_volumes_callback(timer_id))
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
DLOG.verbose("Audit volume snapshots called, timer_id=%s." % timer_id)
nfvi.nfvi_get_volume_snapshots(
_audit_nfvi_volume_snapshots_callback(timer_id))
DLOG.verbose("Audit volume snapshots called, timer_id=%s."
% timer_id)
nfvi.nfvi_get_volume_snapshots(
_audit_nfvi_volume_snapshots_callback(timer_id))
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
DLOG.verbose("Audit subnets called, timer_id=%s." % timer_id)
nfvi.nfvi_get_subnets(_nfvi_subnets_paging,
_audit_nfvi_subnets_callback(timer_id))
if not nfvi.nfvi_network_plugin_disabled():
DLOG.verbose("Audit subnets called, timer_id=%s." % timer_id)
nfvi.nfvi_get_subnets(_nfvi_subnets_paging,
_audit_nfvi_subnets_callback(timer_id))
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
DLOG.verbose("Audit networks called, timer_id=%s." % timer_id)
nfvi.nfvi_get_networks(_nfvi_networks_paging,
_audit_nfvi_networks_callback(timer_id))
DLOG.verbose("Audit networks called, timer_id=%s." % timer_id)
nfvi.nfvi_get_networks(_nfvi_networks_paging,
_audit_nfvi_networks_callback(timer_id))
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
_main_audit_inprogress = True
while _main_audit_inprogress:
timer_id = (yield)
@coroutine
@ -1214,12 +1225,22 @@ def vim_nfvi_audits_initialize():
"""
Initialize nfvi audits
"""
timers.timers_register_interval_timers([_audit_nfvi,
_audit_nfvi_instance,
_audit_nfvi_hypervisor_details,
_audit_nfvi_instance_type_details,
_audit_nfvi_volume,
_audit_nfvi_guest_services])
audits = list()
audits.append(_audit_nfvi)
if not nfvi.nfvi_compute_plugin_disabled():
audits.append(_audit_nfvi_instance)
audits.append(_audit_nfvi_hypervisor_details)
audits.append(_audit_nfvi_instance_type_details)
if not nfvi.nfvi_block_storage_plugin_disabled():
audits.append(_audit_nfvi_volume)
if not nfvi.nfvi_guest_plugin_disabled():
audits.append(_audit_nfvi_guest_services)
timers.timers_register_interval_timers(audits)
def vim_nfvi_audits_finalize():

View File

@ -66,9 +66,15 @@ class InstanceDirector(object):
self._instance_rebooting_list = list()
self._instance_cleanup_list = list()
self._next_audit_interval = recovery_audit_interval
self._timer_audit_instances = timers.timers_create_timer(
"audit-instances", recovery_audit_cooldown,
recovery_audit_interval, self.audit_instances)
if not nfvi.nfvi_compute_plugin_disabled():
# Do not launch audit if compute plugin not enabled.
self._timer_audit_instances = timers.timers_create_timer(
"audit-instances", recovery_audit_cooldown,
recovery_audit_interval, self.audit_instances)
else:
self._timer_audit_instances = None
self._timer_cleanup_instances = None
@staticmethod
@ -1723,9 +1729,11 @@ class InstanceDirector(object):
if interval is None:
interval = self._next_audit_interval
timers.timers_reschedule_timer(self._timer_audit_instances, interval)
DLOG.verbose("Recovery audit is rescheduled to %s second intervals."
% interval)
if self._timer_audit_instances is not None:
timers.timers_reschedule_timer(self._timer_audit_instances,
interval)
DLOG.verbose("Recovery audit is rescheduled to %s second "
"intervals." % interval)
def recover_instances(self, audit=False):
"""

View File

@ -471,32 +471,34 @@ def vim_nfvi_events_initialize():
nfvi.nfvi_register_host_notification_callback(
_nfvi_host_notification_callback)
nfvi.nfvi_register_instance_state_change_callback(
_nfvi_instance_state_change_callback)
if not nfvi.nfvi_compute_plugin_disabled():
nfvi.nfvi_register_instance_state_change_callback(
_nfvi_instance_state_change_callback)
nfvi.nfvi_register_instance_action_change_callback(
_nfvi_instance_action_change_callback)
nfvi.nfvi_register_instance_action_change_callback(
_nfvi_instance_action_change_callback)
nfvi.nfvi_register_instance_action_callback(
_nfvi_instance_action_callback)
nfvi.nfvi_register_instance_action_callback(
_nfvi_instance_action_callback)
nfvi.nfvi_register_instance_delete_callback(
_nfvi_instance_delete_callback)
nfvi.nfvi_register_instance_delete_callback(
_nfvi_instance_delete_callback)
nfvi.nfvi_register_host_services_query_callback(
_nfvi_host_services_query_callback)
if not nfvi.nfvi_guest_plugin_disabled():
nfvi.nfvi_register_host_services_query_callback(
_nfvi_host_services_query_callback)
nfvi.nfvi_register_guest_services_query_callback(
_nfvi_guest_services_query_callback)
nfvi.nfvi_register_guest_services_query_callback(
_nfvi_guest_services_query_callback)
nfvi.nfvi_register_guest_services_state_notify_callback(
_nfvi_guest_services_state_notify_callback)
nfvi.nfvi_register_guest_services_state_notify_callback(
_nfvi_guest_services_state_notify_callback)
nfvi.nfvi_register_guest_services_alarm_notify_callback(
_nfvi_guest_services_alarm_notify_callback)
nfvi.nfvi_register_guest_services_alarm_notify_callback(
_nfvi_guest_services_alarm_notify_callback)
nfvi.nfvi_register_guest_services_action_notify_callback(
_nfvi_guest_services_action_notify_callback)
nfvi.nfvi_register_guest_services_action_notify_callback(
_nfvi_guest_services_action_notify_callback)
def vim_nfvi_events_finalize():

View File

@ -8,6 +8,7 @@ import nfv_vim.nfvi.objects # noqa: F401
from nfv_vim.nfvi._nfvi_defs import NFVI_ERROR_CODE # noqa: F401
from nfv_vim.nfvi._nfvi_identity_module import nfvi_get_tenants # noqa: F401
from nfv_vim.nfvi._nfvi_guest_module import nfvi_guest_plugin_disabled # noqa: F401
from nfv_vim.nfvi._nfvi_guest_module import nfvi_guest_services_create # noqa: F401
from nfv_vim.nfvi._nfvi_guest_module import nfvi_guest_services_set # noqa: F401
from nfv_vim.nfvi._nfvi_guest_module import nfvi_guest_services_delete # noqa: F401
@ -55,17 +56,20 @@ from nfv_vim.nfvi._nfvi_infrastructure_module import nfvi_register_host_state_ch
from nfv_vim.nfvi._nfvi_infrastructure_module import nfvi_register_host_get_callback # noqa: F401
from nfv_vim.nfvi._nfvi_infrastructure_module import nfvi_register_host_upgrade_callback # noqa: F401
from nfv_vim.nfvi._nfvi_infrastructure_module import nfvi_register_host_notification_callback # noqa: F401
from nfv_vim.nfvi._nfvi_image_module import nfvi_image_plugin_disabled # noqa: F401
from nfv_vim.nfvi._nfvi_image_module import nfvi_get_images # noqa: F401
from nfv_vim.nfvi._nfvi_image_module import nfvi_create_image # noqa: F401
from nfv_vim.nfvi._nfvi_image_module import nfvi_delete_image # noqa: F401
from nfv_vim.nfvi._nfvi_image_module import nfvi_update_image # noqa: F401
from nfv_vim.nfvi._nfvi_image_module import nfvi_get_image # noqa: F401
from nfv_vim.nfvi._nfvi_block_storage_module import nfvi_block_storage_plugin_disabled # noqa: F401
from nfv_vim.nfvi._nfvi_block_storage_module import nfvi_get_volumes # noqa: F401
from nfv_vim.nfvi._nfvi_block_storage_module import nfvi_create_volume # noqa: F401
from nfv_vim.nfvi._nfvi_block_storage_module import nfvi_delete_volume # noqa: F401
from nfv_vim.nfvi._nfvi_block_storage_module import nfvi_update_volume # noqa: F401
from nfv_vim.nfvi._nfvi_block_storage_module import nfvi_get_volume # noqa: F401
from nfv_vim.nfvi._nfvi_block_storage_module import nfvi_get_volume_snapshots # noqa: F401
from nfv_vim.nfvi._nfvi_network_module import nfvi_network_plugin_disabled # noqa: F401
from nfv_vim.nfvi._nfvi_network_module import nfvi_get_networks # noqa: F401
from nfv_vim.nfvi._nfvi_network_module import nfvi_create_network # noqa: F401
from nfv_vim.nfvi._nfvi_network_module import nfvi_update_network # noqa: F401
@ -76,6 +80,7 @@ from nfv_vim.nfvi._nfvi_network_module import nfvi_update_subnet # noqa: F401
from nfv_vim.nfvi._nfvi_network_module import nfvi_delete_subnet # noqa: F401
from nfv_vim.nfvi._nfvi_network_module import nfvi_get_subnet # noqa: F401
from nfv_vim.nfvi._nfvi_network_module import nfvi_get_subnets # noqa: F401
from nfv_vim.nfvi._nfvi_compute_module import nfvi_compute_plugin_disabled # noqa: F401
from nfv_vim.nfvi._nfvi_compute_module import nfvi_get_host_aggregates # noqa: F401
from nfv_vim.nfvi._nfvi_compute_module import nfvi_get_hypervisors # noqa: F401
from nfv_vim.nfvi._nfvi_compute_module import nfvi_get_hypervisor # noqa: F401

View File

@ -12,6 +12,13 @@ DLOG = debug.debug_get_logger('nfv_vim.nfvi.nfvi_block_storage_module')
_block_storage_plugin = None
def nfvi_block_storage_plugin_disabled():
"""
Get block storage plugin disabled status
"""
return (_block_storage_plugin is None)
def nfvi_get_volumes(paging, callback):
"""
Get a list of volumes

View File

@ -12,6 +12,13 @@ DLOG = debug.debug_get_logger('nfv_vim.nfvi.nfvi_compute_module')
_compute_plugin = None
def nfvi_compute_plugin_disabled():
"""
Get compute plugin disabled status
"""
return (_compute_plugin is None)
def nfvi_get_host_aggregates(callback):
"""
Get a list of host aggregates

View File

@ -12,6 +12,13 @@ DLOG = debug.debug_get_logger('nfv_vim.nfvi.nfvi_guest_module')
_guest_plugin = None
def nfvi_guest_plugin_disabled():
"""
Get guest plugin disabled status
"""
return (_guest_plugin is None)
def nfvi_guest_services_create(instance_uuid, host_name, services, callback):
"""
Create guest services

View File

@ -12,6 +12,13 @@ DLOG = debug.debug_get_logger('nfv_vim.nfvi.nfvi_image_module')
_image_plugin = None
def nfvi_image_plugin_disabled():
"""
Get image plugin disabled status
"""
return (_image_plugin is None)
def nfvi_get_images(paging, callback):
"""
Get a list of images

View File

@ -34,39 +34,56 @@ def nfvi_initialize(config):
"""
global _task_worker_pools
disabled_list = ['Yes', 'yes', 'Y', 'y', 'True', 'true', 'T', 't', '1']
image_plugin_disabled = (config.get('image_plugin_disabled',
'False') in disabled_list)
block_storage_plugin_disabled = (config.get(
'block_storage_plugin_disabled', 'False') in disabled_list)
compute_plugin_disabled = (config.get('compute_plugin_disabled',
'False') in disabled_list)
network_plugin_disabled = (config.get('network_plugin_disabled',
'False') in disabled_list)
guest_plugin_disabled = (config.get('guest_plugin_disabled',
'False') in disabled_list)
_task_worker_pools['identity'] = \
tasks.TaskWorkerPool('Identity', num_workers=1)
nfvi_identity_initialize(config, _task_worker_pools['identity'])
_task_worker_pools['image'] = \
tasks.TaskWorkerPool('Image', num_workers=1)
if not image_plugin_disabled:
_task_worker_pools['image'] = \
tasks.TaskWorkerPool('Image', num_workers=1)
nfvi_image_initialize(config, _task_worker_pools['image'])
_task_worker_pools['block'] = \
tasks.TaskWorkerPool('BlockStorage', num_workers=1)
if not block_storage_plugin_disabled:
_task_worker_pools['block'] = \
tasks.TaskWorkerPool('BlockStorage', num_workers=1)
nfvi_block_storage_initialize(config, _task_worker_pools['block'])
# Use two workers for the compute plugin. This allows the VIM to send two
# requests to the nova-api at a time.
_task_worker_pools['compute'] = \
tasks.TaskWorkerPool('Compute', num_workers=2)
if not compute_plugin_disabled:
# Use two workers for the compute plugin. This allows the VIM to send
# two requests to the nova-api at a time.
_task_worker_pools['compute'] = \
tasks.TaskWorkerPool('Compute', num_workers=2)
nfvi_compute_initialize(config, _task_worker_pools['compute'])
_task_worker_pools['network'] = \
tasks.TaskWorkerPool('Network', num_workers=1)
if not network_plugin_disabled:
_task_worker_pools['network'] = \
tasks.TaskWorkerPool('Network', num_workers=1)
nfvi_network_initialize(config, _task_worker_pools['network'])
_task_worker_pools['infra'] = \
tasks.TaskWorkerPool('Infrastructure', num_workers=1)
nfvi_infrastructure_initialize(config, _task_worker_pools['infra'])
_task_worker_pools['guest'] = \
tasks.TaskWorkerPool('Guest', num_workers=1)
if not guest_plugin_disabled:
_task_worker_pools['guest'] = \
tasks.TaskWorkerPool('Guest', num_workers=1)
nfvi_guest_initialize(config, _task_worker_pools['guest'])
_task_worker_pools['sw_mgmt'] = \
tasks.TaskWorkerPool('Sw-Mgmt', num_workers=1)
nfvi_identity_initialize(config, _task_worker_pools['identity'])
nfvi_image_initialize(config, _task_worker_pools['image'])
nfvi_block_storage_initialize(config, _task_worker_pools['block'])
nfvi_compute_initialize(config, _task_worker_pools['compute'])
nfvi_network_initialize(config, _task_worker_pools['network'])
nfvi_infrastructure_initialize(config, _task_worker_pools['infra'])
nfvi_guest_initialize(config, _task_worker_pools['guest'])
nfvi_sw_mgmt_initialize(config, _task_worker_pools['sw_mgmt'])

View File

@ -12,6 +12,13 @@ DLOG = debug.debug_get_logger('nfv_vim.nfvi.nfvi_network_module')
_network_plugin = None
def nfvi_network_plugin_disabled():
"""
Get network plugin disabled status
"""
return (_network_plugin is None)
def nfvi_get_networks(paging, callback):
"""
Get a list of networks