Merge "Show ports without IP in instance table and detail"

This commit is contained in:
Zuul 2018-12-12 08:38:05 +00:00 committed by Gerrit Code Review
commit 45970a6613
3 changed files with 24 additions and 9 deletions

View File

@ -1771,11 +1771,14 @@ def _server_get_addresses(request, server, ports, floating_ips, network_names):
for port in instance_ports:
network_name = network_names.get(port.network_id)
if network_name is not None:
for fixed_ip in port.fixed_ips:
addresses[network_name].append(
_format_address(port.mac_address,
fixed_ip['ip_address'],
u'fixed'))
if port.fixed_ips:
for fixed_ip in port.fixed_ips:
addresses[network_name].append(
_format_address(port.mac_address,
fixed_ip['ip_address'],
u'fixed'))
else:
addresses[network_name] = []
port_fips = floating_ips.get(port.id, [])
for fip in port_fips:
addresses[network_name].append(

View File

@ -71,9 +71,17 @@
{% for network, ip_list in instance.addresses.items %}
<dt>{{ network|title }}</dt>
<dd>
{% for ip in ip_list %}
{% if not forloop.last %}{{ ip.addr }},&nbsp;{% else %}{{ ip.addr }}{% endif %}
{% endfor %}
{% if ip_list|length > 0 %}
{% for ip in ip_list %}
{% if not forloop.last %}
{{ ip.addr }},&nbsp;
{% else %}
{{ ip.addr }}
{% endif %}
{% endfor %}
{% else %}
{% trans "(No IP address)" %}
{% endif %}
</dd>
{% endfor %}
</dl>

View File

@ -4,6 +4,10 @@
{% if ip_groups.keys|length > 1 %}
<li><b>{{ ip_group }}</b>
{% endif %}
{{ ips|join:", " }}</li>
{% if ips|length > 0 %}
{{ ips|join:", " }}</li>
{% else %}
{% trans "(No IP address)" %}
{% endif %}
{% endfor %}
</ul>