]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/common/hostname.cc
update sources to 12.2.10
[ceph.git] / ceph / src / common / hostname.cc
index 32436534ea702b3a15d77cbe0cef8a5c93f88f2d..879fc93969ee30aed8697d7b425e1935040be7d6 100644 (file)
 
 std::string ceph_get_hostname()
 {
+  // are we in a container?  if so we would prefer the *real* hostname.
+  const char *node_name = getenv("NODE_NAME");
+  if (node_name) {
+    return node_name;
+  }
+
   char buf[1024];
   gethostname(buf, 1024);
   return std::string(buf);