Bug 1759160 - [RFE] Rake task for cleaning up DHCP records on proxy
Summary: [RFE] Rake task for cleaning up DHCP records on proxy
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: DHCP & DNS
Version: Unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.8.0
Assignee: Lukas Zapletal
QA Contact: Radovan Drazny
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-10-07 14:09 UTC by Lukas Zapletal
Modified: 2020-11-20 18:02 UTC (History)
6 users (show)

Fixed In Version: foreman-2.1.0-0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-10-27 12:59:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 27975 0 Normal Closed Rake task for cleaning up DHCP records on proxy 2020-12-01 14:29:56 UTC
Red Hat Product Errata RHSA-2020:4366 0 None None None 2020-10-27 12:59:21 UTC

Description Lukas Zapletal 2019-10-07 14:09:02 UTC
A task that allows cleanup of DHCP subnets.

foreman-rake orchestration:dhcp:cleanup

QA: Create a host without Subnet - DHCP Capsule. Then assign Subnet - DHCP Capsule and run cleanup. And vice versa.

Comment 3 Bryan Kearney 2020-04-01 16:02:38 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/27975 has been resolved.

Comment 4 Radovan Drazny 2020-09-23 11:37:29 UTC
Tested on Satellite 6.8 Snap 16 using following scenarios:

Scenario A) Add missing DHCP records

1. Enable DHCP proxy on a Satellite server.
2. Create a managed network
3. Define and provision a host connected to the managed network, assign an IPv4 address to it, and let the host acquire the address from DHCP. 
4. Manually edit /var/lib/dhcpd/dhcpd.leases file, find the record of the host created in the step 3, and remove it.
5. Restart dhcpd service
6. Run "foreman-rake orchestration:dhcp:add_missing subnet_name=<networkname> perform=1"

The record deleted in the step 4 will be recreated in dhcpd.leases file, with messages in production.log similar to this:

2020-09-23T06:58:13 [W|app|] Host julie-magill.example.com needs config rebuild
2020-09-23T06:58:13 [I|app|] Delete DHCP reservation julie-magill.example.com for julie-magill.example.com-56:6f:0d:72:00:61/10.1.4.105
2020-09-23T06:58:14 [I|app|] Create DHCP reservation julie-magill.example.com for julie-magill.example.com-56:6f:0d:72:00:61/10.1.4.105

Scenario B)
1. Edit manually /var/lib/dhcpd/dhcpd.leases file and add a bogus DHCP record.
2. Restart dhcpd service
3. Run "foreman-rake orchestration:dhcp:remove_offending subnet_name=<networkname> perform=1"

The bogus record created in step 1 will get removed, with messages in production.log similar to this:

2020-09-23T07:08:16 [W|app|] DHCP record mess.example.com-56:6f:0d:72:00:65/10.1.4.103 not found in DB, deleting
2020-09-23T07:08:16 [I|app|] DHCP record julie-magill.example.com-56:6f:0d:72:00:61/10.1.4.105 is up-to-date
2020-09-23T07:08:16 [I|app|] DHCP record shana-cloud.example.com-52:54:00:96:45:81/10.1.4.102 is up-to-date

Dropping "perform=1" from commands enables dry-run with messages present in the production.log, but not doing any changes to dhcpd.leases.

Comment 7 errata-xmlrpc 2020-10-27 12:59:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: Satellite 6.8 release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:4366


Note You need to log in before you can comment on or make changes to this bug.