In the cloudimage it seems to be working as expected, especially
renaming and configuration of network interfaces at (first-)boot. Some
test results:

ubuntu@testimg:~$ sudo netplan status
     Online state: online
    DNS Addresses: 127.0.0.53 (stub)
       DNS Search: .

●  1: lo ethernet UNKNOWN/UP (unmanaged)
      MAC Address: 00:00:00:00:00:00
        Addresses: 127.0.0.1/8
                   ::1/128

●  2: en2 ethernet UP (networkd: id1)
      MAC Address: f0:0d:ca:fe:00:bb (Red Hat, Inc.)
        Addresses: 1.2.3.4/24
                   fec0::f20d:caff:fefe:bb/64 (dynamic, ra)
                   fe80::f20d:caff:fefe:bb/64 (link)
           Routes: 1.2.3.0/24 from 1.2.3.4 (link)
                   fe80::/64 metric 256
                   fec0::/64 metric 100 (ra)
                   default via fe80::2 metric 100 (ra)

●  3: en1 ethernet UP (networkd: id0)
      MAC Address: ca:fe:ca:fe:00:aa (Red Hat, Inc.)
        Addresses: 10.0.2.15/24 (dynamic, dhcp)
                   fec0::c8fe:caff:fefe:aa/64 (dynamic, ra)
                   fe80::c8fe:caff:fefe:aa/64 (link)
    DNS Addresses: 10.0.2.3
           Routes: default via 10.0.2.2 from 10.0.2.15 metric 100 (dhcp)
                   10.0.2.0/24 from 10.0.2.15 metric 100 (link)
                   10.0.2.2 from 10.0.2.15 metric 100 (dhcp, link)
                   10.0.2.3 from 10.0.2.15 metric 100 (dhcp, link)
                   fe80::/64 metric 256
                   fec0::/64 metric 100 (ra)
                   default via fe80::2 metric 100 (ra)

ubuntu@testimg:~$ systemctl status netplan-configure.service
● netplan-configure.service - Netplan Backend Configuration
     Loaded: loaded (/usr/lib/systemd/system/netplan-configure.service; 
enabled; preset: enabled)
     Active: active (exited) since Tue 2025-12-02 14:17:18 UTC; 9min ago
 Invocation: 2727cbecf99f449dad923f1ab2a5d114
       Docs: man:netplan(8)
             https://netplan.readthedocs.io/en/stable/netplan-yaml/
    Process: 744 ExecStart=/usr/libexec/netplan/configure (code=exited, 
status=0/SUCCESS)
    Process: 760 ExecStartPost=udevadm control --reload (code=exited, 
status=0/SUCCESS)
    Process: 809 ExecStartPost=udevadm trigger --action=add 
--subsystem-match=net (code=exited, status=0/SUCCESS)
   Main PID: 744 (code=exited, status=0/SUCCESS)
   Mem peak: 1.7M
        CPU: 17ms

Dec 02 14:17:18 testimg systemd[1]: Starting netplan-configure.service - 
Netplan Backend Configuration...
Dec 02 14:17:18 testimg systemd[1]: Finished netplan-configure.service - 
Netplan Backend Configuration.

ubuntu@testimg:~$ systemd-analyze critical-chain 
systemd-networkd-wait-online.service
The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.

systemd-networkd-wait-online.service +2.025s
└─systemd-networkd.service @2.938s +298ms
  └─network-pre.target @2.929s
    └─netplan-configure.service @2.559s +368ms
      └─cloud-init-network.service @2.390s +141ms
        └─cloud-init-local.service @2.100s +286ms
          └─cloud-init-main.service @633ms +748ms
            └─systemd-remount-fs.service @592ms +34ms
              └─systemd-fsck-root.service @431ms +144ms
                └─systemd-journald.socket @325ms
                  └─system.slice @283ms
                    └─-.slice @283ms

ubuntu@testimg:~$ systemd-analyze blame
2.025s systemd-networkd-wait-online.service
1.109s dev-vda1.device
1.001s snapd.seeded.service
 957ms snapd.service
 882ms networkd-dispatcher.service
 748ms cloud-init-main.service
[...]

** Description changed:

- WIP
+ [Test plan]
+ $ cat > meta.yaml <<EOF
+ instance-id: ubuntu01
+ local-hostname: testimg
+ EOF
+ $ cat > user.yaml <<EOF
+ #cloud-config
+ ssh_pwauth: true
+ password: test
+ chpasswd:
+   expire: false
+ EOF
+ $ cat > netplan.yaml <<EOF
+ network:
+   version: 2
+   ethernets:
+     id0:
+       match:
+         macaddress: "ca:fe:ca:fe:00:aa"
+       dhcp4: true
+       dhcp6: true
+       set-name: "en1"
+     id1:
+       match:
+         macaddress: "f0:0d:ca:fe:00:bb"
+       addresses: ["1.2.3.4/24"]
+       dhcp6: true
+       set-name: "en2"
+       #optional: true
+ EOF
+ $ cloud-localds --network-config=netplan.yaml seed.img user.yaml meta.yaml
+ $ wget 
https://cloud-images.ubuntu.com/resolute/current/resolute-server-cloudimg-amd64.img
+ $ qemu-system-x86_64 \
+   -machine accel=kvm,type=q35 \
+   -cpu host \
+   -m 2G \
+   -device virtio-net-pci,netdev=net0,mac=ca:fe:ca:fe:00:aa \
+   -netdev user,id=net0,hostfwd=tcp::2222-:22 \
+   -nic user,model=virtio-net-pci,mac=f0:0d:ca:fe:00:bb \
+   -drive if=virtio,format=qcow2,file=resolute-server-cloudimg-amd64.img \
+   -drive if=virtio,format=raw,file=seed.img #-snapshot
+ # avoid "-snapshot" to preserve changes to the disk-image
+ 
+ 
+ # login: ubuntu / test
+ $ ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -p 2222 
ubuntu@localhost
+ # install new Netplan generator, e.g. from ppa:slyon/sd-1997-generator-split
+ $ sudo apt install netplan-generator
+ 
+ # Play around with /etc/netplan/50-cloud-init.yaml modifications
+ # calling "netplan apply" and/or doing reboots, potentially staring
+ # over with a fresh cloud-init
+ $ sudo netplan apply
+ $ sudo cloud-init clean --logs
+ $ sudo reboot
+ 
+ => Make sure settings are correctly applied at runtime ("netplan
+ apply"), boot ("sudo reboot") and first-boot ("sudo cloud-init clean
+ --logs && sudo reboot").

** Description changed:

+ Refactor Netplan's generate binary to be a proper systemd-generator, 
according to 
https://www.freedesktop.org/software/systemd/man/latest/systemd.generator.html 
and "FO165 – Netplan generator architecture".
+ Upstream changes: https://github.com/canonical/netplan/pull/552
+ 
  [Test plan]
  $ cat > meta.yaml <<EOF
  instance-id: ubuntu01
  local-hostname: testimg
  EOF
  $ cat > user.yaml <<EOF
  #cloud-config
  ssh_pwauth: true
  password: test
  chpasswd:
-   expire: false
+   expire: false
  EOF
  $ cat > netplan.yaml <<EOF
  network:
-   version: 2
-   ethernets:
-     id0:
-       match:
-         macaddress: "ca:fe:ca:fe:00:aa"
-       dhcp4: true
-       dhcp6: true
-       set-name: "en1"
-     id1:
-       match:
-         macaddress: "f0:0d:ca:fe:00:bb"
-       addresses: ["1.2.3.4/24"]
-       dhcp6: true
-       set-name: "en2"
-       #optional: true
+   version: 2
+   ethernets:
+     id0:
+       match:
+         macaddress: "ca:fe:ca:fe:00:aa"
+       dhcp4: true
+       dhcp6: true
+       set-name: "en1"
+     id1:
+       match:
+         macaddress: "f0:0d:ca:fe:00:bb"
+       addresses: ["1.2.3.4/24"]
+       dhcp6: true
+       set-name: "en2"
+       #optional: true
  EOF
  $ cloud-localds --network-config=netplan.yaml seed.img user.yaml meta.yaml
  $ wget 
https://cloud-images.ubuntu.com/resolute/current/resolute-server-cloudimg-amd64.img
  $ qemu-system-x86_64 \
-   -machine accel=kvm,type=q35 \
-   -cpu host \
-   -m 2G \
-   -device virtio-net-pci,netdev=net0,mac=ca:fe:ca:fe:00:aa \
-   -netdev user,id=net0,hostfwd=tcp::2222-:22 \
-   -nic user,model=virtio-net-pci,mac=f0:0d:ca:fe:00:bb \
-   -drive if=virtio,format=qcow2,file=resolute-server-cloudimg-amd64.img \
-   -drive if=virtio,format=raw,file=seed.img #-snapshot
+   -machine accel=kvm,type=q35 \
+   -cpu host \
+   -m 2G \
+   -device virtio-net-pci,netdev=net0,mac=ca:fe:ca:fe:00:aa \
+   -netdev user,id=net0,hostfwd=tcp::2222-:22 \
+   -nic user,model=virtio-net-pci,mac=f0:0d:ca:fe:00:bb \
+   -drive if=virtio,format=qcow2,file=resolute-server-cloudimg-amd64.img \
+   -drive if=virtio,format=raw,file=seed.img #-snapshot
  # avoid "-snapshot" to preserve changes to the disk-image
- 
  
  # login: ubuntu / test
  $ ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" -p 2222 
ubuntu@localhost
  # install new Netplan generator, e.g. from ppa:slyon/sd-1997-generator-split
  $ sudo apt install netplan-generator
  
  # Play around with /etc/netplan/50-cloud-init.yaml modifications
  # calling "netplan apply" and/or doing reboots, potentially staring
  # over with a fresh cloud-init
  $ sudo netplan apply
  $ sudo cloud-init clean --logs
  $ sudo reboot
  
  => Make sure settings are correctly applied at runtime ("netplan
  apply"), boot ("sudo reboot") and first-boot ("sudo cloud-init clean
  --logs && sudo reboot").

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2133724

Title:
  Enable Netplan split generator

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/2133724/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to