Code review comment for lp:~chad.smith/vmbuilder/jenkins_kvm_azure_netplan_hotplug

Revision history for this message
Chad Smith (chad.smith) wrote :

OK I changed up the approach here after some good testing on Azure (attaching new nics, detatching original eth0 nic, reattaching nics etc).

systemd does let us pass inverted matches per https://www.freedesktop.org/software/systemd/man/systemd.network.html#Name=

Per Daniel's suggestion, we can deliver a static netplan yaml in Azure netplan-enabled cloud-images. But, that netplan needs to complement the original 50-cloud-init.yaml which will not be updated by cloud-init after first boot.

We can then also drop the udev rules and the changes I made to ephemeral_eth.sh script as that would be completely unused in netplan environments.

This way we don't have to run netplan apply on each udev add event.

The static netplan is as follows:
 /etc/netplan/90-hotplug-azure.yaml
# Automatically generated by /usr/local/sbin/ephemeral_eth.sh to setup
# Azure attached nics after initial instance boot
network:
    version: 2
    ethernets:
        ephemeral:
            dhcp4: true
            match:
                driver: hv_netvsc
                name: '!eth0'
            optional: true
        hotpluggedeth0:
            dhcp4: true
            match:
                driver: hv_netvsc
                name: 'eth0'

« Back to merge proposal