vmbuilder team mailing list archive
-
vmbuilder team
-
Mailing list archive
-
Message #00159
Re: [Merge] lp:~chad.smith/vmbuilder/jenkins_kvm_azure_netplan_hotplug into lp:~ubuntu-on-ec2/vmbuilder/jenkins_kvm
Diff comments:
> === modified file 'templates/img-extra-nets.tmpl'
> --- templates/img-extra-nets.tmpl 2017-08-22 19:29:36 +0000
> +++ templates/img-extra-nets.tmpl 2018-05-31 14:58:36 +0000
> @@ -5,6 +5,7 @@
> # vi: ts=4 noexpandtab syntax=sh
>
> int_d="/run/network/interfaces.ephemeral.d"
> +netp_d="/etc/netplan"
Shouldn't we use /run/netplan ? these files will get regenerated whenever udev does its coldplug.
>
> function config_upstart {
> # Give an upstart job for defining a secondary interface
> @@ -52,6 +53,29 @@
>
> INTERFACE=\$1
> net_int_d="${int_d}"
> +netplan_d="${netp_d}"
> +
> +
> +function configure_nic_netplan {
> + # Write separate netplan yaml for each hot-plugged interface
> + if [ -e \${netplan_d}/90-hotplug-\${INTERFACE}.yaml ]; then
it may be useful to include 'azure' in the filename as well the the comment in the injected file.
> + return
> + fi
> + cat << EOM > \${netplan_d}/90-hotplug-\${INTERFACE}.yaml
> +# Added by \$0 due to udev nic hotplug event
> +network:
> + version: 2
> + ethernets:
> + \${INTERFACE}:
> + dhcp4: true
> + match:
> + driver: hv_netvsc
> + name: \${INTERFACE}
> + optional: true
> +EOM
> + netplan apply
> +}
> +
>
> function configure_nic {
> # Ensure \${net_int_d} exists on the ephemeral mount
> @@ -69,8 +93,11 @@
> eth0) #skip, this is static
> ;;
> eth*)
> - if [ ! -e \${net_int_d}/\${INTERFACE}.cfg ]
> - then
> + command -v netplan > /dev/null
We should use the same tests like in cloud-init, which is if 'ifup' then we're on eni, elif 'netplan', then netplan.
It is possible for users to have ifupdown installed and netplan, in which case, we tend to prefer the ifupdown since that's a user choice to override netplan.
> + if [ \$? -eq 0 ]; then
> + # netplan is present
> + configure_nic_netplan
> + elif [ ! -e \${net_int_d}/\${INTERFACE}.cfg ]; then
> configure_nic
> fi
> ;;
--
https://code.launchpad.net/~chad.smith/vmbuilder/jenkins_kvm_azure_netplan_hotplug/+merge/347212
Your team VMBuilder is requested to review the proposed merge of lp:~chad.smith/vmbuilder/jenkins_kvm_azure_netplan_hotplug into lp:~ubuntu-on-ec2/vmbuilder/jenkins_kvm.
References