Bug #8492
openunable to overwrite BMC IP/mac address
Description
When attempting to add a BMC interface to a host and the BMC has an existing lease, or trying to change either the IP or mac address of an already configured BMC interface (regular interfaces were not tested), a modal dialog appears informing you that "Conflicts have been detected". After the notice is dismissed, the "overwrite" button does not appear in place of the "submit" button. Clicking "submit" [again] repeats the the conflict notification cycle in an endless loop. Manually deleting all leases for the BMC mac address prevents the conflicts dialog from being presented and avoids entered into the endless "ack"/"submit" loop.
The easiest way to reproduce this issue is to attempt to change the mac address on an already configured BMC interface.
This issue has been observered in both 1.5.3 and 1.6.3.
Logs from attempt to change 00:25:90:d7:06:d0
to 00:25:90:d7:06:d1
production.log
Started PUT "/hosts/dec19.example.org" for 10.10.90.48 at 2014-11-24 11:34:52 -0700 Processing by HostsController#update as */* Parameters: {"utf8"=>"✓", "authenticity_token"=>"rKHt0l+bplIa5bls+PM9sO2oq4Rj34jDpp+tK15a6fI=", "host"=>{"name"=>"dec19", "hostgroup_id"=>"5", "environment_id"=>"1", "puppet_ca_proxy_id"=>"2", "puppet_proxy_id"=>"2", "config_group_ids"=>["", "4"], "puppetclass_ids"=>["", "746"], "managed"=>"1", "progress_report_id"=>"[FILTERED]", "domain_id"=>"6", "realm_id"=>"", "mac"=>"00:25:90:c8:7b:82", "subnet_id"=>"1", "ip"=>"10.10.27.37", "interfaces_attributes"=>{"0"=>{"_destroy"=>"false", "mac"=>"00:25:90:d7:06:d1", "name"=>"dec19-bmc", "domain_id"=>"6", "subnet_id"=>"1", "ip"=>"10.10.27.38", "username"=>"ADMIN", "password"=>"[FILTERED]", "provider"=>"IPMI", "id"=>"21"}, "new_interfaces"=>{"_destroy"=>"false", "type"=>"Nic::Managed", "mac"=>"", "name"=>"", "domain_id"=>"", "ip"=>"", "provider"=>"IPMI"}}, "architecture_id"=>"1", "operatingsystem_id"=>"20", "medium_id"=>"6", "ptable_id"=>"26", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"1-Users", "enabled"=>"1", "model_id"=>"19", "comment"=>"", "overwrite"=>"false"}, "id"=>"dec19.example.org"} DHCP records dec19-bmc.example.org-00:25:90:d7:06:d0/10.10.27.38 already exists Failed to save: Conflict DHCP records dec19-bmc.example.org-00:25:90:d7:06:d0/10.10.27.38 already exists Rendered hosts/_conflicts.html.erb (0.3ms) Rendered hosts/_progress.html.erb (0.1ms) Rendered config_groups/_config_group.html.erb (7.0ms) Rendered config_groups/_config_group.html.erb (5.9ms) Rendered config_groups/_config_group.html.erb (4.6ms) Rendered config_groups/_config_group.html.erb (5.6ms) Rendered config_groups/_config_group.html.erb (6.1ms) Rendered config_groups/_config_group.html.erb (6.7ms) Rendered config_groups/_config_group.html.erb (6.3ms) Rendered config_groups/_config_groups_selection.html.erb (49.1ms) Rendered puppetclasses/_selectedClasses.html.erb (1.7ms) Rendered puppetclasses/_classes_in_groups.html.erb (0.6ms) Started GET "/tasks/551687c1-b191-466c-bd33-19d4d6635435" for 10.10.90.48 at 2014-11-24 11:34:54 -0700 Processing by TasksController#show as */* Parameters: {"id"=>"551687c1-b191-466c-bd33-19d4d6635435"} Rendered tasks/_list.html.erb (0.2ms) Completed 200 OK in 9ms (Views: 1.1ms | ActiveRecord: 0.9ms) Rendered puppetclasses/_classes.html.erb (1092.3ms) Rendered puppetclasses/_class_selection.html.erb (1198.3ms) Rendered common/_domain.html.erb (10.9ms) Rendered hosts/_interfaces.html.erb (15.8ms) Rendered hosts/_interfaces.html.erb (9.0ms) Rendered common/os_selection/_architecture.html.erb (6.8ms) Rendered common/os_selection/_operatingsystem.html.erb (12.5ms) Rendered hosts/_operating_system.html.erb (25.7ms) Rendered hosts/_unattended.html.erb (75.8ms) Rendered puppetclasses/_class_parameters.html.erb (0.0ms) Rendered puppetclasses/_classes_parameters.html.erb (11.5ms) Rendered common_parameters/_inherited_parameters.html.erb (0.2ms) Rendered common_parameters/_puppetclass_parameter.html.erb (2.7ms) Rendered common_parameters/_puppetclasses_parameters.html.erb (4.3ms) Rendered common_parameters/_parameter.html.erb (1.7ms) Rendered common_parameters/_parameters.html.erb (5.5ms) Rendered hosts/_form.html.erb (1342.1ms) Rendered hosts/edit.html.erb within layouts/application (1345.2ms) Rendered home/_user_dropdown.html.erb (1.7ms) Read fragment views/tabs_and_title_records-1 (0.2ms) Rendered home/_topbar.html.erb (2.9ms) Rendered layouts/base.html.erb (4.9ms) Completed 200 OK in 2483ms (Views: 1331.7ms | ActiveRecord: 44.7ms)
proxy.log
E, [2014-11-24T11:34:52.856723 #8655] ERROR -- : Record 10.10.27.0/00:25:90:d7:06:d1 not found 10.10.27.4 - - [24/Nov/2014 11:34:52] "GET /10.10.27.0/00:25:90:d7:06:d1 HTTP/1.1" 404 47 0.0812 10.10.27.4 - - [24/Nov/2014 11:34:53] "GET /10.10.27.0/10.10.27.38 HTTP/1.1" 200 122 0.1534 E, [2014-11-24T11:34:53.202950 #8655] ERROR -- : Record 10.10.27.0/00:25:90:d7:06:d1 not found 10.10.27.4 - - [24/Nov/2014 11:34:53] "GET /10.10.27.0/00:25:90:d7:06:d1 HTTP/1.1" 404 47 0.0781 10.10.27.4 - - [24/Nov/2014 11:34:53] "GET /10.10.27.0/10.10.27.38 HTTP/1.1" 200 122 0.0721 10.10.27.4 - - [24/Nov/2014 11:34:53] "GET /serverName HTTP/1.1" 200 29 0.0005 10.10.27.4 - - [24/Nov/2014 11:34:53] "GET /10.10.27.0/00:25:90:c8:7b:82 HTTP/1.1" 200 170 0.0822 10.10.27.4 - - [24/Nov/2014 11:34:53] "GET /10.10.27.0/10.10.27.37 HTTP/1.1" 200 170 0.1360
Updated by Joshua Hoblitt over 9 years ago
The issue appears to be a bit more extensive than I first realized, even trying to change the password on an existing bmc interface will trigger the dhcp conflict warning.
I'm provisioning brand new bare metal today and not having the pxe mac and bmc mac associated via foreman was going to require the manual keying process to be essentially reapeted in the future. I tried a couple of different ways to work around this problem, including injecting the host object for the bmc via omshell
, but I was unable to escape the finite submit loop if there was an existing lease or host object. Manual editing of the dhcpd.lease
file is impractical at the volume I need to process (40+ hosts) and I thought I was going to have to resort to automated parsing/purging of the lease file.
As a last ditch effort, I hard wired Host::Managed#overwrite?
to return true. While incredibly crude, this does allow me to add and edit bmc interfaces.
diff --git a/app/models/host/managed.rb b/app/models/host/managed.rb index 7eda3c3..317d5e0 100644 --- a/app/models/host/managed.rb +++ b/app/models/host/managed.rb @@ -606,6 +606,7 @@ class Host::Managed < Host::Base def overwrite? @overwrite ||= false + true end # We have to coerce the value back to boolean. It is not done for us by the framework.