mtu gets lost in translation from netplan (v2) yaml

Bug #1836949 reported by Scott Moser on 2019-07-17
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)

Bug Description

MTU values get lost in translation when input is netplan (v2 yaml).

I'm attaching a recreate script, but basically the mtu setting gets lost when writing ENI or sysconfig if the input is v2 yaml.

input of:
  version: 2
      addresses: [""]
      id: 1000
      link: bond0
      mtu: 1496
      id: 1001
      link: bond0
      interfaces: ["enp0s0", "enp0s1"]
      parameters: {}
      mtu: 1496

Renders output files like etc/sysconfig/network-scripts/ifcfg-bond0:
  # Created by cloud-init on instance boot automatically, do not edit.

Where the same config from v1 would have the 'MTU=1496'

ProblemType: Bug
DistroRelease: Ubuntu 19.10
Package: cloud-init 19.1-1-gbaa47854-0ubuntu1
ProcVersionSignature: Ubuntu 4.15.0-54.58-generic 4.15.18
Uname: Linux 4.15.0-54-generic x86_64
ApportVersion: 2.20.11-0ubuntu5
Architecture: amd64
CloudName: LXD
Date: Wed Jul 17 18:37:04 2019
PackageArchitecture: all
 PATH=(custom, no user)
SourcePackage: cloud-init
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Scott Moser (smoser) wrote :
Scott Moser (smoser) wrote :

output of recreate:

$ sh /tmp/
Read input format 'yaml' from 'bond-mtu-v1.yaml'.
Wrote output format 'sysconfig' to 'centos/sysconfig/from-v1/'

Read input format 'yaml' from 'bond-mtu-v2.yaml'.
Wrote output format 'sysconfig' to 'centos/sysconfig/from-v2/'

--- centos/sysconfig ----
diff -Naur centos/sysconfig/from-v1/etc/sysconfig/network-scripts/ifcfg-bond0 centos/sysconfig/from-v2/etc/sysconfig/network-scripts/ifcfg-bond0
--- centos/sysconfig/from-v1/etc/sysconfig/network-scripts/ifcfg-bond0 2019-07-17 14:51:47.196419026 -0400
+++ centos/sysconfig/from-v2/etc/sysconfig/network-scripts/ifcfg-bond0 2019-07-17 14:51:47.464420793 -0400
@@ -5,7 +5,6 @@
diff -Naur centos/sysconfig/from-v1/etc/sysconfig/network-scripts/ifcfg-bond0.1000 centos/sysconfig/from-v2/etc/sysconfig/network-scripts/ifcfg-bond0.1000
--- centos/sysconfig/from-v1/etc/sysconfig/network-scripts/ifcfg-bond0.1000 2019-07-17 14:51:47.196419026 -0400
+++ centos/sysconfig/from-v2/etc/sysconfig/network-scripts/ifcfg-bond0.1000 2019-07-17 14:51:47.464420793 -0400
@@ -3,7 +3,6 @@
Read input format 'yaml' from 'bond-mtu-v1.yaml'.
Wrote output format 'eni' to 'ubuntu/eni/from-v1/'

Read input format 'yaml' from 'bond-mtu-v2.yaml'.
Wrote output format 'eni' to 'ubuntu/eni/from-v2/'

--- ubuntu/eni ----
diff -Naur ubuntu/eni/from-v1/etc/network/interfaces.d/50-cloud-init.cfg ubuntu/eni/from-v2/etc/network/interfaces.d/50-cloud-init.cfg
--- ubuntu/eni/from-v1/etc/network/interfaces.d/50-cloud-init.cfg 2019-07-17 14:51:47.744422640 -0400
+++ ubuntu/eni/from-v2/etc/network/interfaces.d/50-cloud-init.cfg 2019-07-17 14:51:48.024424486 -0400
@@ -9,7 +9,6 @@
 auto bond0
 iface bond0 inet manual
     bond-slaves none
- mtu 1496

 auto enp0s0
 iface enp0s0 inet manual
@@ -22,7 +21,6 @@
 auto bond0.1000
 iface bond0.1000 inet static
- mtu 1496
     vlan-raw-device bond0
     vlan_id 1000

Read input format 'yaml' from 'bond-mtu-v1.yaml'.
Wrote output format 'netplan' to 'ubuntu/netplan/from-v1/'

Read input format 'yaml' from 'bond-mtu-v2.yaml'.
Wrote output format 'netplan' to 'ubuntu/netplan/from-v2/'

--- ubuntu/netplan ----
diff -Naur ubuntu/netplan/from-v1/etc/netplan/50-cloud-init.yaml ubuntu/netplan/from-v2/etc/netplan/50-cloud-init.yaml
--- ubuntu/netplan/from-v1/etc/netplan/50-cloud-init.yaml 2019-07-17 14:51:48.292426253 -0400
+++ ubuntu/netplan/from-v2/etc/netplan/50-cloud-init.yaml 2019-07-17 14:51:48.556427993 -0400
@@ -4,15 +4,14 @@
 # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
 # network: {config: disabled}
- version: 2
             - enp0s0
             - enp0s1
             mtu: 1496
- enp0s0: {}
- enp0s1: {}
+ parameters: {}
+ version: 2

Changed in cloud-init:
status: New → Confirmed

This bug is fixed with commit 5498107d to cloud-init on branch master.
To view that commit see the following URL:

Changed in cloud-init:
status: Confirmed → Fix Committed
Dan Watkins (oddbloke) on 2019-07-23
Changed in cloud-init (Ubuntu):
status: New → In Progress
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cloud-init - 19.2-5-g496aaa94-0ubuntu1

cloud-init (19.2-5-g496aaa94-0ubuntu1) eoan; urgency=medium

  * New upstream snapshot.
    - net/cmdline: split interfaces_by_mac and init network config
    - stages: allow data sources to override network config source order
    - cloud_tests: updates and fixes
    - Fix bug rendering MTU on bond or vlan when input was netplan.
      [Scott Moser] (LP: #1836949)
    - net: update net sequence, include wait on netdevs, opensuse netrules
      path (LP: #1817368)

 -- Chad Smith <email address hidden> Tue, 06 Aug 2019 13:56:18 -0600

Changed in cloud-init (Ubuntu):
status: In Progress → Fix Released

This bug is believed to be fixed in cloud-init in version 19.2-2. 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
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers