[Ovirt-devel] [PATCH server] Use DNS SRV records for qpidd on appliance
Alan Pevec
apevec at gmail.com
Wed Feb 11 11:47:42 UTC 2009
On Wed, Feb 11, 2009 at 11:37 AM, Alan Pevec <apevec at gmail.com> wrote:
>> + Resolv::DNS.open do |dns|
>> + begin
>> + hostname = Socket.gethostbyname(Socket.gethostname).first
>> + lst = hostname.split('.')
>> + lst.shift
>> + domainname = lst.join('.')
>
> there really isn't something like getdomainname in ruby lib?
>
>> + res = dns.getresource("_#{service}._#{proto}.#{domainname}", Resolv::DNS::Resource::IN::SRV)
>> + server = res.target.to_s
>> + port = res.port
>
> This assumes that hostname is correctly set - I had reports where this
> wasn't the case, hence the following patch for the node:
> http://git.et.redhat.com/?p=ovirt-node.git;a=commitdiff;h=378b5f90b01e471cdf19d51fa7e81fa3139f9b80
> where all search domains, as defined in resolve.conf, are tried.
> Is there equivalent for dig +search option in Resolve::DNS ?
It does that by default when name given does not end with a dot:
http://dnssd.rubyforge.org/net-mdns/classes/Resolv/DNS/Config.html
So if "_#{service}._#{proto}.#{domainname}" does not return anything,
try again with "_#{service}._#{proto}" ?
More information about the ovirt-devel
mailing list