diff --git a/lib/netutils.py b/lib/netutils.py index 42f8e8ba12547686f0b7ae8588b8e5b8f48a676b..48d0f98b836dd6a4e1ee013039b1cacd548fce30 100644 --- a/lib/netutils.py +++ b/lib/netutils.py @@ -38,6 +38,7 @@ import logging from ganeti import constants from ganeti import errors from ganeti import utils +from ganeti import vcluster # Structure definition for getsockopt(SOL_SOCKET, SO_PEERCRED, ...): # struct ucred { pid_t pid; uid_t uid; gid_t gid; }; @@ -189,7 +190,11 @@ class Hostname: """ if hostname is None: - return socket.getfqdn() + virtfqdn = vcluster.GetVirtualHostname() + if virtfqdn: + return virtfqdn + else: + return socket.getfqdn() else: return socket.getfqdn(hostname)