Merge "Improve placement of pci-irq-affinity-agent svc"

This commit is contained in:
Zuul 2021-12-05 03:05:42 +00:00 committed by Gerrit Code Review
commit 37b9705375
2 changed files with 18 additions and 14 deletions

View File

@ -2512,25 +2512,25 @@ def find_kube_app(dbapi, app_name):
def is_chart_enabled(dbapi, app_name, chart_name, namespace):
"""
Check if the chart is enable at an application level
Check if the chart is enabled at an application level
:param app_name: Application name
:param chart_name: Chart supplied with the application
:param namespace: Namespace where the chart will be executed
Returns true by default if an exception occurs as most charts are
enabled.
Returns false by default since if the app is not present or overrides aren't
present, the charts are not supposed to be enabled.
"""
try:
db_app = find_kube_app(dbapi, app_name)
db_chart = dbapi.helm_override_get(db_app.id, chart_name, namespace)
except exception.KubeAppNotFound:
LOG.exception("is_chart_enabled: %s application unknown" % (app_name))
return True
return False
except exception.HelmOverrideNotFound:
LOG.exception("is_chart_enabled: %s/%s/%s overrides missing" % (
app_name, chart_name, namespace))
return True
return False
return db_chart.system_overrides.get(helm_common.HELM_CHART_ATTR_ENABLED,
False)

View File

@ -4,7 +4,9 @@
# SPDX-License-Identifier: Apache-2.0
#
from sysinv.common import exception
from sysinv.common import utils
from sysinv.helm import common
from sysinv.helm import helm
from sysinv.puppet import openstack
@ -12,7 +14,7 @@ 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
HELM_CHART_PCI_IRQ_AFFINITY_AGENT = 'pci-irq-affinity-agent'
# This function will be removed when the service is completely removed from the platform
def should_enable_agent_service(self):
@ -21,15 +23,17 @@ class PciIrqAffinityPuppet(openstack.OpenstackBasePuppet):
includes the pci irq affinity agent container
"""
try:
openstack_app_version = utils.find_openstack_app(self.dbapi).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:
openstack_app = utils.find_openstack_app(self.dbapi)
except exception.KubeAppNotFound:
return False
if openstack_app_version < self.OPENSTACK_VERSION_WITH_CONTAINER_SUPPORT:
return True
return False
# Service should only be enabled if the containerized version of the service is not
# present
return not utils.is_chart_enabled(
self.dbapi,
openstack_app.name,
self.HELM_CHART_PCI_IRQ_AFFINITY_AGENT,
common.HELM_NS_OPENSTACK
)
def get_secure_static_config(self):
return {}