Project

General

Profile

Actions

Bug #5481

closed

Foreman Proxy unable to remove DHCP reservation: "IP / mac - is static - unable to delete"

Added by Dmitry Sakun over 10 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
DHCP
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Hi Guys,

Foreman Proxy running on windows fail to delete previously created reservation. This one exists since 1.5 I believe.

native_ms module.

DHCP 'hostname' option (12) is wrongly enumerated as install_path and marks the record as NON-deletable and throw an exception (FP log):

---

D, [2014-04-28T23:04:32.519269 #2604] DEBUG -- : executing: c:\windows\sysnative\cmd.exe /c c:\Windows\System32\netsh.exe -c dhcp server \\DHCP.SERVER scope 10.8.67.0 Show ReservedOptionValue 10.8.67.25
I, [2014-04-28T23:04:33.018481 #2604]  INFO -- : Queried 10.8.67.25 options
D, [2014-04-28T23:04:33.018481 #2604] DEBUG -- : found option nextServer
D, [2014-04-28T23:04:33.018481 #2604] DEBUG -- : found option filename
D, [2014-04-28T23:04:33.018481 #2604] DEBUG -- : found option *install_path* <-- Should be hostname.
D, [2014-04-28T23:04:33.018481 #2604] DEBUG -- : {:install_path=>"hostname.domain.com", :filename=>"pxelinux.0", :nextServer=>"172.25.8.50"}
D, [2014-04-28T23:04:33.018481 #2604] DEBUG -- : {:install_path=>"hostname.domain.com", :mac=>"00:50:56:a3:3c:91", :subnet=>10.8.67.0/255.255.255.0, :nextServer=>"172.25.8.50", :filename=>"pxelinux.0", :ip=>"10.8.67.25"}
D, [2014-04-28T23:04:33.018481 #2604] DEBUG -- : Added 10.8.67.25 / 00:50:56:a3:3c:91 to 10.8.67.0/255.255.255.0
D, [2014-04-28T23:04:33.018481 #2604] DEBUG -- : Lazy loaded 10.8.67.0/255.255.255.0 records
E, [2014-04-28T23:04:33.018481 #2604] ERROR -- : 10.8.67.25 / 00:50:56:a3:3c:91 is static - unable to delete
D, [2014-04-28T23:04:33.018481 #2604] DEBUG -- : C:/Program Files (x86)/smart-proxy/bin/../lib/proxy/dhcp/server/native_ms.rb:18:in `delRecord'
C:/Program Files (x86)/smart-proxy/bin/../lib/dhcp_api.rb:109:in `DELETE /dhcp/:network/:record'

---

netsh output:

---

C:\>netsh.exe -c dhcp server \\DHCP.SERVER scope 10.8.67.0 Show ReservedOptionValue 10.8.67.25

Changed the current scope context to 10.8.67.0 scope.

Options for the Reservation Address 10.8.67.25 in the Scope 10.8.67.0 :

        DHCP Standard Options :
        General Option Values:
        OptionId : 66
        Option Value:
                Number of Option Elements = 1
                Option Element Type = STRING
                Option Element Value = 172.25.8.50
        OptionId : 60
        Option Value:
                Number of Option Elements = 1
                Option Element Type = STRING
                Option Element Value =
        OptionId : 67
        Option Value:
                Number of Option Elements = 1
                Option Element Type = STRING
                Option Element Value = pxelinux.0
        OptionId : 12
        Option Value:
                Number of Option Elements = 1
                Option Element Type = STRING
                Option Element Value = hostname.domain.com
Command completed successfully.

---

The test if the record is 'deleteable' is based on 'hostname' and it's done in native_ms.rb 'loadSubnetData' function:

---

            if opts.include? :hostname
              Proxy::DHCP::Reservation.new opts.merge({:deleteable => true})

---

Option assignment is done in dhcp.rb:

Standard = {
:hostname => {:code => 12, :kind => "String" }, # The host's name
:PXEClient => {:code => 60, :kind => "String" }, # Needs to be empty for foreman to function
:nextServer => {:code => 66, :kind => "String" }, # From where we download the pxeboot image via TFTP
:filename => {:code => 67, :kind => "String" } # The pxeboot image
}
SUNW = {
:root_server_ip => {:code => 2, :kind => "IPAddress" }, # 192.168.216.241
:root_server_hostname => {:code => 3, :kind => "String" }, # mediahost
:root_path_name => {:code => 4, :kind => "String" }, # /vol/solgi_5.10/sol10_hw0910/Solaris_10/Tools/Boot
:install_server_ip => {:code => 10, :kind => "IPAddress" }, # 192.168.216.241
:install_server_name => {:code => 11, :kind => "String" }, # mediahost
:install_path => {:code => 12, :kind => "String" }, # /vol/solgi_5.10/sol10_hw0910
:sysid_server_path => {:code => 13, :kind => "String" }, # 192.168.216.241:/vol/jumpstart/sysidcfg/sysidcfg_primary
:jumpstart_server_path => {:code => 14, :kind => "String" } # 192.168.216.241:/vol/jumpstart
}

Related issues 3 (0 open3 closed)

Related to Smart Proxy - Bug #4148: Unable to delete DHCP reservations on MS DCHP serversResolved01/21/2014Actions
Related to Smart Proxy - Bug #13129: Intermittent failures in native MS test_records_should_have_options testsClosed01/12/2016Actions
Has duplicate Smart Proxy - Bug #10556: Windows DHCP support Shows DHCP Entries as Leases and no HostnamesDuplicate05/19/2015Actions
Actions

Also available in: Atom PDF