Merge lp:~chad.smith/vmbuilder/jenkins_kvm_azure_netplan_hotplug into lp:~ubuntu-on-ec2/vmbuilder/jenkins_kvm
Status: | Merged |
---|---|
Merged at revision: | 802 |
Proposed branch: | lp:~chad.smith/vmbuilder/jenkins_kvm_azure_netplan_hotplug |
Merge into: | lp:~ubuntu-on-ec2/vmbuilder/jenkins_kvm |
Diff against target: |
79 lines (+40/-5) 1 file modified
templates/img-extra-nets.tmpl (+40/-5) |
To merge this branch: | bzr merge lp:~chad.smith/vmbuilder/jenkins_kvm_azure_netplan_hotplug |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Francis Ginther (community) | Approve | ||
Daniel Axtens (community) | Approve | ||
Dan Watkins (community) | Approve | ||
Ryan Harper | Pending | ||
VMBuilder | Pending | ||
Review via email: mp+347212@code.launchpad.net |
This proposal supersedes a proposal from 2018-05-31.
Commit message
Azure's nic hotplug: deliver static/
Allow netplan/networkd to automatically bringup hotplugged nics
by delivering a flexible static netplan yaml file to catch any new ethernet devices attached to the Azure instance. The hotplug-azure yaml will complement cloud-init's initial/strict eth0 match definition which is matching only to a specific to macaddress for eth0.
Because cloud-init's netwok configuration is is only created at boot,
a detach of the original eth0 nic and attach of a new nic would cause
cloud-init's netplan yaml to fail to match, resulting in no network
config. Given the supplemental 90-hotplug-
"hotpluggedeth0" opaque-id will match on any new eth0 present on the
system after reboot. Systemd will and set that nic the
primary/mandatory interface. eth1 or greater are left as optional
ephemeral devices, meaning that networkd boot will not block on their
link being up.
hotpluggedeth0:
dhcp4: true
match:
driver: hv_netvsc
name: 'eth0'
Also avoid appending unnecessary include directives or udev rules in
/etc/network/
Description of the change
Azure images deliver a script /usr/local/
In Artful and later, cloud-init writes a fallback interface config in /etc/netplan/
This change adds a flexible static /etc/netplan/
A few things:
1) netplan is the default on Artful too. I think your detection code is right, but your commit message is potentially wrong?
2) If I understand cloud-init and netplan correctly, couldn't you achieve the same effect by just adding this as /etc/netplan/ 99-azure- hotplug. yaml? Then you could drop ephemeral_eth.sh entirely on Artful and Bionic.
network: ....... ..driver: hv_netvsc ....... ..name: "eth*" .....optional: true
....version: 2
....ethernets:
........ephemeral:
............dhcp4: true
............match:
.......
.......
.......
3) Looking at the code itself, you should probably use /run/netplan for ephemeral files, rather than /etc/netplan. That also solves your cleanup problem.
4) And it's worth knowing that netplan apply will look for network devices that are 'down' and them from their drivers and rebind them. With your approach, netplan apply will be run for each extra device, so if there are 4 extra devices, the first one configured won't be replugged, the second will be replugged once, the third will be replugged twice and so on. This *probably* isn't problematic, but it makes me nervous, especially doing it in rapid succession.