Error in zone update when adding new bind9 target to pool

Bug #1958409 reported by Jan Horstmann
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Designate
Fix Released
Undecided
Dmitry Galkin

Bug Description

When adding a new bind9 target to an existing pool which already holds zones, then the zone update triggered by `designate-manage` will fail on the new target, e.g.:
```
Jan 19 12:52:35 dev-stack named[60670]: received control channel command 'modzone example.net { type slave; masters { 192.168.122.153 port 5354;}; file "slave.example.net.7ad6c216-eb38-4e16-9274-4406cd109df4"; };'
Jan 19 12:52:35 dev-stack named[60670]: client @0x7fe33c000cd0 192.168.122.153#49573: received notify for zone 'example.net': not authoritative
```

The update issues a `modzone` rndc command, which will not create the zone if it does not exist. The following notify will not trigger an AXFR as the bind9 instance is "not authoritative".

Should the new target also be added as a nameserver to the 'pools.yaml' then the zones will end up in status "ERROR" as they cannot be found on the new target.

Expected behaviour:
Zones are added to empty/new pool targets

Steps to reproduce:
1. Set up a devstack on ubuntu focal as described in https://docs.openstack.org/designate/latest/contributor/devstack.html
2. Add a zone: `openstack zone create --email <email address hidden> example.net.`
3. Add a second bind9 instance, e.g.:
   ```
sudo aa-teardown # turn off apparmor for this
sudo cp -a /etc/bind /etc/bind-2
sudo mkdir -p /var/cache/bind-2
sudo chown -R bind. /var/cache/bind-2
sudo sed -i -e 's#port 53#port 1053#g' -e 's#port 953#port 1953#g' -e 's#/var/cache/bind#/var/cache/bind-2#g' /etc/bind-2/named.conf.options
sudo sed -i 's#port 953#port 1953#g' /etc/bind-2/rndc.conf
sudo sed -i 's#/etc/bind/#/etc/bind-2/#g' /etc/bind-2/*
sudo systemctl cat bind9 | sed -e 's#^\(Exec.*\)/\(\S*\)\s\(.*\)$#\1/\2 -c /etc/bind-2/\2.conf \3#g' -e 's#^Alias=bind9.service$#Alias=bind9-2.service#g' | sudo tee /etc/systemd/system/bind9-2.service
sudo systemctl daemon-reload
sudo systemctl start bind9-2.service
   ```
4. Update the pool:
   ```
cat <<EOF | sudo tee -a /etc/designate/pools.yaml
    - type: bind9
      description: Another BIND Instance
      masters:
        - host: $(hostname -I)
          port: 5354
      options:
        host: $(hostname -I)
        port: 1053
        rndc_host: $(hostname -I)
        rndc_port: 1953
        rndc_config_file: /etc/bind-2/rndc.conf
        rndc_key_file: /etc/bind-2/rndc.key
EOF
designate-manage pool update --file /etc/designate/pools.yaml
   ```
5. Check the log of the second bind9 instance for the error at the beginning of this report: `sudo journalctl --no-pager -eu bind9-2.service`
6. Verify that the second bind9 does not have the zone configured: `dig +short SOA example.net @$(hostname -I) -p1053`

Workaround:
Create zones manually on the new target before the pool update, e.g.: `rndc -c /etc/bind-2/rndc.conf 'addzone example.net { type slave; masters { 192.168.122.153 port 5354;}; file "slave.example.net.7ad6c216-eb38-4e16-9274-4406cd109df4"; };'`

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/+/828679

Changed in designate:
status: New → In Progress
Changed in designate:
assignee: nobody → Dmitry Galkin (galkindmitrii)
Revision history for this message
Dmitry Galkin (galkindmitrii) wrote :

JFYI: tested patch ^ with newer and older versions of Bind.
Apparently very old versions (9.10 / 9.9) do not support showzone.

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

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

commit 66cc876eadd9a4ded3afa35aed675c15c60f149d
Author: Dmitry Galkin <email address hidden>
Date: Thu Feb 10 10:40:35 2022 +0100

    Fix zone update when adding new Bind9 target to pool.

    When a new Bind9 is added to the pool, Designate will trigger 'modzone'
    rndc command that will fail, unless zone is already present on the backend.

    This change will first verify that the zone is present on the backend,
    before an update attempt. If zone is not present - zone creation will be
    triggered.

    Closes-Bug: 1958409

    Co-authored-by: Kiran Pawar <email address hidden>
    Change-Id: I782bf38a68f24a2e7133ff2afad7c96e2ae6b7f0

Changed in designate:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate 14.0.0.0rc1

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

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

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

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

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

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

Reviewed: https://review.opendev.org/c/openstack/designate/+/844371
Committed: https://opendev.org/openstack/designate/commit/b6915f00cca2439977722d996f6045309176f49f
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit b6915f00cca2439977722d996f6045309176f49f
Author: Dmitry Galkin <email address hidden>
Date: Thu Feb 10 10:40:35 2022 +0100

    Fix zone update when adding new Bind9 target to pool.

    When a new Bind9 is added to the pool, Designate will trigger 'modzone'
    rndc command that will fail, unless zone is already present on the backend.

    This change will first verify that the zone is present on the backend,
    before an update attempt. If zone is not present - zone creation will be
    triggered.

    Closes-Bug: 1958409

    Co-authored-by: Kiran Pawar <email address hidden>
    Change-Id: I782bf38a68f24a2e7133ff2afad7c96e2ae6b7f0
    (cherry picked from commit 66cc876eadd9a4ded3afa35aed675c15c60f149d)

tags: added: in-stable-wallaby
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (stable/xena)

Reviewed: https://review.opendev.org/c/openstack/designate/+/844370
Committed: https://opendev.org/openstack/designate/commit/5b1b404e359a516ab468e3568412f4c69a7a0f5b
Submitter: "Zuul (22348)"
Branch: stable/xena

commit 5b1b404e359a516ab468e3568412f4c69a7a0f5b
Author: Dmitry Galkin <email address hidden>
Date: Thu Feb 10 10:40:35 2022 +0100

    Fix zone update when adding new Bind9 target to pool.

    When a new Bind9 is added to the pool, Designate will trigger 'modzone'
    rndc command that will fail, unless zone is already present on the backend.

    This change will first verify that the zone is present on the backend,
    before an update attempt. If zone is not present - zone creation will be
    triggered.

    Closes-Bug: 1958409

    Co-authored-by: Kiran Pawar <email address hidden>
    Change-Id: I782bf38a68f24a2e7133ff2afad7c96e2ae6b7f0
    (cherry picked from commit 66cc876eadd9a4ded3afa35aed675c15c60f149d)

tags: added: in-stable-xena
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate 13.0.1

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

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

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

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

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

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

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

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

Reviewed: https://review.opendev.org/c/openstack/designate/+/847431
Committed: https://opendev.org/openstack/designate/commit/a74c2389bf587fc6a36c72d87fba6c958cef2141
Submitter: "Zuul (22348)"
Branch: stable/victoria

commit a74c2389bf587fc6a36c72d87fba6c958cef2141
Author: Dmitry Galkin <email address hidden>
Date: Thu Feb 10 10:40:35 2022 +0100

    Fix zone update when adding new Bind9 target to pool.

    When a new Bind9 is added to the pool, Designate will trigger 'modzone'
    rndc command that will fail, unless zone is already present on the backend.

    This change will first verify that the zone is present on the backend,
    before an update attempt. If zone is not present - zone creation will be
    triggered.

    Closes-Bug: 1958409

    Co-authored-by: Kiran Pawar <email address hidden>
    Change-Id: I782bf38a68f24a2e7133ff2afad7c96e2ae6b7f0
    (cherry picked from commit 66cc876eadd9a4ded3afa35aed675c15c60f149d)

tags: added: in-stable-victoria
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (stable/ussuri)

Reviewed: https://review.opendev.org/c/openstack/designate/+/847432
Committed: https://opendev.org/openstack/designate/commit/5e569a3c7646042131926b090f570ca5082503e3
Submitter: "Zuul (22348)"
Branch: stable/ussuri

commit 5e569a3c7646042131926b090f570ca5082503e3
Author: Dmitry Galkin <email address hidden>
Date: Thu Feb 10 10:40:35 2022 +0100

    Fix zone update when adding new Bind9 target to pool.

    When a new Bind9 is added to the pool, Designate will trigger 'modzone'
    rndc command that will fail, unless zone is already present on the backend.

    This change will first verify that the zone is present on the backend,
    before an update attempt. If zone is not present - zone creation will be
    triggered.

    Closes-Bug: 1958409

    Co-authored-by: Kiran Pawar <email address hidden>
    Change-Id: I782bf38a68f24a2e7133ff2afad7c96e2ae6b7f0
    (cherry picked from commit 66cc876eadd9a4ded3afa35aed675c15c60f149d)

tags: added: in-stable-ussuri
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate ussuri-eol

This issue was fixed in the openstack/designate ussuri-eol release.

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

This issue was fixed in the openstack/designate victoria-eom release.

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.