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: TBD
Task: TBD

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 c2e361a471
6 changed files with 41 additions and 6 deletions

View File

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

View File

@ -1 +1,2 @@
python-cephclient-wheels 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

@ -12,6 +12,7 @@ Source0: %{name}-%{version}.tar.gz
Requires: python-novaclient Requires: python-novaclient
BuildRequires: python-setuptools BuildRequires: python-setuptools
BuildRequires: systemd-devel BuildRequires: systemd-devel
BuildRequires: python3-wheel
%description %description
StarlingX PCI Interrupt Affinity Agent Package StarlingX PCI Interrupt Affinity Agent Package
@ -29,6 +30,7 @@ rm -rf *.egg-info
%build %build
%{__python} setup.py build %{__python} setup.py build
%{__python} setup.py bdist_wheel
%install %install
%{__python} setup.py install --root=%{buildroot} \ %{__python} setup.py install --root=%{buildroot} \
@ -37,6 +39,9 @@ rm -rf *.egg-info
--install-data=/usr/share \ --install-data=/usr/share \
--single-version-externally-managed --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} -d -m 755 %{buildroot}%{local_etc_initd}
%{__install} -p -D -m 755 pci-irq-affinity-agent %{buildroot}%{local_etc_initd}/pci-irq-affinity-agent %{__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}/pci-irq-affinity-agent
%{_bindir}/nova-sriov %{_bindir}/nova-sriov
%config(noreplace) %{_sysconfdir}/pci_irq_affinity/config.ini %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) sys.exit(200)
finally: finally:
LOG.error("proces_main finalized!!!") LOG.error("process_main finalized!!!")
if openstack_enabled == 'true': if openstack_enabled == 'true':
novaClient.close_libvirt_connect() novaClient.close_libvirt_connect()
audit_srv.tg.stop() audit_srv.tg.stop()

View File

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