canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization
https://cloud-init.io/
Other
2.86k stars 855 forks source link

cloud-init should parse initramfs rendered netplan if present #3602

Open ubuntu-server-builder opened 1 year ago

ubuntu-server-builder commented 1 year ago

This bug was originally filed in Launchpad as LP: #1861460

Launchpad details
affected_projects = ['ubuntu-z-systems', 'casper (Ubuntu)']
assignee = raharper
assignee_name = Ryan Harper
date_closed = None
date_created = 2020-01-30T23:04:46.020620+00:00
date_fix_committed = None
date_fix_released = None
id = 1861460
importance = wishlist
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1861460
milestone = None
owner = raharper
owner_name = Ryan Harper
private = False
status = in_progress
submitter = raharper
submitter_name = Ryan Harper
tags = ['installer', 's390x']
duplicates = []

Launchpad user Ryan Harper(raharper) wrote on 2020-01-30T23:04:46.020620+00:00

initramfs-tools used to only execute klibc based networking with some resolvconf hooks.

In recent releases, it has been greatly improved to use isc-dhcp-client instead of klibc, support vlan= key (like in dracut-network), bring up Z devices using chzdev, and generate netplan yaml from all of the above.

Above improvements were driven in part by Oracle Cloud and in part by Subiquity netbooting on Z.

Thus these days, instead of trying to reparse klibc files in /run/net-, cloud-init should simply import /run/netplan/$device.yaml files as the ip= provided networking information on the command line. I do not currently see cloud-init doing that in e.g. /cloudinit/net/cmdline.py

ubuntu-server-builder commented 1 year ago

Launchpad user Ryan Harper(raharper) wrote on 2020-01-30T23:08:23.112316+00:00

On Wed, Jan 29, 2020 at 9:32 AM Dimitri John Ledkov dimitri.ledkov@canonical.com wrote:

On Wed, Jan 29, 2020 at 3:17 PM Andreas Hasenack andreas@canonical.com wrote:

cloud-init gets SRUed regularly as a new upstream version, i.e.:   cloud-init | 19.4-33-gbb4131a2-0ubuntu1~16.04.1 | xenial-proposed | source, all   cloud-init | 19.4-33-gbb4131a2-0ubuntu1~16.04.1 | xenial-updates  | source, all   cloud-init | 19.4-33-gbb4131a2-0ubuntu1~18.04.1 | bionic-proposed | source, all   cloud-init | 19.4-33-gbb4131a2-0ubuntu1~18.04.1 | bionic-updates  | source, all   cloud-init | 19.4-33-gbb4131a2-0ubuntu1~19.10.1 | eoan-proposed   | source, all   cloud-init | 19.4-33-gbb4131a2-0ubuntu1~19.10.1 | eoan-updates    | source, all   cloud-init | 19.4-33-gbb4131a2-0ubuntu1         | focal           | source, all

Do these initramfs-tools improvements you speak of exist since xenial?

Netplan rendering is available from xenial and up:

./initramfs-tools-0.122ubuntu8.16/scripts/functions:_render_netplan() { ./initramfs-tools-0.130ubuntu3.9/scripts/functions:_render_netplan() { ./initramfs-tools-0.131ubuntu19.2/scripts/functions:_render_netplan() { ./initramfs-tools-0.133ubuntu10/scripts/functions:_render_netplan() { ./initramfs-tools-0.133ubuntu12/scripts/functions:_render_netplan() {

Xenial images do not use netplan by default; however, cloud-init in Xenial can read/parse it and render ifupdown as needed.  

Vlan support is available from eoan and up:

./initramfs-tools-0.133ubuntu10/init: vlan=) ./initramfs-tools-0.133ubuntu12/init: vlan=)

If desired Vlan support can be backported.

Are the vlan values exported into rendered netplan?

Note neither of above is available on Debian.

Generally, we can have cloud-init look for rendered netplan files, and prefer them over the klibc files when present.

ubuntu-server-builder commented 1 year ago

Launchpad user Dimitri John Ledkov(xnox) wrote on 2020-02-07T19:41:40.064377+00:00

Yes Vlan is defined in the runtime yaml, as native vlan.... With many keys set that cloud-init doesn't generate, for example the fact that that connection is a critical one and should not be torn down.

ubuntu-server-builder commented 1 year ago

Launchpad user Dimitri John Ledkov(xnox) wrote on 2020-02-10T23:45:09.657582+00:00

$ cat /run/netplan/encc000.2653.yaml network: version: 2 renderer: networkd ethernets: encc000: match: macaddress: "96:89:5a:96:15:30" set-name: encc000 vlans: encc000.2653: id: 2653 link: encc000 addresses:

$ sudo cat /proc/cmdline ip=10.245.236.14::10.245.236.1:255.255.255.0:s1lp14:encc000.2653:none:10.245.236.1 vlan=encc000.2653:encc000 url=ftp://10.13.0.2:21/ubuntu-live-server-20.04/focal-live-server-s390x.iso --- quiet

ubuntu-server-builder commented 1 year ago

Launchpad user Ryan Harper(raharper) wrote on 2020-03-09T22:10:42.978713+00:00

https://github.com/canonical/cloud-init/pull/238

ubuntu-server-builder commented 1 year ago

Launchpad user Ryan Harper(raharper) wrote on 2020-03-12T20:41:33.636409+00:00

@Dimitri

Interested in your thoughts here:

https://github.com/canonical/cloud-init/pull/238#issuecomment-598408582

ubuntu-server-builder commented 1 year ago

Launchpad user Dimitri John Ledkov(xnox) wrote on 2020-04-01T18:43:53.668452+00:00

maybe casper can hack this....

ubuntu-server-builder commented 1 year ago

Launchpad user Joshua Powers(powersj) wrote on 2020-04-01T19:07:25.752793+00:00

Plan is to look at fixing this in Casper for Focal release. For post-focal release, we will work on a fix in cloud-init.

ubuntu-server-builder commented 1 year ago

Launchpad user Dimitri John Ledkov(xnox) wrote on 2020-04-06T13:58:31.403648+00:00

This is awaiting cloud-init casper initramfs-tools livecd-rootfs pending changes all getting accepted and migrated to release pocket, and new image built using all of the above, before further tests/development can happen.

ubuntu-server-builder commented 1 year ago

Launchpad user Dimitri John Ledkov(xnox) wrote on 2020-04-07T12:02:42.414039+00:00

casper has been changed to generate cloud.cfg instead of netplan, thus no further work in cloud-init is required for focal.

Closing this issue as fix released in casper & z project.

It would be nice for cloud-init to do what was originally asked, but that is a feature request of a lower priority now, that needs further spec / implementation as discussed on github PR.

ubuntu-server-builder commented 1 year ago

Launchpad user Dan Watkins(oddbloke) wrote on 2020-04-07T21:11:05.910897+00:00

Ryan has started work on this, moving to In Progress.

ubuntu-server-builder commented 1 year ago

Launchpad user Joshua Powers(powersj) wrote on 2020-04-08T20:35:26.352559+00:00

The portions required for focal are in and the remaining items are additional for cloud-init. Dropping req4focal tag.