diff --git a/openstack_dashboard/dashboards/project/instances/tables.py b/openstack_dashboard/dashboards/project/instances/tables.py index 324430bafc..5ae25e01f5 100644 --- a/openstack_dashboard/dashboards/project/instances/tables.py +++ b/openstack_dashboard/dashboards/project/instances/tables.py @@ -27,6 +27,7 @@ from django.utils.translation import pgettext_lazy from django.utils.translation import string_concat from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy +import netaddr from horizon import exceptions from horizon import messages @@ -969,16 +970,9 @@ def get_ips(instance): ip_groups = {} for ip_group, addresses in instance.addresses.items(): - ip_groups[ip_group] = {} - ip_groups[ip_group]["floating"] = [] - ip_groups[ip_group]["non_floating"] = [] - - for address in addresses: - if ('OS-EXT-IPS:type' in address and - address['OS-EXT-IPS:type'] == "floating"): - ip_groups[ip_group]["floating"].append(address) - else: - ip_groups[ip_group]["non_floating"].append(address) + ips = [addr['addr'] for addr in addresses] + ips.sort(key=lambda ip: netaddr.IPAddress(ip).version) + ip_groups[ip_group] = ips context = { "ip_groups": ip_groups, diff --git a/openstack_dashboard/dashboards/project/instances/templates/instances/_instance_ips.html b/openstack_dashboard/dashboards/project/instances/templates/instances/_instance_ips.html index 7b4226b90c..b19e83fed5 100644 --- a/openstack_dashboard/dashboards/project/instances/templates/instances/_instance_ips.html +++ b/openstack_dashboard/dashboards/project/instances/templates/instances/_instance_ips.html @@ -1,19 +1,9 @@ {% load i18n %} +