Commit e91b297c authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

netutils: Use virtual hostname if set

This enables the hostname seen by other code through Hostname.GetFqdn to
be changed through the environment variable “GANETI_HOSTNAME”.
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarRené Nussbaumer <>
parent 8c37d618
......@@ -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
return socket.getfqdn()
return socket.getfqdn(hostname)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment