Bug #1505
closedDHCP smart proxy failed to detect boot server: undefined method: dns_lookup
Description
Tried to create a new host with DHCP smart proxy and an IP address provided by myself.
This failed with:
Unable to save
failed to detect boot server: undefined method `dns_lookup' for nil:NilClass
Failed to stop Guest: Connect has been freed
Failed to perform rollback on DHCP Settings for bl-cassandra-s04.example.com - undefined method `destroy' for nil:NilClass
Failed to destroy Libirt instance bl-cassandra-s04.example.com: Connect has been freed
Failed to destroy Storage for Libirt instance bl-cassandra-s04.example.com: Connection has been closed
foreman-proxy.log:
W, [2012-02-24T09:37:34.192315 #32138] WARN -- : skipped bl-memcached-s01 - invalid address
W, [2012-02-24T09:37:34.194593 #32138] WARN -- : skipped bl-memcached-s02 - invalid address
I, [2012-02-24T09:37:34.289264 #32138] INFO -- : Enumerated hosts on 10.200.10.0
W, [2012-02-24T09:37:34.307224 #32138] WARN -- : Failed to resolve IP address for false
I, [2012-02-24T09:37:34.406806 #32138] INFO -- : Added DHCP reservation for bl-cassandra-s04.example.com (10.200.10.64 / 52:54:00:06:a9:be)
I, [2012-02-24T09:37:34.512930 #32138] INFO -- : TFTP: entry for 52:54:00:06:a9:be created successfully
W, [2012-02-24T09:38:17.693066 #32138] WARN -- : skipped hq-mgmt-p01 - invalid address
W, [2012-02-24T09:38:17.696518 #32138] WARN -- : skipped imagini-nas - invalid address
foreman/production.log:
Processing HostsController#create (for 192.168.1.220 at 2012-02-24 09:37:31) [POST]
Parameters: {"commit"=>"Submit", "action"=>"create", "authenticity_token"=>"7m4nORy3CpkeISXK8AoSy9hVeiEggwNfwjPBO/xwZh0=", "controller"=>"hosts", "host"=>{"comment"=>"", "architecture_id"=>"1", "subnet_id"=>"3", "managed"=>"true", "puppetproxy_id"=>"1", "name"=>"bl-cassandra-s04", "host_parameters_attributes"=>{"0"=>{"name"=>"", "nested"=>"", "value"=>"", "_destroy"=>""}}, "sp_mac"=>"", "powerup"=>"1", "network_type"=>"bridge", "puppetmaster_name"=>"puppet.example.com", "disk_size"=>"10", "memory"=>"8388608", "sp_name"=>"", "domain_id"=>"1", "storage_pool"=>"rootvg", "enabled"=>"1", "root_pass"=>"[FILTERED]", "build"=>"1", "medium_id"=>"6", "interface"=>"virbr0", "hypervisor_id"=>"5", "hostgroup_id"=>"6", "ptable_id"=>"9", "sp_subnet_id"=>"", "ip"=>"10.200.10.64", "environment_id"=>"1", "model_id"=>"", "disk"=>"", "sp_ip"=>"", "vcpu"=>"2", "puppetclass_ids"=>[""], "operatingsystem_id"=>"1"}}
Adding Libvirt instance storage for bl-cassandra-s04.example.com
Adding Libvirt instance for bl-cassandra-s04.example.com
failed to detect boot server: undefined method `dns_lookup' for nil:NilClass
Create DHCP reservation for bl-cassandra-s04.example.com-52:54:00:06:a9:be/10.200.10.64
Add the TFTP configuration for bl-cassandra-s04.example.com
Fetching required TFTP boot files for bl-cassandra-s04.example.com
Rolling back due to a problem:
Failed to stop Guest: Connect has been freed
Delete the TFTP configuration for bl-cassandra-s04.example.com
Failed to perform rollback on DHCP Settings for bl-cassandra-s04.example.com - undefined method `destroy' for nil:NilClass
Removing Libvirt instance for for bl-cassandra-s04.example.com
Failed to destroy Libirt instance bl-cassandra-s04.example.com: Connect has been freed
Removing Libvirt instance storage for bl-cassandra-s04.example.com
Failed to destroy Storage for Libirt instance bl-cassandra-s04.example.com: Connection has been closed
Failed to save: failed to detect boot server: undefined method `dns_lookup' for nil:NilClass, Failed to stop Guest: Connect has been freed, Failed to perform rollback on DHCP Settings for bl-cassandra-s04.example.com - undefined method `destroy' for nil:NilClass, Failed to destroy Libirt instance bl-cassandra-s04.example.com: Connect has been freed, Failed to destroy Storage for Libirt instance bl-cassandra-s04.example.com: Connection has been closed
Rendering template within layouts/application
Rendering hosts/new
I've applied the patch from http://theforeman.org/issues/1420, however this changes the error to:
failed to detect boot server (foreman-proxy.example.com): getaddrinfo: Name or service not known
Our DNS records are:
foreman-proxy.example.com. 86400 IN CNAME foreman-proxy-01.prod.example.com.
foreman-proxy-01.prod.example.com. 86400 IN CNAME hq-mgmt-p01.internal.hq.example.com.
hq-mgmt-p01.internal.hq.example.com. 86400 IN A 192.168.1.12
12.1.168.192.in-addr.arpa. 86400 IN PTR hq-mgmt-p01.internal.hq.example.com.
hq-mgmt-p01.internal.hq.example.com. 86400 IN A 192.168.1.12
def bootserver_ip name_or_ip
return name_or_ip if name_or_ip =~ Net::Validations::IP_REGEXP
- APB
- return dns_ptr_record.dns_lookup(name_or_ip).ip if dns_ptr_record
- # Looks like we are managing DHCP but not DNS
- domain.resolver.getaddress(name_or_ip).to_s
dns=Resolv::DNS.new
dns.getaddress(name_or_ip).to_s
end
Which got a little further:
DHCP conflict detected - expected bl-cassandra-s04.example.com-52:54:00:06:a9:be/10.200.10.64, found bl-cassandra-s04.example.com-52:54:00:06:a9:be/10.200.10.64, bl-cassandra-s04.example.com-52:54:00:06:a9:be/10.200.10.64
(note the duplication in the error as well)
I manually removed the lease and hey presto it's all working now :)