The network metadata should be more useful

Bug #1676363 reported by Dr. Jens Harbott
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Confirmed
Medium
Unassigned

Bug Description

There are three issues affecting the useability of the network information presented to an instance via the metadata API:

1. For networks using DHCP, the IP address information is omitted. There are however use cases where an instance would want to use static address configuration even when DHCP is available. So adding the information would make deploying such an instance easier.

2. For IPv6 subnets, netmasks should not be presented as bitmasks, but in prefixlen notation instead, e.g. "/16" instead of "ffff::".

3. For IPv6 subnets, the type is always "ipv6_dhcp", regardless of whether the subnet has mode "slaac", "dhcpv6-stateless" or "dhcpv6-stateful". This makes is impossible for an instance to decide whether it should use DHCPv6 for address and/or additional configuration.

Here is the current output for an instance with one network for IPv4 and one for IPv6:

{
  "services": [

  ],
  "networks": [
    {
      "network_id": "fb1ca77c-624d-42ab-9102-16f21313a6cb",
      "link": "tap92b3d1dd-12",
      "type": "ipv4_dhcp",
      "id": "network0"
    },
    {
      "network_id": "6179a9e5-e370-4ee4-8ff6-d83f118b08fd",
      "link": "tap2fa5e368-de",
      "type": "ipv6_dhcp",
      "id": "network1"
    }
  ],
  "links": [
    {
      "ethernet_mac_address": "fa:16:3e:e0:b3:ad",
      "mtu": 1500,
      "type": "ovs",
      "id": "tap92b3d1dd-12",
      "vif_id": "92b3d1dd-12c2-49cd-82a5-298c071896fd"
    },
    {
      "ethernet_mac_address": "fa:16:3e:aa:71:95",
      "mtu": 1500,
      "type": "ovs",
      "id": "tap2fa5e368-de",
      "vif_id": "2fa5e368-de18-416f-b6f7-063687d4b9e5"
    }
  ]
}

Tags: metadata
Changed in nova:
assignee: nobody → Dr. Jens Rosenboom (j-rosenboom-j)
status: New → In Progress
Revision history for this message
Jay Pipes (jaypipes) wrote :

Hi Jens, I think you possibly make the case for splitting this into two bugs. One for the status IP addressing information and the other for the IPv6 specifics.

Changed in nova:
importance: Undecided → Medium
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :

@Jay: During developing the patch series, I found even a third issue. As the patches stack quite nicely on top of each other, I would prefer keeping this together, though.

Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :
Download full text (3.7 KiB)

For reference, here is the sample output before and after my patch series, for an instance with three interfaces (dual-stack slaac, dhcpv6-stateless, dhcpv6-stateful):

Old:

{
  "services": [

  ],
  "networks": [
    {
      "network_id": "58469bbc-1b36-4e2d-a098-4096ab0e956b",
      "link": "tapd15840ff-85",
      "type": "ipv4_dhcp",
      "id": "network0"
    },
    {
      "network_id": "58469bbc-1b36-4e2d-a098-4096ab0e956b",
      "link": "tapd15840ff-85",
      "type": "ipv6_dhcp",
      "id": "network1"
    },
    {
      "network_id": "7d398f31-1179-4dcd-b322-017f1dd3fa91",
      "link": "tap6d9c3001-5a",
      "type": "ipv6_dhcp",
      "id": "network2"
    },
    {
      "network_id": "b41c9da6-95b5-4d79-874a-8ff66eefe691",
      "link": "tapee59b935-fe",
      "type": "ipv6_dhcp",
      "id": "network3"
    }
  ],
  "links": [
    {
      "ethernet_mac_address": "fa:16:3e:21:90:c1",
      "mtu": 1450,
      "type": "ovs",
      "id": "tapd15840ff-85",
      "vif_id": "d15840ff-85cb-4d07-b101-9bc25e228705"
    },
    {
      "ethernet_mac_address": "fa:16:3e:90:5f:b3",
      "mtu": 1450,
      "type": "ovs",
      "id": "tap6d9c3001-5a",
      "vif_id": "6d9c3001-5a51-4f76-a22e-724c9d31236b"
    },
    {
      "ethernet_mac_address": "fa:16:3e:7a:38:15",
      "mtu": 1450,
      "type": "ovs",
      "id": "tapee59b935-fe",
      "vif_id": "ee59b935-fee0-41cb-b118-b6a2f28f455b"
    }
  ]
}

New:

{
  "services": [

  ],
  "networks": [
    {
      "network_id": "58469bbc-1b36-4e2d-a098-4096ab0e956b",
      "type": "ipv4_dhcp",
      "netmask": "255.255.255.192",
      "link": "tapd15840ff-85",
      "routes": [
        {
          "netmask": "0.0.0.0",
          "network": "0.0.0.0",
          "gateway": "10.0.0.1"
        }
      ],
      "ip_address": "10.0.0.8",
      "id": "network0"
    },
    {
      "network_id": "58469bbc-1b36-4e2d-a098-4096ab0e956b",
      "type": "ipv6_slaac",
      "netmask": "\/64",
      "link": "tapd15840ff-85",
      "routes": [
        {
          "netmask": "\/0",
          "network": "::",
          "gateway": "fdcd:6ce3:aac5::1"
        }
      ],
      "ip_address": "fdcd:6ce3:aac5:0:f816:3eff:fe21:90c1",
      "id": "network1"
    },
    {
      "network_id": "7d398f31-1179-4dcd-b322-017f1dd3fa91",
      "type": "ipv6_dhcpv6-stateless",
      "netmask": "\/64",
      "link": "tap6d9c3001-5a",
      "routes": [
        {
          "netmask": "\/0",
          "network": "::",
          "gateway": "fdcd:6ce3:aac5:1::1"
        }
      ],
      "ip_address": "fdcd:6ce3:aac5:1:f816:3eff:fe90:5fb3",
      "id": "network2"
    },
    {
      "network_id": "b41c9da6-95b5-4d79-874a-8ff66eefe691",
      "type": "ipv6_dhcpv6-stateful",
      "netmask": "\/64",
      "link": "tapee59b935-fe",
      "routes": [
        {
          "netmask": "\/0",
          "network": "::",
          "gateway": "fdcd:6ce3:aac5:3::1"
        }
      ],
      "ip_address": "fdcd:6ce3:aac5:3::c",
      "id": "network3"
    }
  ],
  "links": [
    {
      "ethernet_mac_address": "fa:16:3e:21:90:c1",
      "mtu": 1450,
      "type": "ovs",
      "id": "tapd15840ff-85",
      "vif_id": "d15840ff-85cb-4d07-b101-9bc25e2287...

Read more...

Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :

Looking at how the subnet type is being parsed by cloud-init here[1] it seems that "ipv6_slaac" and "ipv6_dhcpv6-stateful" will both work fine - at least in that regard -, but "ipv6_dhcpv6-stateless" will be interpreted as dhcpv6 instead of slaac.

They also seem to completely ignore any netmask and routes information.

[1] https://git.launchpad.net/cloud-init/tree/cloudinit/sources/helpers/openstack.py#n571

Changed in nova:
assignee: Dr. Jens Rosenboom (j-rosenboom-j) → Stephen Finucane (stephenfinucane)
Changed in nova:
assignee: Stephen Finucane (stephenfinucane) → Dr. Jens Rosenboom (j-rosenboom-j)
Changed in nova:
assignee: Dr. Jens Rosenboom (j-rosenboom-j) → Dan Peschman (dpeschman)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/450297
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=ccebded0cbb654be18db5b4e0e7f8b8a3a7cacdb
Submitter: Jenkins
Branch: master

commit ccebded0cbb654be18db5b4e0e7f8b8a3a7cacdb
Author: Jens Rosenboom <email address hidden>
Date: Mon Mar 27 15:33:25 2017 +0000

    Update network metadata type field for IPv6

    Currently it is not possible to decide from looking at the network
    metadata whether an IPv6 subnet is using slaac, dhcpv6-stateless or
    dhcpv6-stateful.

    So we add ipv6_address_mode information into the subnet metadata when
    it is available and use that to construct the subnet type.

    As a result, the type for a subnet with mode SLAAC will be "ipv6_slaac"
    instead of "ipv6_dhcp" and similarly for the other available modes.

    Change-Id: I751200a354ec9be2bfd5f94d3e4bbf53dab2c8bb
    Partial-Bug: 1676363

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Matt Riedemann (<email address hidden>) on branch: master
Review: https://review.openstack.org/336293
Reason: This hasn't been updated since May, has a -1 on it and is in merge conflict. If we need to discuss the -1 then I'd suggest bringing this up in the weekly nova meeting or the mailing list. Note that Thursday July 27 is feature freeze for Pike, so if this is going to get done this release it needs to move fast.

Changed in nova:
status: In Progress → Confirmed
assignee: Dan Peschman (dpeschman) → nobody
Revision history for this message
Sean Dague (sdague) wrote :

Found open reviews for this bug in gerrit, setting to In Progress.

review: https://review.openstack.org/450212 in branch: master
review: https://review.openstack.org/450211 in branch: master

Changed in nova:
status: Confirmed → In Progress
assignee: nobody → Dan Peschman (dpeschman)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Sean Dague (<email address hidden>) on branch: master
Review: https://review.openstack.org/450212
Reason: This review is > 4 weeks without comment, and is not mergable in it's current state. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Sean Dague (<email address hidden>) on branch: master
Review: https://review.openstack.org/450211
Reason: This review is > 4 weeks without comment, and is not mergable in it's current state. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

Revision history for this message
Sean Dague (sdague) wrote :

There are no currently open reviews on this bug, changing the status back to the previous state and unassigning. If there are active reviews related to this bug, please include links in comments.

Changed in nova:
status: In Progress → Confirmed
assignee: Dan Peschman (dpeschman) → nobody
Matt Riedemann (mriedem)
tags: added: metadata
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.