Merge lp://qastaging/~chad.smith/vmbuilder/jenkins_kvm_azure_netplan_hotplug into lp://qastaging/vmbuilder

Proposed by Chad Smith
Status: Superseded
Proposed branch: lp://qastaging/~chad.smith/vmbuilder/jenkins_kvm_azure_netplan_hotplug
Merge into: lp://qastaging/vmbuilder
Diff against target: 31474 lines (+30578/-0)
176 files modified
azure_config.sh (+95/-0)
base_indicies.sh (+28/-0)
build-juju-local.sh (+108/-0)
builder_config.sh (+78/-0)
checksum.sh (+27/-0)
config/cloud-azure.cfg (+9/-0)
config/cloud-maas.cfg (+11/-0)
config/cloud-maasv2.cfg (+10/-0)
config/cloud-maasv3.cfg (+10/-0)
config/cloud-precise.cfg (+24/-0)
config/cloud-trusty-pp64el.cfg (+13/-0)
config/cloud-trusty.cfg (+26/-0)
config/cloud-vps.cfg (+6/-0)
config/cloud.cfg (+17/-0)
copy_to_final.sh (+52/-0)
create-vhd.sh (+97/-0)
ec2_publisher.sh (+98/-0)
functions/bzr_check.sh (+14/-0)
functions/bzr_commit.sh (+23/-0)
functions/common (+37/-0)
functions/locker (+49/-0)
functions/merge_templates (+53/-0)
functions/mk_template.sh (+41/-0)
functions/retry (+16/-0)
generate-ubuntu-lists.sh (+44/-0)
get_serial.sh (+157/-0)
jenkins/CloudImages_Azure.sh (+162/-0)
jenkins/CloudImages_Base.sh (+96/-0)
jenkins/CloudImages_Base_Release_Delta.sh (+255/-0)
jenkins/CloudImages_Juju.sh (+253/-0)
jenkins/CloudImages_Update_Builder.sh (+68/-0)
jenkins/CloudImages_Vagrant.sh (+232/-0)
jenkins/MAAS_Builder.sh (+171/-0)
jenkins/MAAS_Promotion.sh (+31/-0)
jenkins/MAASv2_Builder.sh (+191/-0)
jenkins/MAASv2_Cleaner.sh (+55/-0)
jenkins/MAASv3_Builder.sh (+67/-0)
jenkins/Promote_Daily.sh (+55/-0)
jenkins/Promote_MAAS_Daily.sh (+48/-0)
jenkins/Publish_EC2.sh (+64/-0)
jenkins/Publish_Results_to_Tracker.sh (+34/-0)
jenkins/README.txt (+1/-0)
jenkins/Test_Azure.sh (+17/-0)
jenkins/build_lib.sh (+33/-0)
jenkins/env-test.sh (+2/-0)
launch_kvm.sh (+222/-0)
maas_config.sh (+75/-0)
make-seed.sh (+147/-0)
overlay.sh (+23/-0)
pylib/changelogger.py (+222/-0)
pylib/changelogger/ChangeLogger.py (+222/-0)
pylib/requests/__init__.py (+77/-0)
pylib/requests/adapters.py (+388/-0)
pylib/requests/api.py (+120/-0)
pylib/requests/auth.py (+193/-0)
pylib/requests/cacert.pem (+5026/-0)
pylib/requests/certs.py (+24/-0)
pylib/requests/compat.py (+115/-0)
pylib/requests/cookies.py (+454/-0)
pylib/requests/exceptions.py (+75/-0)
pylib/requests/hooks.py (+45/-0)
pylib/requests/models.py (+803/-0)
pylib/requests/packages/__init__.py (+3/-0)
pylib/requests/packages/chardet/__init__.py (+32/-0)
pylib/requests/packages/chardet/big5freq.py (+925/-0)
pylib/requests/packages/chardet/big5prober.py (+42/-0)
pylib/requests/packages/chardet/chardetect.py (+46/-0)
pylib/requests/packages/chardet/chardistribution.py (+231/-0)
pylib/requests/packages/chardet/charsetgroupprober.py (+106/-0)
pylib/requests/packages/chardet/charsetprober.py (+62/-0)
pylib/requests/packages/chardet/codingstatemachine.py (+61/-0)
pylib/requests/packages/chardet/compat.py (+34/-0)
pylib/requests/packages/chardet/constants.py (+39/-0)
pylib/requests/packages/chardet/cp949prober.py (+44/-0)
pylib/requests/packages/chardet/escprober.py (+86/-0)
pylib/requests/packages/chardet/escsm.py (+242/-0)
pylib/requests/packages/chardet/eucjpprober.py (+90/-0)
pylib/requests/packages/chardet/euckrfreq.py (+596/-0)
pylib/requests/packages/chardet/euckrprober.py (+42/-0)
pylib/requests/packages/chardet/euctwfreq.py (+428/-0)
pylib/requests/packages/chardet/euctwprober.py (+41/-0)
pylib/requests/packages/chardet/gb2312freq.py (+472/-0)
pylib/requests/packages/chardet/gb2312prober.py (+41/-0)
pylib/requests/packages/chardet/hebrewprober.py (+283/-0)
pylib/requests/packages/chardet/jisfreq.py (+569/-0)
pylib/requests/packages/chardet/jpcntx.py (+219/-0)
pylib/requests/packages/chardet/langbulgarianmodel.py (+229/-0)
pylib/requests/packages/chardet/langcyrillicmodel.py (+329/-0)
pylib/requests/packages/chardet/langgreekmodel.py (+225/-0)
pylib/requests/packages/chardet/langhebrewmodel.py (+201/-0)
pylib/requests/packages/chardet/langhungarianmodel.py (+225/-0)
pylib/requests/packages/chardet/langthaimodel.py (+200/-0)
pylib/requests/packages/chardet/latin1prober.py (+139/-0)
pylib/requests/packages/chardet/mbcharsetprober.py (+86/-0)
pylib/requests/packages/chardet/mbcsgroupprober.py (+54/-0)
pylib/requests/packages/chardet/mbcssm.py (+575/-0)
pylib/requests/packages/chardet/sbcharsetprober.py (+120/-0)
pylib/requests/packages/chardet/sbcsgroupprober.py (+69/-0)
pylib/requests/packages/chardet/sjisprober.py (+91/-0)
pylib/requests/packages/chardet/universaldetector.py (+170/-0)
pylib/requests/packages/chardet/utf8prober.py (+76/-0)
pylib/requests/packages/urllib3/__init__.py (+58/-0)
pylib/requests/packages/urllib3/_collections.py (+205/-0)
pylib/requests/packages/urllib3/connection.py (+204/-0)
pylib/requests/packages/urllib3/connectionpool.py (+710/-0)
pylib/requests/packages/urllib3/contrib/ntlmpool.py (+120/-0)
pylib/requests/packages/urllib3/contrib/pyopenssl.py (+422/-0)
pylib/requests/packages/urllib3/exceptions.py (+126/-0)
pylib/requests/packages/urllib3/fields.py (+177/-0)
pylib/requests/packages/urllib3/filepost.py (+100/-0)
pylib/requests/packages/urllib3/packages/__init__.py (+4/-0)
pylib/requests/packages/urllib3/packages/ordered_dict.py (+260/-0)
pylib/requests/packages/urllib3/packages/six.py (+385/-0)
pylib/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py (+13/-0)
pylib/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py (+105/-0)
pylib/requests/packages/urllib3/poolmanager.py (+258/-0)
pylib/requests/packages/urllib3/request.py (+141/-0)
pylib/requests/packages/urllib3/response.py (+308/-0)
pylib/requests/packages/urllib3/util/__init__.py (+27/-0)
pylib/requests/packages/urllib3/util/connection.py (+45/-0)
pylib/requests/packages/urllib3/util/request.py (+68/-0)
pylib/requests/packages/urllib3/util/response.py (+13/-0)
pylib/requests/packages/urllib3/util/ssl_.py (+133/-0)
pylib/requests/packages/urllib3/util/timeout.py (+234/-0)
pylib/requests/packages/urllib3/util/url.py (+162/-0)
pylib/requests/sessions.py (+637/-0)
pylib/requests/status_codes.py (+88/-0)
pylib/requests/structures.py (+127/-0)
pylib/requests/utils.py (+673/-0)
register-vagrant-version.sh (+107/-0)
rss-cleanup.sh (+16/-0)
rss-generate.sh (+103/-0)
should_build.py (+484/-0)
standalone.sh (+303/-0)
templates/default.tmpl (+420/-0)
templates/example-addin.tmpl (+140/-0)
templates/handle-xdeb.py (+15/-0)
templates/img-azure-12.04-addin.tmpl (+47/-0)
templates/img-azure-14.04-addin.tmpl (+58/-0)
templates/img-azure-14.10-addin.tmpl (+60/-0)
templates/img-azure-15.04-addin.tmpl (+59/-0)
templates/img-azure-15.10-addin.tmpl (+50/-0)
templates/img-azure-15.10-docker.tmpl (+25/-0)
templates/img-azure-16.04-addin.tmpl (+58/-0)
templates/img-azure-16.04-docker.tmpl (+8/-0)
templates/img-azure-16.10-addin.tmpl (+58/-0)
templates/img-azure-16.10-docker.tmpl (+8/-0)
templates/img-azure-17.04-addin.tmpl (+58/-0)
templates/img-azure-17.10-addin.tmpl (+58/-0)
templates/img-azure-18.04-addin.tmpl (+58/-0)
templates/img-azure-extra.tmpl (+19/-0)
templates/img-azure.tmpl (+354/-0)
templates/img-build.tmpl (+135/-0)
templates/img-extra-nets.tmpl (+141/-0)
templates/img-juju-addin.tmpl (+250/-0)
templates/img-juju.tmpl (+455/-0)
templates/img-maas.tmpl (+96/-0)
templates/img-maasv2.tmpl (+137/-0)
templates/img-maasv3.tmpl (+85/-0)
templates/img-smartcloud.tmpl (+112/-0)
templates/img-update.tmpl (+292/-0)
templates/img-vagrant.tmpl (+294/-0)
templates/img-vps.tmpl (+67/-0)
tests/azure-node-settings-tool.py (+111/-0)
tests/azure.sh (+286/-0)
tests/decider.py (+285/-0)
tests/jenkins-ssh (+68/-0)
tests/passless-sudoifer (+57/-0)
tests/run-azure.sh (+29/-0)
tests/test-azure.py (+233/-0)
tests/tracker.py (+187/-0)
tracker.sh (+16/-0)
tweet.sh (+44/-0)
ubuntu-adj2version (+53/-0)
update_release_directory.sh (+17/-0)
wait_package.sh (+27/-0)
To merge this branch: bzr merge lp://qastaging/~chad.smith/vmbuilder/jenkins_kvm_azure_netplan_hotplug
Reviewer Review Type Date Requested Status
VMBuilder Pending
Review via email: mp+347174@code.qastaging.launchpad.net

This proposal has been superseded by a proposal from 2018-05-31.

Commit message

Update Azure's nic hotplug script to use netplan if available instead of ENI

Also avoid appending unnecessary include directives in
/etc/network/interfaces on netplan-enabled systems.

Description of the change

WIP: I think I targeted the wrong branch, will resubmit tomorrow
diff should be http://paste.ubuntu.com/p/Kx8YrXv7cp/

Azure images deliver a script /usr/local/sbin/ephemeral_eth.sh which is called from udev add rules on nic hotplug events for nics named eth[1-9]*. This script was created when netplan wasn't a 'thing' and, as such, only cared about /etc/network/interfaces.

In Bionic and later, cloud-init writes a fallback interface config in /etc/netplan/50-cloud-init.yaml configuration dhcp on eth0 as a primary/mandatory NIC (optional: false). So boot will wait on that device to come up.

This changeset adds a test whether netplan command exists in ephemeral_eth.sh:
  - If netplan is present, a separate /etc/netplan/90-hotplug-<nicname>.yaml will be generated for each network device eth[1-9]n* that is attached after cloud-init's initial network configuration.
  - After the netplan yaml is created, call 'netplan apply' to bring up that device with dchp. The netplan config will specify that these nics are "optional: true" so that subsequent boots will not wait on them to come up in case they are subsequently detached.

Attaching nics in Azure is done through their UI or API. The attaching/detaching operation in Azure requires an instance to be stopped before attach/detach and started after the operation.

  Potental gap:
     There is no attempt to clean up old netplan yaml files, or to designate a new primary/mandatory nic because this original hotplug script didn't deal with udev rules for hotplug removal of nics (via Azure network interface detachment).
     This could present a minor issue if eth1 is attached (and optional by design) and eth0 gets detached. In that case, systemd may still wait for eth0 to come up because of the mandatory eth0 definition in /etc/netplan/50-cloud-init.yaml.

To post a comment you must log in.
Revision history for this message
Daniel Axtens (daxtens) wrote :

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:
....version: 2
....ethernets:
........ephemeral:
............dhcp4: true
............match:
................driver: hv_netvsc
................name: "eth*"
............optional: true

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.

800. By Chad Smith

Revert changes to ephemeral_eth.sh and emit a netplan 90-hotplug-azure.yaml

cloud-init only sets up a network configuration at initial boot pinned to
the original macaddress. If we are building a netplan enabled image,
emit a static netplan yaml which will complement the orignal /etc/netplan/50-cloud-init.yaml fallback definition. If the original eth0 is no longer attached to vm, cloud-init's netplan yaml will not match by macaddress and system will fall through to match the following hotpluggedeth0 definition:

        hotpluggedeth0:
            dhcp4: true
            match:
                driver: hv_netvsc
                name: 'eth0'

801. By Chad Smith

Move /etc/network/interfaces include directive back out of config_udev.

Appended include directive in /etc/network/interfaces needs to exist for
both upstart and udev solutions. So, it can't live exclusively within
config_udev_or_netplan function. It needs to be present on all non-netplan
environments (upstart and ENI), but test we are not a netplan enabled
image before manipulating /etc/network/interfaces.

Unmerged revisions

801. By Chad Smith

Move /etc/network/interfaces include directive back out of config_udev.

Appended include directive in /etc/network/interfaces needs to exist for
both upstart and udev solutions. So, it can't live exclusively within
config_udev_or_netplan function. It needs to be present on all non-netplan
environments (upstart and ENI), but test we are not a netplan enabled
image before manipulating /etc/network/interfaces.

800. By Chad Smith

Revert changes to ephemeral_eth.sh and emit a netplan 90-hotplug-azure.yaml

cloud-init only sets up a network configuration at initial boot pinned to
the original macaddress. If we are building a netplan enabled image,
emit a static netplan yaml which will complement the orignal /etc/netplan/50-cloud-init.yaml fallback definition. If the original eth0 is no longer attached to vm, cloud-init's netplan yaml will not match by macaddress and system will fall through to match the following hotpluggedeth0 definition:

        hotpluggedeth0:
            dhcp4: true
            match:
                driver: hv_netvsc
                name: 'eth0'

799. By Chad Smith

Update Azure's nic hotplug script to use netplan if available instead of ENI

Also avoid appending unnecessary include directives in
/etc/network/interfaces on netplan-enabled systems.

798. By Dan Watkins

Install Azure model assertion in Azure bionic images

797. By Dan Watkins

Install linux-azure in bionic Azure images [a=Odd_Bloke][r=fginther,tribaal]

MP: https://code.launchpad.net/~ubuntu-on-ec2/vmbuilder/jenkins_kvm-oddbloke/+merge/341846

796. By Philip Roche

Merge lp:~ubuntu-on-ec2/vmbuilder/jenkins_kvm-oddbloke into lp:~ubuntu-on-ec2/vmbuilder/jenkins_kvm [a=daniel-thewatkins] [r=fginther,philroche]

Use HTTPS for Vagrant box redirects (LP: #1754948)

MP: https://code.launchpad.net/~ubuntu-on-ec2/vmbuilder/jenkins_kvm-oddbloke/+merge/341339

795. By Dan Watkins

Drop unscd from bionic Azure images [a=Odd_Bloke][r=fginther,philroche]

MP: https://code.launchpad.net/~daniel-thewatkins/vmbuilder/jenkins_kvm-drop-unscd/+merge/337830

794. By Dan Watkins

do not explicitly install cloud-init [a=mwhudson][r=fginther,Odd_Bloke,philroche]

MP: https://code.launchpad.net/~mwhudson/vmbuilder/jenkins_kvm.mwhudson/+merge/334878

793. By Francis Ginther

Update source image and package set for artful. Dropping packages that no longer exist.
[a=fginther][r=daniel-thewatkins,philroche,tribaal]

MP: https://code.launchpad.net/~fginther/vmbuilder/new-artful-builder/+merge/332487

792. By Francis Ginther

Add a bb-series version of the Azure suite specific template files, img-azure-18.04-addin.tmpl.
[a=fginther][r=daniel-thewatkins,rcj]

MP: https://code.launchpad.net/~fginther/vmbuilder/jenkins_kvm-add-azure-18.04/+merge/332368

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches