Show ports without IP in instance table and detail
Previously instance ports without IP address were not shown because api.neutron.servers_update_addresses() ignored ports without IP address. This commit changes servers_update_addresses() to include a special symbol (None) representing "No IP address" in "addresses" attribute in "server" object. "(No IP address)" will be shown for ports without IP addresses now. Closes-Bug: #1804016 Change-Id: I46699731ab515667b8cdf97ef68bdb8cbfe0b563
This commit is contained in:
@@ -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(
|
||||
|
@@ -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 }}, {% else %}{{ ip.addr }}{% endif %}
|
||||
{% endfor %}
|
||||
{% if ip_list|length > 0 %}
|
||||
{% for ip in ip_list %}
|
||||
{% if not forloop.last %}
|
||||
{{ ip.addr }},
|
||||
{% else %}
|
||||
{{ ip.addr }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{% trans "(No IP address)" %}
|
||||
{% endif %}
|
||||
</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user