Skip to content

fix(opennebula): coerce MTU to int in gen_conf()#6856

Merged
blackboxsw merged 1 commit intocanonical:mainfrom
mcanevet:fix/opennebula-mtu-int-coercion
May 1, 2026
Merged

fix(opennebula): coerce MTU to int in gen_conf()#6856
blackboxsw merged 1 commit intocanonical:mainfrom
mcanevet:fix/opennebula-mtu-int-coercion

Conversation

@mcanevet
Copy link
Copy Markdown
Contributor

Proposed Commit Message

```
fix(opennebula): coerce MTU to int in gen_conf()

ONE_CONTEXT passes ETHx_MTU as a string, but Netplan's network-config-v2
schema requires mtu to be an integer. Without this, cloud-init schema --system fails with "'1500' is not of type 'integer'".
```

Additional Context

Discovered while backporting to cloud-init 25.1.4-1+deb13u1 (trixie).
The fix is a one-liner: int(mtu) in gen_conf(). The accompanying test
expectation updates ("1280"1280) reflect the corrected behaviour.

The regression is caught by the schema validation fixture introduced in #6855.
With that PR, test_gen_conf_mtu, test_eth0_v4v6_override, and
test_multiple_nics all fail before this fix and pass after.

Test Steps

Boot an OpenNebula VM with ETH0_MTU set in the context, then run:

cloud-init schema --system

Before this fix, the command fails with:

ethernets.eth0.mtu: '1500' is not of type 'integer'

After this fix, validation passes.

tox -e py3 -- tests/unittests/sources/test_opennebula.py

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

@mcanevet mcanevet force-pushed the fix/opennebula-mtu-int-coercion branch from 9b98d75 to 40066d1 Compare April 29, 2026 18:08
ONE_CONTEXT passes ETHx_MTU as a string, but Netplan's network-config-v2
schema requires mtu to be an integer. Without this, cloud-init schema
validation fails with "'1500' is not of type 'integer'".
Copy link
Copy Markdown
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix there @mcanevet +1 on this correction and changset. I can confirm failures on py 3.14 without this fix.

@blackboxsw blackboxsw merged commit d7eb828 into canonical:main May 1, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants