-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
T6948: Keep DHCP server leases in sync with hostd records #4237
Conversation
👍 |
Keeping it as draft till I have a working test environment. |
5e444ca
to
748310c
Compare
748310c
to
d1a8438
Compare
Update: Ready for review. |
d1a8438
to
e8d7cc3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for adding the smoketest.
e8d7cc3
to
5d094e9
Compare
src/etc/systemd/system/kea-dhcp4-server.service.d/override.conf
Outdated
Show resolved
Hide resolved
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
5d094e9
to
462f009
Compare
Conflicts have been resolved. A maintainer will review the pull request shortly. |
7c2f986
to
2aed4d7
Compare
6c14589
to
033ae6a
Compare
033ae6a
to
4c644e3
Compare
b143cd7
to
4ea98e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I asked @sarthurdev as our VyOS most experienced KEA user for his opinion, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just this last issue
Add helpers: - `kea_add_lease` to add a lease to the running kea server - `kea_get_domain_from_subnet_id` to get the domain name from subnet id Also, enrich leases with domain name from subnet id
4ea98e2
to
f52ab25
Compare
Keep DHCP server leases in sync with vyos-hostd records via helper script invoked with `ExecStartPost` directive in kea-dhcp4-server.service. The helper script updates VyOS hostd records from DHCP server leases. This ensures that hostd records with the DHCP server leases are kept in sync with VyOS hostd records right after DHCP server is started. This is similar to the capability exposed via kea hook `libdhcp_run_script.so` which is invoked internally by kea when a single lease changes state. Since the kea hook is currently implemented for DHCPv4 only, this helper script is implemented for DHCPv4 only as well.
The helper script updates VyOS hostd records from DHCP server leases. This ensures that hostd records with the DHCP server leases are kept in sync with VyOS hostd records right after the DHCP server is started. Note that `Restart` directive needs to be updated to `on-failure` so that the service is restarted in case of failure/timeout in interaction with hostd service.
The test `test_dhcp_hostsd_lease_sync` validates DHCP server leases in sync with hostd records. Since the DHCP server running in smoketest environment might not have actual clients to lease IP addresses, we simulate the lease creation and deletion using kea helper functions (`kea_add_lease` and `kea_delete_lease`).
The formatter methods are mostly `family` agnostic now.
f52ab25
to
cc45faf
Compare
CI integration 👍 passed! Details
|
Change Summary
Keep DHCP server leases in sync with vyos-hostd records via helper script invoked with
ExecStartPost
directive in kea-dhcp4-server.service.The helper script updates VyOS hostd records from DHCP server leases. This ensures that hostd records with the DHCP server leases are kept in sync with VyOS hostd records right after DHCP server is started.
This is similar to the capability exposed via kea hook
libdhcp_run_script.so
which is invoked internally by kea when a single lease changes state.Since the kea hook is currently implemented for DHCPv4 only, this helper script is implemented for DHCPv4 only as well.
Types of changes
Related Task(s)
Related PR(s)
#4307
Component(s) name
dhcp server
Proposed changes
How to test
/etc/hosts
and/or/run/vyos-hostsd/vyos-hostsd.state
show dhcp server leases
)/etc/hosts
restart dhcp server
)/etc/hosts
Smoketest result
Checklist: