From 394a3274fff508eef856b2047abbc70c20aad912 Mon Sep 17 00:00:00 2001 From: Anton Todorov Date: Wed, 13 May 2026 17:18:05 +0300 Subject: [PATCH] F #7675: option to configure FQDN for remote_addr So the resolver on the host will provide the IP address for the opennebula-gate service. This way, with DNS view or a line in /etc/hosts the tproxy service will pick the desired IP to connect to the opennebula-gate --- src/vnm_mad/remotes/lib/tproxy.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/vnm_mad/remotes/lib/tproxy.rb b/src/vnm_mad/remotes/lib/tproxy.rb index 1d45c38b8b..f9f542fa8b 100644 --- a/src/vnm_mad/remotes/lib/tproxy.rb +++ b/src/vnm_mad/remotes/lib/tproxy.rb @@ -44,7 +44,20 @@ def self.setup_tproxy(nic, direction) && (nets & nic.slice(:network, :network_id).values.map(&:to_s)).empty? next if conf[:service_port].nil? - next if conf[:remote_addr].nil? || conf[:remote_addr] !~ Resolv::IPv4::Regex + next if conf[:remote_addr].nil? || conf[:remote_addr].to_s.strip.empty? + + unless conf[:remote_addr] =~ Resolv::IPv4::Regex + begin + remote_ip = Resolv.getaddress(conf[:remote_addr]) + next unless remote_ip =~ Resolv::IPv4::Regex + + OpenNebula.log_info "Resolved remote_addr #{conf[:remote_addr]} to #{remote_ip}" + conf[:remote_addr] = remote_ip + rescue Resolv::ResolvError + OpenNebula.log_warning "Can't resolve remote_addr #{conf[:remote_addr]}. Skipping." + next + end + end next if conf[:remote_port].nil? opts = {