From 61f93afe9aef9189213db4ed25e41e7080ecad00 Mon Sep 17 00:00:00 2001 From: Ricardo Dias Date: Thu, 28 Feb 2019 11:07:55 +0000 Subject: [PATCH] common/pick_address: improves log message when no IP is found Signed-off-by: Ricardo Dias --- src/common/pick_address.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/common/pick_address.cc b/src/common/pick_address.cc index 7b284925d51..4b927ae1e2a 100644 --- a/src/common/pick_address.cc +++ b/src/common/pick_address.cc @@ -237,8 +237,16 @@ static int fill_in_one_address( const struct sockaddr *found = find_ip_in_subnet_list(cct, ifa, ipv, networks, interfaces, numa_node); if (!found) { - lderr(cct) << "unable to find any IP address in networks '" << networks - << "' interfaces '" << interfaces << "'" << dendl; + std::string ip_type = ""; + if ((ipv & CEPH_PICK_ADDRESS_IPV4) && (ipv & CEPH_PICK_ADDRESS_IPV6)) { + ip_type = "IPv4 or IPv6"; + } else if (ipv & CEPH_PICK_ADDRESS_IPV4) { + ip_type = "IPv4"; + } else { + ip_type = "IPv6"; + } + lderr(cct) << "unable to find any " << ip_type << " address in networks '" + << networks << "' interfaces '" << interfaces << "'" << dendl; return -1; } -- 2.47.3