Subnet details page fails when a subnet uses IPv6 with prefix delegation

Bug #1702466 reported by Jorge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Akihiro Motoki
horizon (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Package: openstack-dashboard
Description: Ubuntu 16.04.2 LTS
Release: 16.04
openstack-dashboard:
  Installed: 2:9.1.2-0ubuntu1
  Candidate: 2:9.1.2-0ubuntu1

Description: problem occurs when using an IPv6 subnet with prefix delegation (IPv4 subnets are ok). When using web interface, if we try to see subnet details in menu System -> Networks -> Click on network name -> Click on subnet name we got the following error:

neutron-server[22658]: 2017-07-04 16:29:21.186 22864 INFO neutron.wsgi [req-0fbaad92-83ff-4179-8056-8521fbef5ff9 e85813733498d6d6b6678b77d4756aaddef55bba18166be7d3bc3a8d20a65fd8 769822d4bf984cfeb3ab910cec9fa5b3 - - -] 192.168.0.1 - - [04/Jul/2017 16:29:21] "GET /v2.0/subnetpools/prefix_delegation.json HTTP/1.1" 404 266 0.007587

The subnet is working fine. Here is the output of opentack CLI 'show' statement:

$ openstack subnet show nti-subnet-ipv6

+-------------------+-------------------------------------------------------------+
| Field | Value |
+-------------------+-------------------------------------------------------------+
| allocation_pools | 2001:DB8:1400:5026::2-2001:DB8:1400:5026:ffff:ffff:ffff:ffff|
| cidr | 2001:DB8:1400:5026::/64 |
| created_at | 2016-09-12T13:01:15 |
| description | |
| dns_nameservers | 2001:DB8:1400:2127::FFFE |
| enable_dhcp | True |
| gateway_ip | 2001:DB8:1400:5026::1 |
| host_routes | |
| id | 129bd534-7121-4759-93a2-68ac907edf74 |
| ip_version | 6 |
| ipv6_address_mode | dhcpv6-stateless |
| ipv6_ra_mode | dhcpv6-stateless |
| name | nti-subnet-ipv6 |
| network_id | d204d9a2-bb8a-48af-bfa0-f0438970d98b |
| project_id | 769822d4bf984cfeb3ab910cec9fa5b3 |
| subnetpool_id | prefix_delegation |
| updated_at | 2017-05-31T18:59:50 |
+-------------------+------------------------------------------------------------ +

Trying to find the problem, I found the file openstack_dashboard/dashboards/project/networks/subnets/views.py with this code (comments are mine):

class DetailView(tabs.TabView):
    tab_group_class = project_tabs.SubnetDetailTabs
    template_name = 'horizon/common/_detail.html'
    page_title = "{{ subnet.name|default:subnet.id }}"

    @memoized.memoized_method
    def get_data(self):
        subnet_id = self.kwargs['subnet_id']
        try:
            subnet = api.neutron.subnet_get(self.request, subnet_id)
        except Exception:
            subnet = []
            msg = _('Unable to retrieve subnet details.')
            exceptions.handle(self.request, msg,
                              redirect=self.get_redirect_url())
        else:
            if subnet.ip_version == 6:
                ipv6_modes = utils.get_ipv6_modes_menu_from_attrs(
                    subnet.ipv6_ra_mode, subnet.ipv6_address_mode)
                subnet.ipv6_modes_desc = utils.IPV6_MODE_MAP.get(ipv6_modes)

# if ('subnetpool_id' in subnet and
# subnet.subnetpool_id and
# api.neutron.is_extension_supported(self.request,
# 'subnet_allocation')):
# subnetpool = api.neutron.subnetpool_get(self.request,
# subnet.subnetpool_id)
# subnet.subnetpool_name = subnetpool.name

The commented code snippet seems to be the problem. It tries to get some information about the subnetpool. However, when a subnet uses IPv6 prefix delegation this is automatically setted when creating de subnet and if we try to read information about a subnetpool called "prefix_delegation" we get nothing (empty).

So, as showed, if I comment that code snippet the web interface succedds and show the subnet details.

I think it is necessary to correct something with this part of the code.

Thanks!

Revision history for this message
Akihiro Motoki (amotoki) wrote :

Yes, we need to add a special handling when subnetpool_id is 'prefix_delegation'. It is a special subnet pool and we cannot retrieve such subnetpool via the neutron API.

tags: added: neutron
Changed in horizon:
assignee: nobody → Akihiro Motoki (amotoki)
status: New → Triaged
importance: Undecided → Medium
tags: added: pike-back
tags: added: pike-backport-potential
removed: pike-back
Revision history for this message
Akihiro Motoki (amotoki) wrote :

Note that 9.1.2 is a mitaka release of horizon. Mitaka is no longer maintained as the upstream, so the fix will be only in the master and pike release.

Changed in horizon:
milestone: none → queens-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/510302

Changed in horizon:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/510302
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=5de6b3eb14e414364bc115225d6067e3a87ad0ac
Submitter: Zuul
Branch: master

commit 5de6b3eb14e414364bc115225d6067e3a87ad0ac
Author: Akihiro Motoki <email address hidden>
Date: Sat Oct 7 16:02:50 2017 +0000

    Show subnet detail with prefix_delegation subnetpool properly

    Subnet pool ID 'prefix_delegation' is a special subnet pool in Neutron
    and there is no real subnet pool with ID 'prefix_delegation',
    so we need to skip subnetpool_get() call
    if a subnet has 'prefix_delegation' subnet pool.

    This commit also adds unit tests which covers subnet pool operations
    in the subnet detail view.

    Change-Id: I3227a92084ee79b60d2b10262ed94a034e396306
    Closes-Bug: #1702466

Changed in horizon:
status: In Progress → Fix Released
James Page (james-page)
Changed in horizon (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 13.0.0.0b1

This issue was fixed in the openstack/horizon 13.0.0.0b1 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/534359

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/pike)

Reviewed: https://review.openstack.org/534359
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=d60ea82bfc8cd1c2a576d201e3dfe1ce9a5f99b3
Submitter: Zuul
Branch: stable/pike

commit d60ea82bfc8cd1c2a576d201e3dfe1ce9a5f99b3
Author: Akihiro Motoki <email address hidden>
Date: Sat Oct 7 16:02:50 2017 +0000

    Show subnet detail with prefix_delegation subnetpool properly

    Subnet pool ID 'prefix_delegation' is a special subnet pool in Neutron
    and there is no real subnet pool with ID 'prefix_delegation',
    so we need to skip subnetpool_get() call
    if a subnet has 'prefix_delegation' subnet pool.

    This commit also adds unit tests which covers subnet pool operations
    in the subnet detail view.

    Change-Id: I3227a92084ee79b60d2b10262ed94a034e396306
    Closes-Bug: #1702466
    (cherry picked from commit 5de6b3eb14e414364bc115225d6067e3a87ad0ac)

tags: added: in-stable-pike
Changed in horizon (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 12.0.3

This issue was fixed in the openstack/horizon 12.0.3 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.