Instance: show network info even if name is empty

Previously, when a network name is an empty string,
network information of server interfaces will be empty,
so we cannot distinguish server interfaces.

Also network name in the instance detail page is capitalized
but there is no need to capitalize it and such information like
network name should be displayed as-is. This is not directly
related to the bug fixed by this commit, but it is simple enough
and related to network name, so I believe it is okay.

Change-Id: I2f2ad9b6bf50a2b53e79e4929d877111f875bd5b
Closes-Bug: #1805812
This commit is contained in:
Akihiro Motoki 2018-11-30 01:04:53 +09:00 committed by Ivan Kolodyazhny
parent 0e75e2fb80
commit 65f14e5d79
2 changed files with 3 additions and 2 deletions

View File

@ -1735,7 +1735,8 @@ def servers_update_addresses(request, servers, all_tenants=False):
ports_floating_ips[fip.port_id].append(fip)
# Map network id to its name
network_names = dict(((network.id, network.name) for network in networks))
network_names = dict((network.id, network.name_or_id)
for network in networks)
for server in servers:
try:

View File

@ -69,7 +69,7 @@
<hr class="header_rule">
<dl class="dl-horizontal">
{% for network, ip_list in instance.addresses.items %}
<dt>{{ network|title }}</dt>
<dt>{{ network }}</dt>
<dd>
{% for ip in ip_list %}
{% if not forloop.last %}{{ ip.addr }},&nbsp;{% else %}{{ ip.addr }}{% endif %}