Merge "Verify OpenStack version to activate agent service"
This commit is contained in:
commit
3d8dc43c1a
|
@ -1,18 +1,37 @@
|
|||
#
|
||||
# Copyright (c) 2017-2018 Wind River Systems, Inc.
|
||||
# Copyright (c) 2017-2021 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
from sysinv.common import constants
|
||||
from sysinv.common import utils
|
||||
from sysinv.helm import helm
|
||||
|
||||
from sysinv.puppet import openstack
|
||||
|
||||
|
||||
class PciIrqAffinityPuppet(openstack.OpenstackBasePuppet):
|
||||
"""Class to encapsulate puppet operations for PciIrqAffinity configuration"""
|
||||
PLATFORM_KEYRING_SERVICE = 'CGCS'
|
||||
OPENSTACK_VERSION_WITH_CONTAINER_SUPPORT = 125
|
||||
|
||||
# This function will be removed when the service is completely removed from the platform
|
||||
def should_enable_agent_service(self):
|
||||
"""
|
||||
Checks whether the OpenStack application version
|
||||
includes the pci irq affinity agent container
|
||||
"""
|
||||
openstack_app_name = constants.HELM_APP_OPENSTACK
|
||||
try:
|
||||
openstack_app_version = self.dbapi.kube_app_get(openstack_app_name).app_version
|
||||
# stx-openstack app version string format: x.y-wz-release-info
|
||||
openstack_app_version = int(openstack_app_version.split('-', 2)[1])
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
if openstack_app_version < self.OPENSTACK_VERSION_WITH_CONTAINER_SUPPORT:
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_secure_static_config(self):
|
||||
return {}
|
||||
|
@ -23,12 +42,16 @@ class PciIrqAffinityPuppet(openstack.OpenstackBasePuppet):
|
|||
if utils.is_openstack_applied(self.dbapi):
|
||||
helm_data = helm.HelmOperatorData(self.dbapi)
|
||||
|
||||
# if openstack includes the agent container then agent
|
||||
# service on platform must be disabled
|
||||
enable_agent_service = self.should_enable_agent_service()
|
||||
|
||||
# The openstack services are authenticated with pod based
|
||||
# keystone.
|
||||
keystone_auth_data = helm_data.get_keystone_auth_data()
|
||||
openstack_auth_config = {
|
||||
'platform::pciirqaffinity::params::openstack_enabled':
|
||||
True,
|
||||
enable_agent_service,
|
||||
'platform::pciirqaffinity::params::openstack_username':
|
||||
keystone_auth_data['admin_user_name'],
|
||||
'platform::pciirqaffinity::params::openstack_tenant':
|
||||
|
|
Loading…
Reference in New Issue