[rpm-packaging] logging override in openstack packages

Sean Mooney smooney at redhat.com
Wed Jul 7 12:01:59 UTC 2021


On Wed, 2021-07-07 at 11:34 +0200, Javier Pena wrote:
> Hello Piotr,
> 
> On Fri, Jul 2, 2021 at 6:53 PM Piotr Mossakowski
> <piotr.mossakowski at tietoevry.com> wrote:
> > 
> > Hello,
> > 
> > There is a logging override in almost all openstack packages, for
> > example in nova:
> > 
> > https://opendev.org/openstack/rpm-packaging/src/branch/stable/victoria/openstack/nova/openstack-nova.defaultconf
> > 
> > It lands in /etc/nova/nova.conf.d/010-nova.conf as stated in the
> > spec:
> > 
> > https://opendev.org/openstack/rpm-packaging/src/branch/stable/victoria/openstack/nova/nova.spec.j2#L407
> > 
> > Let's assume following scenario: in kolla-ansible based deployment I
> > want to disable logging globally using /etc/kolla/config/global.conf:
> > 
> > [DEFAULT]
> > log_dir =
> > log_file =
> > 
> > For kolla images built from RPMs, the file
> > '/etc/nova/nova.conf.d/010-nova.conf' will override what I want to
> > achieve by global.conf.
> > 
> > We have a situation when kolla images log inside the container into
> > '/var/log/nova' where there is no log rotation.

actully kolla has log rotation for those files
https://github.com/openstack/kolla-ansible/blob/master/ansible/roles/common/templates/cron-logrotate-nova.conf.j2

ot does not use oslo logs in built log rotation it does log ratation
via cron.

kolla ansible also does not use the configs from the rpms it generates
its own nova.conf that is used instead using
https://github.com/openstack/kolla-ansible/blob/master/ansible/roles/nova-cell/templates/nova.conf.j2
as the template which is renderd an copied on container start
https://github.com/openstack/kolla-ansible/blob/master/ansible/roles/nova-cell/templates/nova-compute.json.j2#L3-L9
and kolla provides a config override mechaniume to future customise
this if needed.
https://docs.openstack.org/kolla-ansible/latest/admin/deployment-philosophy.html#kolla-s-solution-to-customization

if you look at the nova and nova-cell role config tasks

https://github.com/openstack/kolla-ansible/blob/master/ansible/roles/nova/tasks/config.yml#L51-L69
https://github.com/openstack/kolla-ansible/blob/master/ansible/roles/nova-cell/tasks/config.yml#L56-L75

you wil see the list of filets that will be merged to generate the
final nova.conf

 sources:
      - "{{ role_path }}/templates/nova.conf.j2"
      - "{{ node_custom_config }}/global.conf"
      - "{{ node_custom_config }}/nova.conf"
      - "{{ node_custom_config }}/nova/{{ item.key }}.conf"
      - "{{ node_custom_config }}/nova/{{ inventory_hostname }}/nova.conf"


kolla renders its template then merges any seconts form  the other
files if they exist

{{ node_custom_config }} defaults to /etc/kolla/config

so if you want to make global changes to novas log rotation using the
oslo-log log rotation capablitys you would add those options to

/etc/kolla/config/nova.conf

you can do it speratly per serive by creating
/etc/kolla/config/nova/nova-compute.conf
/etc/kolla/config/nova/nova-api.conf
...

and even per host if you want too.

packaging project should ideally avoid deviating from upstream
configuration where possible but in a kolla enve the package cofnigs
should be unused.

its possible you are using a very old version of kolla before the log
rotate configs where intoduced but correct way to apply config changes
form a "deployment-philosophy" point of view is to use the config
override mechanium  not to do it via packaging changes.

> >  There is no easy way to change that in kolla-ansible based
> > deployments.
> > 
> > Is there any specific reason why default logging has been hardcoded
> > like that? Can we agree to change that situation to be able to
> > override logging as expected?
> > 
> 
> In general, packages (both for rpm-packaging and RDO) try to set some
> sensible minimum defaults for a few parameters, which are set
> according to the base OS requirements. This is why we get those
> defaults in the rpm-packaging Nova spec.
> 
> I think the easiest way to ensure the override in
> /etc/kolla/config/global.conf is enforced would be to parse it last in
> the nova-api command-line (with a --config-file directive). Would that
> be possible in your environment?
> 
> Regards,
> Javier
> 
> > --
> > 
> > Pozdrawiam serdecznie / Best regards,
> > 
> > Piotr Mossakowski
> > 
> > Lead System Engineer, Product Development Services, Cloud Infra &
> > Applications
> > 
> > Email piotr.mossakowski at tietoevry.com, +48795515407
> > Aleja Piastów 30, 71-064 Szczecin, Poland, www.tietoevry.com
> 
> 





More information about the openstack-discuss mailing list