CONF.default_ttl value in zones sqlalchemy table doesn't use designate.conf value

Bug #2042944 reported by Alex Kavanagh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Designate
Fix Released
High
Unassigned

Bug Description

Essentially, the /etc/designate/designate.conf value for `default_ttl` isn't used as the SQLAlchemy Table definition for "zones" happens before the conf file is read, and thus the default of 3600 is *always* used.

I think this is due to the reorganisation of the sql stuff between antelope and bobcat, but in cmd/central.py I think it gets imported by the line "from designate import service". This ultimately imports designate.storage.alchemy.tables BEFORE the CONF is parsed/read.

I think this affects all the CONF values in that table:

zones = Table('zones', metadata,
    ...
    Column('ttl', Integer, default=CONF.default_ttl, nullable=False),
    Column('serial', Integer, default=timeutils.utcnow_ts, nullable=False),
    # The refresh interval is randomized by _generate_soa_refresh_interval
    Column('refresh', Integer, default=CONF.default_soa_refresh_min,
           nullable=False),
    Column('retry', Integer, default=CONF.default_soa_retry, nullable=False),
    Column('expire', Integer, default=CONF.default_soa_expire, nullable=False),
    Column('minimum', Integer, default=CONF.default_soa_minimum,
           nullable=False),

I think the solution is to either move the CONF reading prior to the import of designate.service, or make the definition of the SQLA zones Table lazy and happen when it is first used.

Changed in designate:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/designate/+/900106

Changed in designate:
status: Confirmed → In Progress
Revision history for this message
Alex Kavanagh (ajkavanagh) wrote :

I've cargo-culted the change into my test system and I can confirm that it works. Thanks for the quick response.

Revision history for this message
Erik Olof Gunnar Andersson (eandersson) wrote :

Thanks for the report and for confirming the fix.

The reason this broke is because we used to load sqlalchemy as a driver, but starting with antelope we no longer support custom storage drivers and instead just instantiate the sqlalchemy code at startup. This meant that the sqlalchemy code is no longer lazy-loaded and which in turn causes that import to happen sooner in the code.

Changed in designate:
importance: Undecided → High
Revision history for this message
Alex Kavanagh (ajkavanagh) wrote :

Thanks for the explanation; I found this in bobcat/2023.2 - is this going to be backported to stable/2023.2 and roughly what is the timeline for releasing that as a point release, please? Many thanks!

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (master)

Reviewed: https://review.opendev.org/c/openstack/designate/+/900106
Committed: https://opendev.org/openstack/designate/commit/aae83d09b88c90a5f0872daa206dbf5921aa1827
Submitter: "Zuul (22348)"
Branch: master

commit aae83d09b88c90a5f0872daa206dbf5921aa1827
Author: Erik Olof Gunnar Andersson <email address hidden>
Date: Tue Nov 7 06:08:37 2023 -0800

    Fix bug with new zone default values being ignored

    The following defaults weren't being applied properly
    to the zone.
    - default_ttl
    - default_soa_refresh_min
    - default_soa_retry
    - default_soa_expire
    - default_soa_minimum

    Closes-bug: #2042944
    Change-Id: Iae4ee61e4a1f2bab48b1574ea55c90d45f5a040a

Changed in designate:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (stable/2023.2)

Fix proposed to branch: stable/2023.2
Review: https://review.opendev.org/c/openstack/designate/+/901080

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (stable/2023.2)

Reviewed: https://review.opendev.org/c/openstack/designate/+/901080
Committed: https://opendev.org/openstack/designate/commit/3de4f7f24b02fb77d20846daf7a7c9b9c56e1dd0
Submitter: "Zuul (22348)"
Branch: stable/2023.2

commit 3de4f7f24b02fb77d20846daf7a7c9b9c56e1dd0
Author: Erik Olof Gunnar Andersson <email address hidden>
Date: Tue Nov 7 06:08:37 2023 -0800

    Fix bug with new zone default values being ignored

    The following defaults weren't being applied properly
    to the zone.
    - default_ttl
    - default_soa_refresh_min
    - default_soa_retry
    - default_soa_expire
    - default_soa_minimum

    Closes-bug: #2042944
    Change-Id: Iae4ee61e4a1f2bab48b1574ea55c90d45f5a040a
    (cherry picked from commit aae83d09b88c90a5f0872daa206dbf5921aa1827)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate 17.0.1

This issue was fixed in the openstack/designate 17.0.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate 18.0.0.0rc1

This issue was fixed in the openstack/designate 18.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.