Commit d0c11cf7 authored by Alexander Schreiber's avatar Alexander Schreiber
Browse files

Merge r1607 from branches/ganeti/ganeti-1.2

Use a default vnc_bind_address if None is specified

Reviewed-by: iustinp
parent e1d2aa39
......@@ -4164,20 +4164,24 @@ class LUQueryInstanceData(NoHooksLU):
idict["hvm_disk_type"] = instance.hvm_disk_type
if htkind in constants.HTS_REQ_PORT:
if instance.vnc_bind_address is None:
vnc_bind_address = constants.VNC_DEFAULT_BIND_ADDRESS
else:
vnc_bind_address = instance.vnc_bind_address
if instance.network_port is None:
vnc_console_port = None
elif instance.vnc_bind_address == constants.BIND_ADDRESS_GLOBAL:
elif vnc_bind_address == constants.BIND_ADDRESS_GLOBAL:
vnc_console_port = "%s:%s" % (instance.primary_node,
instance.network_port)
elif instance.vnc_bind_address == constants.LOCALHOST_IP_ADDRESS:
vnc_console_port = "%s:%s on node %s" % (instance.vnc_bind_address,
elif vnc_bind_address == constants.LOCALHOST_IP_ADDRESS:
vnc_console_port = "%s:%s on node %s" % (vnc_bind_address,
instance.network_port,
instance.primary_node)
else:
vnc_console_port = "%s:%s" % (instance.vnc_bind_address,
instance.network_port)
idict["vnc_console_port"] = vnc_console_port
idict["vnc_bind_address"] = instance.vnc_bind_address
idict["vnc_bind_address"] = vnc_bind_address
idict["network_port"] = instance.network_port
result[instance.name] = idict
......
......@@ -398,7 +398,10 @@ class XenHvmHypervisor(XenHypervisor):
config.write("usb = 1\n")
config.write("usbdevice = 'tablet'\n")
config.write("vnc = 1\n")
config.write("vnclisten = '%s'\n" % instance.vnc_bind_address)
if instance.vnc_bind_address is None:
config.write("vnclisten = '%s'\n" % constants.VNC_DEFAULT_BIND_ADDRESS)
else:
config.write("vnclisten = '%s'\n" % instance.vnc_bind_address)
if instance.network_port > constants.HT_HVM_VNC_BASE_PORT:
display = instance.network_port - constants.HT_HVM_VNC_BASE_PORT
......
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