Merge ~fabian-wiesel/cloud-init:bugfix1682064 into cloud-init:master

Proposed by Fabian Wiesel
Status: Merged
Approved by: Chad Smith
Approved revision: 984d2ab47e596f3b32c6fc8ab96aa07090d6d410
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~fabian-wiesel/cloud-init:bugfix1682064
Merge into: cloud-init:master
Diff against target: 44 lines (+7/-1)
2 files modified
cloudinit/sources/helpers/openstack.py (+2/-0)
tests/unittests/test_datasource/test_configdrive.py (+5/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Scott Moser Approve
Review via email: mp+354405@code.launchpad.net

Commit message

OpenStack: Support setting mac address on bond.

Fix a bug where setting of mac address on a bond device was
ignored when provided in OpenStack network_config.json.

LP: #1682064

Description of the change

I only tested, that the hwaddr field was set in the eni config.
I still have trouble to get the bond to work.
It should work according to the documentation, but the mac address is not set on
`ifup bond0` despite the hwaddr being set correctly.

But that might be out of scope of this project.

To post a comment you must log in.
Revision history for this message
Scott Moser (smoser) wrote :

we recently fixed bug 1784699 which was related.

It would be good to know that the whole thing is done right for ENI rendering, or at least have a bug filed on what is wrong. I agree that your fix seems correct here.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:984d2ab47e596f3b32c6fc8ab96aa07090d6d410
https://jenkins.ubuntu.com/server/job/cloud-init-ci/291/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/291/rebuild

review: Approve (continuous-integration)
Revision history for this message
Ryan Harper (raharper) wrote :

I think this is a good fix for network_data.json config for bonds.

Revision history for this message
Scott Moser (smoser) :
review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://jenkins.ubuntu.com/server/job/cloud-init-autoland-test/56/
Executed test runs:
    FAILED: Checkout

review: Needs Fixing (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/sources/helpers/openstack.py b/cloudinit/sources/helpers/openstack.py
2index 8f9c144..c72c280 100644
3--- a/cloudinit/sources/helpers/openstack.py
4+++ b/cloudinit/sources/helpers/openstack.py
5@@ -587,6 +587,8 @@ def convert_net_json(network_json=None, known_macs=None):
6 cfg.update({'type': 'physical', 'mac_address': link_mac_addr})
7 elif link['type'] in ['bond']:
8 params = {}
9+ if link_mac_addr:
10+ params['mac_address'] = link_mac_addr
11 for k, v in link.items():
12 if k == 'bond_links':
13 continue
14diff --git a/tests/unittests/test_datasource/test_configdrive.py b/tests/unittests/test_datasource/test_configdrive.py
15index b0abfc5..231619c 100644
16--- a/tests/unittests/test_datasource/test_configdrive.py
17+++ b/tests/unittests/test_datasource/test_configdrive.py
18@@ -136,6 +136,7 @@ NETWORK_DATA_3 = {
19 ]
20 }
21
22+BOND_MAC = "fa:16:3e:b3:72:36"
23 NETWORK_DATA_BOND = {
24 "services": [
25 {"type": "dns", "address": "1.1.1.191"},
26@@ -163,7 +164,7 @@ NETWORK_DATA_BOND = {
27 {"bond_links": ["eth0", "eth1"],
28 "bond_miimon": 100, "bond_mode": "4",
29 "bond_xmit_hash_policy": "layer3+4",
30- "ethernet_mac_address": "0c:c4:7a:34:6e:3c",
31+ "ethernet_mac_address": BOND_MAC,
32 "id": "bond0", "type": "bond"},
33 {"ethernet_mac_address": "fa:16:3e:b3:72:30",
34 "id": "vlan2", "type": "vlan", "vlan_id": 602,
35@@ -691,6 +692,9 @@ class TestConvertNetworkData(CiTestCase):
36 self.assertIn("auto oeth0", eni_rendering)
37 self.assertIn("auto oeth1", eni_rendering)
38 self.assertIn("auto bond0", eni_rendering)
39+ # The bond should have the given mac address
40+ pos = eni_rendering.find("auto bond0")
41+ self.assertIn(BOND_MAC, eni_rendering[pos:])
42
43 def test_vlan(self):
44 # light testing of vlan config conversion and eni rendering

Subscribers

People subscribed via source and target branches