What is the current best practice for manually deleting a static IP address "lease"?

When recreating (delete + launch) an instance with a static ip, the lease is not deleted in /var/snap/lxd/common/lxd/networks/$NETWORK/dnsmasq.* and dnsmasq is not refreshed/restarted.

In old issues I see it’s a recurring problem. And it mentions shortcomings with dnsmasq as an inhibitor hindering a smooth automatic flow from what I understand.

Questions

  1. Is it expected to be resolved in --channel=latest/stable (5.13,5.14) ?
  2. Is the resolve still to manually/script stop, clean dnsmasq.* files and restart lxd ?
  3. What is the current best practice to perform the operation ?

Hi,

Please could you show me a reproducer of this issue?

I’m not able to reproduce using the latest snap:

apt install snapd -y; snap install lxd --edge
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
snapd is already the newest version (2.58+22.04).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
snap "lxd" is already installed, see 'snap help refresh'
root@v1:~# lxd init --auto
root@v1:~# lxc network list-leases lxdbr0
To start your first container, try: lxc launch ubuntu:22.04
Or for a virtual machine: lxc launch ubuntu:22.04 --vm

+-----------+-------------+-----------------------+---------+
| HOSTNAME  | MAC ADDRESS |      IP ADDRESS       |  TYPE   |
+-----------+-------------+-----------------------+---------+
| lxdbr0.gw |             | 10.117.115.1          | GATEWAY |
+-----------+-------------+-----------------------+---------+
| lxdbr0.gw |             | fd42:a7f5:7ba3:468::1 | GATEWAY |
+-----------+-------------+-----------------------+---------+
root@v1:~# lxc launch images:ubuntu/jammy c1
Creating c1
Starting c1                                 
root@v1:~# lxc network list-leases lxdbr0
+-----------+-------------------+---------------------------------------+---------+
| HOSTNAME  |    MAC ADDRESS    |              IP ADDRESS               |  TYPE   |
+-----------+-------------------+---------------------------------------+---------+
| c1        | 00:16:3e:d7:8d:34 | 10.117.115.237                        | DYNAMIC |
+-----------+-------------------+---------------------------------------+---------+
| c1        | 00:16:3e:d7:8d:34 | fd42:a7f5:7ba3:468:216:3eff:fed7:8d34 | DYNAMIC |
+-----------+-------------------+---------------------------------------+---------+
| lxdbr0.gw |                   | 10.117.115.1                          | GATEWAY |
+-----------+-------------------+---------------------------------------+---------+
| lxdbr0.gw |                   | fd42:a7f5:7ba3:468::1                 | GATEWAY |
+-----------+-------------------+---------------------------------------+---------+
root@v1:~# lxc delete -f c1
root@v1:~# lxc network list-leases lxdbr0
+-----------+-------------+-----------------------+---------+
| HOSTNAME  | MAC ADDRESS |      IP ADDRESS       |  TYPE   |
+-----------+-------------+-----------------------+---------+
| lxdbr0.gw |             | 10.117.115.1          | GATEWAY |
+-----------+-------------+-----------------------+---------+
| lxdbr0.gw |             | fd42:a7f5:7ba3:468::1 | GATEWAY |
+-----------+-------------+-----------------------+---------+
root@v1:~# lxc launch images:ubuntu/jammy c1
Creating c1
Starting c1                                 
root@v1:~# lxc network list-leases lxdbr0
+-----------+-------------------+---------------------------------------+---------+
| HOSTNAME  |    MAC ADDRESS    |              IP ADDRESS               |  TYPE   |
+-----------+-------------------+---------------------------------------+---------+
| c1        | 00:16:3e:ef:fc:12 | 10.117.115.119                        | DYNAMIC |
+-----------+-------------------+---------------------------------------+---------+
| c1        | 00:16:3e:ef:fc:12 | fd42:a7f5:7ba3:468:216:3eff:feef:fc12 | DYNAMIC |
+-----------+-------------------+---------------------------------------+---------+
| lxdbr0.gw |                   | 10.117.115.1                          | GATEWAY |
+-----------+-------------------+---------------------------------------+---------+
| lxdbr0.gw |                   | fd42:a7f5:7ba3:468::1                 | GATEWAY |
+-----------+-------------------+---------------------------------------+---------+
root@v1:~# lxc delete -f c1
root@v1:~# lxc network list-leases lxdbr0
+-----------+-------------+-----------------------+---------+
| HOSTNAME  | MAC ADDRESS |      IP ADDRESS       |  TYPE   |
+-----------+-------------+-----------------------+---------+
| lxdbr0.gw |             | 10.117.115.1          | GATEWAY |
+-----------+-------------+-----------------------+---------+
| lxdbr0.gw |             | fd42:a7f5:7ba3:468::1 | GATEWAY |
+-----------+-------------+-----------------------+---------+

How is the problem manifesting itself?
And do you see rogue entries in specific files?