Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud config schema error for bond properties #5366

Closed
jcmoore3 opened this issue Jun 4, 2024 · 1 comment · Fixed by #5367 or #5383
Closed

Cloud config schema error for bond properties #5366

jcmoore3 opened this issue Jun 4, 2024 · 1 comment · Fixed by #5367 or #5383
Labels
bug Something isn't working correctly

Comments

@jcmoore3
Copy link
Contributor

jcmoore3 commented Jun 4, 2024

Bug report

When using OpenStack with a network_data.json file which specifies a bonded interface with properties for the bond, there is a mismatch between the schemas for these properties between OpenStack and cloudinit.

Steps to reproduce the problem

Create an OpenStack node with the following network_data.json:

{
  "links": [
    {
      "id": "ens1f0np0",
      "name": "ens1f0np0",
      "type": "phy",
      "ethernet_mac_address": "xx:xx:xx:xx:xx:00",
      "mtu": 9000
    },
    {
      "id": "ens1f1np1",
      "name": "ens1f1np1",
      "type": "phy",
      "ethernet_mac_address": "xx:xx:xx:xx:xx:01",
      "mtu": 9000
    },
    {
      "id": "bond0",
      "name": "bond0",
      "type": "bond",
      "bond_links": [
        "ens1f0np0", "ens1f1np1"
      ],
      "mtu": 9000,
      "ethernet_mac_address": "xx:xx:xx:xx:xx:00",
      "bond_mode": "802.3ad",
      "bond_xmit_hash_policy": "layer3+4",
      "bond_miimon": 100
    },
    {
      "id": "bond0.123",
      "name": "bond0.123",
      "type": "vlan",
      "vlan_link": "bond0",
      "vlan_id": 123,
      "vlan_mac_address": "xx:xx:xx:xx:xx:00"
    }
  ],
  "networks": [
    {
      "id": "publicnet-ipv4",
      "type": "ipv4",
      "link": "bond0.123",
      "ip_address": "x.x.x.x",
      "netmask": "255.255.255.0",
      "routes": [
        {
          "network": "0.0.0.0",
          "netmask": "0.0.0.0",
          "gateway": "x.x.x.1"
        }
      ],
      "network_id": "00000000-0000-0000-0000-000000000000"
    }
  ],
  "services": [
    {
      "type": "dns",
      "address": "1.1.1.1"
    }
  ]
}

Cloudinit will produce the following network-config.json:

{
 "config": [
  {
   "mac_address": "xx:xx:xx:xx:xx:00",
   "mtu": 9000,
   "name": "ens1f0np0",
   "subnets": [],
   "type": "physical"
  },
  {
   "mac_address": "xx:xx:xx:xx:xx:01",
   "mtu": 9000,
   "name": "ens1f1np1",
   "subnets": [],
   "type": "physical"
  },
  {
   "bond_interfaces": [
    "ens1f0np0",
    "ens1f1np1"
   ],
   "mac_address": "xx:xx:xx:xx:xx:00",
   "mtu": 9000,
   "name": "bond0",
   "params": {
    "bond_miimon": 100,
    "bond_mode": "802.3ad",
    "bond_xmit_hash_policy": "layer3+4"
   },
   "subnets": [],
   "type": "bond"
  },
  {
   "mac_address": "xx:xx:xx:xx:xx:00",
   "name": "bond0.123",
   "subnets": [
    {
     "address": "x.x.x.x",
     "ipv4": true,
     "netmask": "255.255.255.0",
     "routes": [
      {
       "gateway": "x.x.x.1",
       "netmask": "0.0.0.0",
       "network": "0.0.0.0"
      }
     ],
     "type": "static"
    }
   ],
   "type": "vlan",
   "vlan_id": 123,
   "vlan_link": "bond0"
  },
  {
   "address": "1.1.1.1",
   "type": "nameserver"
  }
 ],
 "version": 1
}

When validating the network-config.json file, cloudinit produces an error as the schema for bonded interfaces requires the bond properties to have a prefix of bond- instead of bond_:
https://github.com/canonical/cloud-init/blob/main/cloudinit/config/schemas/schema-network-config-v1.json#L79

Environment details

  • Cloud-init version: 23.4-7.el9_4.0.1
  • Operating System Distribution: Rocky 9
  • Cloud provider, platform or installer type: OpenStack Caracal 2024.1

cloud-init logs

Cloud-init v. 23.4-7.el9_4.0.1 running 'init-local' at Tue, 04 Jun 2024 15:28:57 +0000. Up 1741.95 seconds.
2024-06-04 15:28:57,974 - schema.py[WARNING]: Invalid network-config provided:
config.2.params: Additional properties are not allowed ('bond_mode', 'bond_miimon', 'bond_xmit_hash_policy' were unexpected)
@jcmoore3 jcmoore3 added bug Something isn't working correctly new An issue that still needs triage labels Jun 4, 2024
@aciba90 aciba90 removed the new An issue that still needs triage label Jun 6, 2024
@jcmoore3
Copy link
Contributor Author

jcmoore3 commented Jun 6, 2024

Related to this, the formatting of the bond- items in network_manager.py also need to be updated to match the schema:
https://github.com/canonical/cloud-init/blob/fc2134bed02571f68678f0fe0457ef06134c94d9/cloudinit/net/network_manager.py#L315C1-L325C15

This change is proposed in #5383

aciba90 added a commit to jcmoore3/cloud-init that referenced this issue Jun 28, 2024
…anonical#5367)

There is a discrepancy between the properties key name formatting in
the OpenStack network_data.json and cloudinit network-config.json
specifications. Ensure `bond_` is translated to `bond-` when the
OpenStack configuration is parsed by cloudinit.

Fixes canonicalGH-5366

Co-authored-by: Alberto Contreras <[email protected]>
holmanb pushed a commit that referenced this issue Jun 28, 2024
…5367)

There is a discrepancy between the properties key name formatting in
the OpenStack network_data.json and cloudinit network-config.json
specifications. Ensure `bond_` is translated to `bond-` when the
OpenStack configuration is parsed by cloudinit.

Fixes GH-5366

Co-authored-by: Alberto Contreras <[email protected]>
aciba90 pushed a commit that referenced this issue Aug 14, 2024
…on (#5383)

The cloud-init network config version 1 schema defines the bond
properties with underscores, prepended with 'bond-'. This change
ensures consistency with the schema for the bond property names.

GH-5366
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
2 participants