cloud-init should support config bond mac address

Bug #1682064 reported by lewis Liu on 2017-04-12
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
cloud-init
Medium
Unassigned
cloud-init (Ubuntu)
Undecided
Unassigned

Bug Description

In OpenStack ocata, Ironic support portgroup which meaning bond for cloudinit. In case of using ironic through nova, the MAC address for bonded NICs of the bare metal server is populated by neutron for the VIF’s address representing this portgroup. If the MAC address can not be configured, the bare metal server will not be able to get ip via DHCP

References:
http://specs.openstack.org/openstack/ironic-specs/specs/approved/ironic-ml2-integration.html
https://specs.openstack.org/openstack/nova-specs/specs/liberty/implemented/metadata-service-network-info.html

Related branches

Gaëtan Trellu (goldyfruit) wrote :

@Lewis, how did you fix your issue with cloud-init ?

Right now, we are using an external service to apply the MAC address on the bond got from the network_info.json but as you mentionned it would be nice to have that handle by cloud-init.

Fabian Wiesel (fabian-wiesel) wrote :

Hi,

I was running into the same problem, and it looks to me, that it is simply not passing the ethernet_mac_address set the network_data.json.

Attached is a patch, which would pass the value, if it is set.

Currently, we are also relying on our own in-house scripting specific to a single OS, and it would be great, if we could get rid of that and rely on some standard means.

Cheers,
  Fabian

Chad Smith (chad.smith) wrote :

Fabian, thanks for the patch, if possible could you attach the output of the following command:
curl http://169.254.169.254/openstack/latest/network_data.json | json_pp

Chad Smith (chad.smith) wrote :

We have recently added the ability for cloud-init to actually honor network_data.json in general, so this *may* not be a bug anymore.

If this bug still exists using cloud-init 18.3 or later, please update this bug with the following:

attached tarfile from 'sudo cloud-init collect-logs'

and output of
curl http://169.254.169.254/openstack/latest/network_data.json | json_pp

Changed in cloud-init:
status: New → Incomplete
Chad Smith (chad.smith) wrote :

marking incomplete for the moment until additional details are provided. Please do mark this bug back into 'new' state when bug is confirmed on latest cloud-init
(currently Ubuntu xenial, bionic and cosmic all have latest openstack features.)

Fabian Wiesel (fabian-wiesel) wrote :

Hi,

I can do that, but may I draw your attention to the change to the test-case enclosed in the patch?

It applies against master, and if you only test for the mac-address in the rendered output, it will fail, unless the function is modified.

Cheers,
  Fabian

Fabian Wiesel (fabian-wiesel) wrote :

Sorry, it took so long, but those machines take forever to boot, and I have to setup the network connectivity by hand.

I still get the bug with cloud-init on 18.3 (18.3-9-g2e62cb8a-0ubuntu1~16.04.2)

I provide the data of the config-drive, as we have to setup the bond before the working network (with cloud-init init --local on startup).
The cloud-init.log has multiple boots in it. Some possibly accessing the metadata server, after I manually configured the interface. I would suggest to disregard them. The last two entries are from a boot in the configuration you were seeing.
I also removed most of our custom cloud.cfg changes so that isn't the cause of the issues.

json_pp < /mnt/openstack/latest/network_data.json
{
   "networks" : [
      {
         "type" : "ipv4_dhcp",
         "network_id" : "a7ec6c35-4e17-4e97-aa2b-0d93e56bb6c7",
         "link" : "tap2b7fcc9f-f5",
         "id" : "network0"
      }
   ],
   "services" : [],
   "links" : [
      {
         "vif_id" : "2b7fcc9f-f57d-4e34-a350-ac734423c5d4",
         "bond_links" : [
            "f1778faf-213f-4216-a5c6-31d10dc669b5",
            "e8477eaf-71b0-4855-af0c-475ccb041513",
            "a4594b9d-8e27-4b0d-a5b0-c1682c5ee1bf",
            "7094568a-9bdd-4bd9-ba20-327a7959f1a3"
         ],
         "id" : "tap2b7fcc9f-f5",
         "bond_mode" : "802.3ad",
         "mtu" : 8950,
         "ethernet_mac_address" : "24:8a:07:9a:a6:1a",
         "type" : "bond"
      },
      {
         "ethernet_mac_address" : "24:8a:07:9a:a8:42",
         "type" : "phy",
         "id" : "f1778faf-213f-4216-a5c6-31d10dc669b5"
      },
      {
         "id" : "e8477eaf-71b0-4855-af0c-475ccb041513",
         "type" : "phy",
         "ethernet_mac_address" : "24:8a:07:9a:a8:43"
      },
      {
         "ethernet_mac_address" : "24:8a:07:9a:a6:1a",
         "type" : "phy",
         "id" : "a4594b9d-8e27-4b0d-a5b0-c1682c5ee1bf"
      },
      {
         "type" : "phy",
         "ethernet_mac_address" : "24:8a:07:9a:a6:1b",
         "id" : "7094568a-9bdd-4bd9-ba20-327a7959f1a3"
      }
   ]
}

Fabian Wiesel (fabian-wiesel) wrote :

Since I provided all requested data, I guess it isn't incomplete anymore.

Changed in cloud-init:
status: Incomplete → New
Scott Moser (smoser) wrote :

@Fabian,

Thanks for providing the logs and the network_data.json.

It looks like the patch you provided in comment 2 is reasonable. Could you please follow the HACKING.rst to make a merge proposal?

If you have any questions on that process, feel free to ping me in IRC or here.

For your reference, we have a debug tool 'cloud-init devel net-convert' that can be used to convert formats to more easily debug.
I put your network_data.json into a file and then:

  $ python3 -m cloudinit.cmd.main devel net-convert \
     --directory=out.d --network-data=network_data.json \
     --kind=network_data.json --output-kind=eni --distro=ubuntu \
     --mac=phy1,24:8a:07:9a:a8:42 \
     --mac=phy2,24:8a:07:9a:a8:43 \
     --mac=phy3,24:8a:07:9a:a6:1a \
     --mac=phy4,24:8a:07:9a:a6:1b

(yes... i agree the user experience on that cli could use some help :)

Changed in cloud-init:
status: New → Triaged
importance: Undecided → Medium
Scott Moser (smoser) wrote :

@Fabian,

Can you verify if this actually works for you?
Your comment implies that even with the patch applied you dont all "just work".

We'd like to make sure the system is working as designed.

With the patch applied, can you boot and then:
 - ip a
 - journalctl -o short-precise --boot=0
 - /var/log/cloud-init.log
 - /etc/network/interfaces
 - /etc/network/interfaces.d/*

Thanks.

Fabian Wiesel (fabian-wiesel) wrote :

Good news, I can report success.

I was only trying to apply the configuration written out by cloud-init without going through a
whole reboot.

A couple of changes, which might have also helped to fix it:

I
- applied the patch against c75c582ed1824dc3ff39cefdbddccfc2924b868c
- did not specify the mac-address in the port-group, leaving neutron to choose one
- specified additional bonding parameters (miimon, xmit_hash_policy)

All parameters are applied and the bonded interface comes up.

Attached is the outputs of the list of commands (ip a, etc...).

This bug is fixed with commit c6cfed7f to cloud-init on branch master.
To view that commit see the following URL:
https://git.launchpad.net/cloud-init/commit/?id=c6cfed7f

Changed in cloud-init:
status: Triaged → Fix Committed

This bug is believed to be fixed in cloud-init in version 18.4. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
Scott Moser (smoser) wrote :

This is fixed in Ubuntu 18.10.

cloud-init (18.3-46-gbb60f61b-0ubuntu1) cosmic; urgency=medium

  * New upstream snapshot.
    - ds-identify: doc string cleanup.
    - OpenStack: Support setting mac address on bond. [Fabian Wiesel]

 -- Ryan Harper <email address hidden> Fri, 14 Sep 2018 16:13:19 -0500

Changed in cloud-init (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers