Bug #17847
closedMS DHCP Leases not being deleted
Description
When I'm deleting a host Foreman is sending a request to smart proxy to delete the reservation, but the lease will still exist until the expiration date.
Currently, smart-proxy (dhcp_native_ms module) doesn't have a functionality of a lease deletion.
I don't know if it's a bug or it's the expected behavior, but if we look at the scenario where we are provisioning a lot of hosts, our range is just 100 IPs, and we're deleting them after 4 hours, the lease will still exist and DHCP server won't provide an option for another host to be provisioned (unused IPs will be 0).
It can be avoided by setting up the TTL for a few hours, but this is not going to solve the issue, since, MS DHCP is not going to remove the lease immediately (after it got expired).
How does it affect my environment and most likely others as well?
Let's say that i have one subnet configured in Foreman with the range of 50 IPs, I've configured in the smart proxy a TTL of 3 days for this subnet.
I've just created 50 hosts on top of this subnet, 1 hour later, I've deleted the 10 hosts, now I'm trying to create hosts, unfortunately, I'm getting the following error:
{ "error": {"id":null,"errors":{"interfaces.ip":["can't be blank"],"interfaces.ip6":["can't be blank"]},"full_messages":["Ip can't be blank","Ip6 can't be blank"]} }
This is due to unfreed resources (lease) after the deletion of the host object has been performed.
Another solution would be executing a "delete lease" after the reservation got deleted:
c:\Windows\System32\netsh.exe -c dhcp server 127.0.0.1 scope <my scope> delete lease <my lease>
Any ideas?
Updated by Anonymous almost 8 years ago
- Related to Feature #15554: Add lease deletion facility to dhcp providers added
Updated by Anonymous almost 8 years ago
- Status changed from New to Duplicate
- Priority changed from High to Normal
This isn't an issue in smart-proxy version 1.14 and higher, and this partially duplicates http://projects.theforeman.org/issues/15554. Marking it as a duplicate.
Updated by Alex Brodov almost 8 years ago
Dmitri Dolguikh wrote:
This isn't an issue in smart-proxy version 1.14 and higher, and this partially duplicates http://projects.theforeman.org/issues/15554. Marking it as a duplicate.
I'm not sure that it's a good idea to mark it as duplicate since we're applying a fix to release 1.13, and not to 1.14, so people would be able to update from 1.13.3 to 1.13.4.
What do you think about it?
Updated by Anonymous almost 8 years ago
This isn't a bug but a feature: smart-proxy wasn't supposed to delete lease records originally (and there's code there to prevent it from doing just that). Unless the implementation is trivial (we are talking one-liner or so), I don't think such a change will be accepted into 1.13 branch, as it is maintenance-only at this point.
I suggested this already, but 1.14 is a better release if you are deploying smart-proxy on Windows.
Updated by Alex Brodov almost 8 years ago
Dmitri Dolguikh wrote:
This isn't a bug but a feature: smart-proxy wasn't supposed to delete lease records originally (and there's code there to prevent it from doing just that). Unless the implementation is trivial (we are talking one-liner or so), I don't think such a change will be accepted into 1.13 branch, as it is maintenance-only at this point.
I suggested this already, but 1.14 is a better release if you are deploying smart-proxy on Windows.
I've just created a PR, it's a few lines of change, but it definitely worth it: https://github.com/theforeman/smart-proxy/pull/487
Please review it
Updated by Alex Brodov almost 8 years ago
Alex Brodov wrote:
Dmitri Dolguikh wrote:
This isn't a bug but a feature: smart-proxy wasn't supposed to delete lease records originally (and there's code there to prevent it from doing just that). Unless the implementation is trivial (we are talking one-liner or so), I don't think such a change will be accepted into 1.13 branch, as it is maintenance-only at this point.
I suggested this already, but 1.14 is a better release if you are deploying smart-proxy on Windows.
I've just created a PR, it's a few lines of change, but it definitely worth it: https://github.com/theforeman/smart-proxy/pull/487
Please review it
Here's the new link: https://github.com/theforeman/smart-proxy/pull/488