fix(PD-disaggregation): Can not get local ip (#6792)
Signed-off-by: storyicon <storyicon@foxmail.com>
This commit is contained in:
@@ -2077,6 +2077,14 @@ def get_local_ip_by_remote() -> str:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
hostname = socket.gethostname()
|
||||
ip = socket.gethostbyname(hostname)
|
||||
if ip and ip != "127.0.0.1" and ip != "0.0.0.0":
|
||||
return ip
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# try ipv6
|
||||
try:
|
||||
s = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
|
||||
|
||||
Reference in New Issue
Block a user