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:
|
for port in instance_ports:
|
||||||
network_name = network_names.get(port.network_id)
|
network_name = network_names.get(port.network_id)
|
||||||
if network_name is not None:
|
if network_name is not None:
|
||||||
for fixed_ip in port.fixed_ips:
|
if port.fixed_ips:
|
||||||
addresses[network_name].append(
|
for fixed_ip in port.fixed_ips:
|
||||||
_format_address(port.mac_address,
|
addresses[network_name].append(
|
||||||
fixed_ip['ip_address'],
|
_format_address(port.mac_address,
|
||||||
u'fixed'))
|
fixed_ip['ip_address'],
|
||||||
|
u'fixed'))
|
||||||
|
else:
|
||||||
|
addresses[network_name] = []
|
||||||
port_fips = floating_ips.get(port.id, [])
|
port_fips = floating_ips.get(port.id, [])
|
||||||
for fip in port_fips:
|
for fip in port_fips:
|
||||||
addresses[network_name].append(
|
addresses[network_name].append(
|
||||||
|
@@ -71,9 +71,17 @@
|
|||||||
{% for network, ip_list in instance.addresses.items %}
|
{% for network, ip_list in instance.addresses.items %}
|
||||||
<dt>{{ network|title }}</dt>
|
<dt>{{ network|title }}</dt>
|
||||||
<dd>
|
<dd>
|
||||||
{% for ip in ip_list %}
|
{% if ip_list|length > 0 %}
|
||||||
{% if not forloop.last %}{{ ip.addr }}, {% else %}{{ ip.addr }}{% endif %}
|
{% for ip in ip_list %}
|
||||||
{% endfor %}
|
{% if not forloop.last %}
|
||||||
|
{{ ip.addr }},
|
||||||
|
{% else %}
|
||||||
|
{{ ip.addr }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
{% trans "(No IP address)" %}
|
||||||
|
{% endif %}
|
||||||
</dd>
|
</dd>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</dl>
|
</dl>
|
||||||
|
@@ -4,6 +4,10 @@
|
|||||||
{% if ip_groups.keys|length > 1 %}
|
{% if ip_groups.keys|length > 1 %}
|
||||||
<li><b>{{ ip_group }}</b>
|
<li><b>{{ ip_group }}</b>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ ips|join:", " }}</li>
|
{% if ips|length > 0 %}
|
||||||
|
{{ ips|join:", " }}</li>
|
||||||
|
{% else %}
|
||||||
|
{% trans "(No IP address)" %}
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
Reference in New Issue
Block a user