This enables the hostname seen by other code through Hostname.GetFqdn to
be changed through the environment variable “GANETI_HOSTNAME”.
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: René Nussbaumer <rn@google.com>
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; };
"""
if hostname is None:
- return socket.getfqdn()
+ virtfqdn = vcluster.GetVirtualHostname()
+ if virtfqdn:
+ return virtfqdn
+ else:
+ return socket.getfqdn()
else:
return socket.getfqdn(hostname)