Project

General

Profile

Actions

Bug #1505

closed

DHCP smart proxy failed to detect boot server: undefined method: dns_lookup

Added by Adrian Bridgett about 12 years ago. Updated about 8 years ago.

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

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

So I changed app/models/orchestration.rb to:
def bootserver_ip name_or_ip
return name_or_ip if name_or_ip =~ Net::Validations::IP_REGEXP
  1. APB
  2. return dns_ptr_record.dns_lookup(name_or_ip).ip if dns_ptr_record
  3. # Looks like we are managing DHCP but not DNS
  4. 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 :)

Actions #1

Updated by Adrian Bridgett about 12 years ago

Let's try that code snippet again:

def bootserver_ip name_or_ip
  return name_or_ip if name_or_ip =~ Net::Validations::IP_REGEXP
  dns=Resolv::DNS.new
 dns.getaddress(name_or_ip).to_s
end
Actions #2

Updated by Ohad Levy about 12 years ago

  • Status changed from New to Need more information

Looking at this patch, I'm not sure why it worked, as domain.resolver should return the correct resolved.

this code has changed a bit in 0.5, so it might be that its already resolved.

any chance you can try it again with the latest develop branch? (as I cant reproduce).

thanks!

Actions #3

Updated by Benjamin Papillon almost 11 years ago

Do you have any news on this issue? Does it works for you now that 1.1 is out?

Actions #4

Updated by Adrian Bridgett over 10 years ago

We are using pretty much stock 1.x now so I'm sure it's fixed - I certainly don't remember patching DNS stuff.

Actions #5

Updated by Tomer Brisker about 8 years ago

  • Description updated (diff)
  • Status changed from Need more information to Resolved

Seems like this was fixed about 10 versions ago. Closing.

Actions

Also available in: Atom PDF