Merge lp:~fginther/vmbuilder/jenkins_kvm-ci-wa-all into lp:~ubuntu-on-ec2/vmbuilder/jenkins_kvm

Proposed by Francis Ginther on 2019-04-24
Status: Merged
Merged at revision: 824
Proposed branch: lp:~fginther/vmbuilder/jenkins_kvm-ci-wa-all
Merge into: lp:~ubuntu-on-ec2/vmbuilder/jenkins_kvm
Diff against target: 59 lines (+28/-0)
3 files modified
templates/img-azure-16.04-addin.tmpl (+10/-0)
templates/img-azure-18.10-addin.tmpl (+9/-0)
templates/img-azure-19.04-addin.tmpl (+9/-0)
To merge this branch: bzr merge lp:~fginther/vmbuilder/jenkins_kvm-ci-wa-all
Reviewer Review Type Date Requested Status
David Krauser 2019-04-24 Approve on 2019-04-24
Tobias Koch (community) 2019-04-24 Approve on 2019-04-24
Review via email: mp+366457@code.launchpad.net

Commit message

Add cloud-init multi-nic workaround for SF Case #222480 (add for 16.04, 18.10, 19.04)

When adding network devices after first boot, network configuration
data is not created and the devices are unusable.

This workaround creates a systemd drop-in file to clear out the
cloud-init persistent object forcing cloud-init to perform network
discovery on each boot.

Description of the change

This is the same fix as https://code.launchpad.net/~cloudware/vmbuilder/jenkins_kvm-fginther/+merge/366182 applied to the other active releases except trusty (which uses an older cloud-init).

To post a comment you must log in.
Tobias Koch (tobijk) :
review: Approve
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'templates/img-azure-16.04-addin.tmpl'
2--- templates/img-azure-16.04-addin.tmpl 2017-10-16 21:01:28 +0000
3+++ templates/img-azure-16.04-addin.tmpl 2019-04-24 13:15:34 +0000
4@@ -48,6 +48,16 @@
5
6 EOF
7
8+# Apply a workaround for adding multiple NICs (SF Case #222480)
9+# This clears cloud-init's persistent network object, forcing network
10+# rediscovery on each boot (which correctly finds NICs added after VM creation)
11+mkdir -p "${mp}/lib/systemd/system/cloud-init-local.service.d"
12+cat << EOF > "${mp}/lib/systemd/system/cloud-init-local.service.d/50-azure-clear-persistent-obj-pkl.conf"
13+[Service]
14+ExecStartPre=-/bin/sh -xc 'if [ -e /var/lib/cloud/instance/obj.pkl ]; then echo "cleaning persistent cloud-init object"; rm /var/lib/cloud/instance/obj.pkl; fi; exit 0'
15+EOF
16+
17+
18 # Frame buffer fix
19 cat << EOF >> "${mp}/etc/initramfs-tools/modules"
20
21
22=== modified file 'templates/img-azure-18.10-addin.tmpl'
23--- templates/img-azure-18.10-addin.tmpl 2019-03-26 17:12:13 +0000
24+++ templates/img-azure-18.10-addin.tmpl 2019-04-24 13:15:34 +0000
25@@ -47,6 +47,15 @@
26 security: http://ports.ubuntu.com/ubuntu-ports
27 EOF
28
29+# Apply a workaround for adding multiple NICs (SF Case #222480)
30+# This clears cloud-init's persistent network object, forcing network
31+# rediscovery on each boot (which correctly finds NICs added after VM creation)
32+mkdir -p "${mp}/lib/systemd/system/cloud-init-local.service.d"
33+cat << EOF > "${mp}/lib/systemd/system/cloud-init-local.service.d/50-azure-clear-persistent-obj-pkl.conf"
34+[Service]
35+ExecStartPre=-/bin/sh -xc 'if [ -e /var/lib/cloud/instance/obj.pkl ]; then echo "cleaning persistent cloud-init object"; rm /var/lib/cloud/instance/obj.pkl; fi; exit 0'
36+EOF
37+
38 # Frame buffer fix
39 cat << EOF >> "${mp}/etc/initramfs-tools/modules"
40
41
42=== modified file 'templates/img-azure-19.04-addin.tmpl'
43--- templates/img-azure-19.04-addin.tmpl 2018-10-25 10:52:01 +0000
44+++ templates/img-azure-19.04-addin.tmpl 2019-04-24 13:15:34 +0000
45@@ -48,6 +48,15 @@
46
47 EOF
48
49+# Apply a workaround for adding multiple NICs (SF Case #222480)
50+# This clears cloud-init's persistent network object, forcing network
51+# rediscovery on each boot (which correctly finds NICs added after VM creation)
52+mkdir -p "${mp}/lib/systemd/system/cloud-init-local.service.d"
53+cat << EOF > "${mp}/lib/systemd/system/cloud-init-local.service.d/50-azure-clear-persistent-obj-pkl.conf"
54+[Service]
55+ExecStartPre=-/bin/sh -xc 'if [ -e /var/lib/cloud/instance/obj.pkl ]; then echo "cleaning persistent cloud-init object"; rm /var/lib/cloud/instance/obj.pkl; fi; exit 0'
56+EOF
57+
58 # Frame buffer fix
59 cat << EOF >> "${mp}/etc/initramfs-tools/modules"
60

Subscribers

People subscribed via source and target branches