/srv/irclogs.ubuntu.com/2021/09/01/#cloud-init.txt

minimalJust been trying to test the network hotplug stuff - I created a ConfigDrive iso as that "appears" to support hotplug and booted a VM fine on QEMU, then I used the QEMU Monitor to add a 2nd ethernet interface to the machine and the cloud-init.log showed that hotplug was not enabled for the ConfigDrive DataSource.....am confused :-)12:14
falcojrminimal: did you include hotplug in the userdata too? {'updates': {'network': {'when': ['hotplug']}}} ?12:58
minimalfalcojr: nope, I wasn't aware it needed to be there. Is that documented somewhere?13:13
minimalah, found a reference to it on readthedocs. Can this go in /etc/cloud.cfg or does it have to be in user-data?13:14
falcojrof the top of my head, I can't think of a reason it wouldn't work in /etc/cloud.cfg, but I haven't done it myself13:15
minimalok, I'll try it. I'm also not sure how network hotplug is supposed to work with ConfigDrive - if I put details of the 2nd network interface in the ISO's network_data.json then it will be read anyway at 1st boot, but if I don't put that detail in it and then add the 2nd interface where will cloud-init get the config details for the 2nd interface from?13:18
minimalits different from a metadata-server based approach where I expect the Cloud Provider will automatically update the network data with new interface details13:19
falcojryeah, it doesn't really make much sense for a static metadata source. For testing, I was able to update the metadata in a seed dir of a NoCloud datasource, but that doesn't seem like it'd be a real-world use case13:21
minimalfalcojr: didn't think NoCloud supported hotplug - didn't see it mentioned in the DS code13:22
minimalthough only Ec2, Openstack, and ConfigDrive did currently - that's why I'm testing ConfigDrive, I normally use NoCloud for local servers13:23
falcojrAh, right. That was a local change I did while doing development. Virtual devices weren't detected correctly within containers so I wasn't able to test end-to-end and eventually turned it off13:26
minimalso would it be safe to have the above "when: hotplug" entry in /etc/cloud.cfg regardless of which DS is being used? I'm assuming it is as if the DS itself does not enable hotplug then there's no ill effect13:27
falcojryes, it shouldn't hurt anything to do that. Each datasource now has supported update events and default update events. Specifying events through userdata will override the default update events, but won't enable events that aren't supported13:30
falcojronly issue you might run into is some DSes will update metadata every boot by default, so if that isn't specified, you won't get that behavior anymore13:30
minimalyou mean I should specify "when: ['boot','hotplug']" in all cases and the relevant DS will act appropriately?13:32
falcojrnot entirely. When you specify that 'when', you're overriding the default behavior. Most DSes probably support 'boot', but won't have it enabled by default, but some (one or two if I remember correctly) do. Specifying it always won't hurt anything, but it'll increase boot times as it'll cause a re-fetch of the metadata every boot13:56
minimalok, so in the case where multiple DS are enabled, some of which may support this and some do not, then how should cloud-init be configured to 'out of the box' (i.e. in a preconfigured VM) handle this without having to rely on user-data (which is not under the control of the person providing the VM)?14:04
minimalthinking of this with my Alpine package maintainer hat on :-)14:04
minimalVM == VM image14:04
falcojrthe intent was to allow the datasource to define it, but the user to override it as necessary. Why are you wanting to enable it by default at the distro level?14:06
minimalI'm thinking of, example, an OS image designed to work with AWS & Azure & GCE, where only AWS currently supports network hotplug.14:08
minimalits "hard" to get end-users to read the docs so they would invariably not add the hotplug entry to the user-data for AWS14:09
holmanbIt appears that the VyOS project (an open source network OS) is maintaining a fork of cloud-init that enables router configuration on startup (as well as some other features). Have there been any discussions regarding up streaming their work? I don't see any mentions of it in the canonical GitHub PR history.14:14
holmanb(just curious)14:14
falcojrminimal: it's not meant to be turned on by default, so I would say "don't do that". Over time, I'm guessing certain datasources will have hotplug enabled by default, but if not, I want users to have to search out docs to be able to make it happen14:15
falcojrholmanb: I'm not aware of that project, but we're always open to upstreaming work that'd be beneficial to everybody14:16
holmanbfalcojr: understand, thanks14:17
minimalfalcojr: ok. I'm just finishing up the Alpine package for 21.3 - as part of that I've written a init.d script for hotplug and a simple daemon in Shell to provide the equivalent of the systemd service and socket files. I'll be working on PRs for those changes to cloud-init shortly14:27
falcojrminimal: great, thanks!14:27
minimalfalcojr: final question - would PRs for mdev support (udev alternative) on Linux be welcome or unwelcome?14:30
falcojrI know nothing about mdev, so probably depends on how intrusive the change is. If it's just some additional ifs in a template or some packing code that specifies different files to lay down, I think it would be fine14:33
minimalwell it would replace calls to things like "udevadm" in things like cc_disk_setup.py and the network stuff (which create a udev rule file)14:34
minimaltrying to work out if its worth me adding mdev to cloud-init on Alpine as, if upstream PRs don't get merged, then I might be left maintaining patches for Alpine forever more lol14:36
falcojrah, right, so that'd require some refactoring to get it to work. We've been open to big-ish refactors in the past to be more accommodating of various distros. I see no reason why that wouldn't apply here14:39
falcojryou'd have to drive it though14:39
andrewbogottthx for the merge falcojr -- will make my first-boot logic much simpler!14:52
falcojryeah, I can see the usefulness of it14:52
minimalfalcojr: thanks for the answers14:57
minimalfalcojr: sorry, further question after looking at various DS code: what about 'boot-new-instance' and 'boot-legacy'? I'd assume these are also overrriden by user-data/cloud.cfg entry so would need to specify those too for relevant DS(es)?15:19
falcojrfirst instance boot will fetch metadata regardless of the update settings, so not specifying it in the userdata won't affect anything15:37
minimalok, and legacy?15:38
falcojrboot-legacy is likely not necessary ever. It's similar to boot but applies networking twice per boot. We were worried about introducing a regression by changing the behavior so left the legacy option. If you override it with boot you'll likely be fine, but there is some risk there15:41
minimalok, saw just looking at the default_update_events values for various DSes when I noticed legacy15:43
minimalthanks again15:43

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!