Changing log facility to decouple agent service

This commit changes the logging facility used by the
pci-irq-affinity-agent from syslog to stdout so that it
can be turn into a container and be executed during the
stx-openstack application apply process.

Depends-on: TBD
Story: 2009299
Task: 43650

Signed-off-by: Heitor Matsui <HeitorVieira.Matsui@windriver.com>
Change-Id: I7680e39de734e16affebff893df21c6b5089dc76
This commit is contained in:
Heitor Matsui 2021-10-14 12:45:15 -03:00
parent b78e1e8513
commit ef2d64027c
9 changed files with 66 additions and 6 deletions

View File

@ -0,0 +1,2 @@
ceph/ceph-manager
utilities/pci-irq-affinity-agent

View File

@ -1 +1,2 @@
python-cephclient-wheels
pci-irq-affinity-agent-wheels

View File

@ -1 +1,2 @@
ceph/ceph-manager
utilities/pci-irq-affinity-agent

View File

@ -1 +1,2 @@
python-cephclient-wheels
pci-irq-affinity-agent-wheels

View File

@ -0,0 +1,22 @@
BUILDER=loci
LABEL=stx-pci-irq-affinity-agent
PROJECT=infra
PROJECT_REPO=nil
PIP_PACKAGES="pci-irq-affinity-agent \
eventlet \
keyring \
keystoneauth1 \
pkgconfig \
libvirt-python \
oslo.concurrency \
oslo.config \
oslo.i18n \
oslo.log \
oslo.messaging \
oslo.service \
python-daemon \
python-novaclient \
retrying \
psutil"
DIST_PACKAGES=""
PYTHON3=yes

View File

@ -0,0 +1,22 @@
BUILDER=loci
LABEL=stx-pci-irq-affinity-agent
PROJECT=infra
PROJECT_REPO=nil
PIP_PACKAGES="pci-irq-affinity-agent \
eventlet \
keyring \
keystoneauth1 \
pkgconfig \
libvirt-python \
oslo.concurrency \
oslo.config \
oslo.i18n \
oslo.log \
oslo.messaging \
oslo.service \
python-daemon \
python-novaclient \
retrying \
psutil"
DIST_PACKAGES=""
PYTHON3=yes

View File

@ -12,6 +12,7 @@ Source0: %{name}-%{version}.tar.gz
Requires: python-novaclient
BuildRequires: python-setuptools
BuildRequires: systemd-devel
BuildRequires: python2-wheel
%description
StarlingX PCI Interrupt Affinity Agent Package
@ -29,6 +30,7 @@ rm -rf *.egg-info
%build
%{__python} setup.py build
%{__python} setup.py bdist_wheel
%install
%{__python} setup.py install --root=%{buildroot} \
@ -37,6 +39,9 @@ rm -rf *.egg-info
--install-data=/usr/share \
--single-version-externally-managed
mkdir -p $RPM_BUILD_ROOT/wheels
%{__install} -m 644 dist/*.whl $RPM_BUILD_ROOT/wheels/
%{__install} -d -m 755 %{buildroot}%{local_etc_initd}
%{__install} -p -D -m 755 pci-irq-affinity-agent %{buildroot}%{local_etc_initd}/pci-irq-affinity-agent
@ -68,3 +73,12 @@ rm -rf $RPM_BUILD_ROOT
%{_bindir}/pci-irq-affinity-agent
%{_bindir}/nova-sriov
%config(noreplace) %{_sysconfdir}/pci_irq_affinity/config.ini
%package wheels
Summary: %{name} wheels
%description wheels
Contains python wheels for %{name}
%files wheels
/wheels/*

View File

@ -195,7 +195,7 @@ def process_main():
sys.exit(200)
finally:
LOG.error("proces_main finalized!!!")
LOG.error("process_main finalized!!!")
if openstack_enabled == 'true':
novaClient.close_libvirt_connect()
audit_srv.tg.stop()

View File

@ -12,17 +12,14 @@
""" Define Logger class for this agent"""
import logging
import logging.handlers
_syslog_facility = 'local1'
import sys
LOG = logging.getLogger("pci-interrupt-affinity")
formatter = logging.Formatter("%(asctime)s %(threadName)s[%(process)d] "
"%(name)s.%(pathname)s.%(lineno)d - %(levelname)s "
"%(message)s")
handler = logging.handlers.SysLogHandler(address='/dev/log',
facility=_syslog_facility)
handler = logging.StreamHandler(stream=sys.stdout)
handler.setFormatter(formatter)
LOG.addHandler(handler)
LOG.setLevel(logging.INFO)