Merge lp:~josvaz/vmbuilder/jenkins_kvm+fix-eth1boot into lp:~ubuntu-on-ec2/vmbuilder/jenkins_kvm

Proposed by Jose L. VG on 2016-11-04
Status: Merged
Merged at revision: 779
Proposed branch: lp:~josvaz/vmbuilder/jenkins_kvm+fix-eth1boot
Merge into: lp:~ubuntu-on-ec2/vmbuilder/jenkins_kvm
Diff against target: 124 lines (+67/-30)
1 file modified
templates/img-extra-nets.tmpl (+67/-30)
To merge this branch: bzr merge lp:~josvaz/vmbuilder/jenkins_kvm+fix-eth1boot
Reviewer Review Type Date Requested Status
Robert C Jennings Approve on 2016-11-16
Philip Roche 2016-11-04 Approve on 2016-11-16
Review via email: mp+310047@code.launchpad.net

Description of the Change

Remove the ifup call that was breaking the boot

ifup should be unnecesary with allow-hotplug, but in this case it was making the first boot hung, even if invoked in the background.

I also made some improvements to the udev rule to avoid it being invoked on eth0 and use RUN instead of PROGRAM.

To post a comment you must log in.
Jose L. VG (josvaz) wrote :

Commit 774 re-applies the broken eth1+ autoconfig patch.
Commit 775 is the actual fix.
Commit 776 is a enhancement.

Jose L. VG (josvaz) wrote :

Although it looks good so far, this is still under testing.
Feel free to review and even Approve, but code won't be merged until all testing is completed succesfully.

Philip Roche (philroche) wrote :

Syntax looks good to me.

review: Approve
Jose L. VG (josvaz) wrote :

Will need more work, testing reveals that trusty fails to boot now.
This is a surprise, as the eth1+ patch tries to apply most changes to xenial, onward, leaving previous releases like trusty almost untouched, apart from using /run... for the ephemeral net devices config instead of /etc/network/interfaces/dynamic.d

Jose L. VG (josvaz) wrote :

upstart code path fixed with commit 777, please review

Jose L. VG (josvaz) wrote :

This MP has passed manual multi-nic tests for the combinations:
{Standard_DS2_v2,A8} x {precise, trusty, xenial, yakkety, zesty}

No issues or regressions found.

Robert C Jennings (rcj) wrote :

This looks good. Glad to hear that testing covered the two instance types across the full set of supported suites.

review: Approve
Jose L. VG (josvaz) wrote :

I will be merging this once I pass all AzureTests against all suites using test images

Jose L. VG (josvaz) wrote :

xenial tests:

https://cloud-images-jenkins.canonical.com/view/Azure/job/Azure-Tests/787/

Ubuntu_DAILY_BUILD-xenial-16_04-LTS-amd64-server-20161104-ethx-1478604131-en-us-30GB

Jose L. VG (josvaz) wrote :
Jose L. VG (josvaz) wrote :

Trusty tests:
Ubuntu_DAILY_BUILD-trusty-14_04_5-LTS-amd64-server-20161104-ethx-1478613062-en-us-30GB
https://cloud-images-jenkins.canonical.com/view/Azure/job/Azure-Tests/788/

Jose L. VG (josvaz) wrote :

Trusted passed

(Passed = unstable ONLY in lxd tests, success everywhere else)

Jose L. VG (josvaz) wrote :

Just discovered the precise test image is NOT properly built:
- It has the udev changes IN, instead of the upstart ones.

I checked trusty (that just passed the tests) and is ALSO using the udev change sinstead of the upstart.

I think something did not work as expected when bulding the Azure tests images. I am guessing I might have missed a build parameter setting. Precise & trusty were built as if SUITE was set to xenial or yakkety.

I can let yakkety pass the tests (as the image will be buolt correctly for it) and then repeat trusty test and add precise tests ONCE I get test images properly built for them.

Jose L. VG (josvaz) wrote :

Just a clarification, so far NOTHING is found wrong with the MP, the test images might have been misbuilt due to improper inputs. When I did test the MP manually trusty & precise where setup with upstart and no udev, as expected.

Jose L. VG (josvaz) wrote :

Yakkety tests:
Ubuntu_DAILY_BUILD-yakkety-16_10-amd64-server-20161105-ethx-1478613973-en-us-30GB
https://cloud-images-jenkins.canonical.com/view/Azure/job/Azure-Tests/789/

Jose L. VG (josvaz) wrote :

Need to setup
https://cloud-images-jenkins.canonical.com/view/Azure/job/CloudImages_Azure-Custom_or_Test_Images/configure
So that the KVM scipt ALSO gets passed the proper SUITE variable.

Right now some scripts infer SUITE from VERSION. But the value is NOT job wide scope, so if it is not detected in the script, it is NOT set.

Jose L. VG (josvaz) wrote :

Yakkety tests failed in a couple of LXD test cases:
https://cloud-images-jenkins.canonical.com/view/Azure/job/Azure-Tests/789/

Rerunning those as I think they are transients.

Jose L. VG (josvaz) wrote :

Yakkety tests passed, the issues were transient as suspected:
https://cloud-images-jenkins.canonical.com/view/Azure/job/Azure-Tests/789/
https://cloud-images-jenkins.canonical.com/view/Azure/job/Azure-Tests/790/

Pending are the precise, trusty & zesty tests, but for that I need first to fix this job:
https://cloud-images-jenkins.canonical.com/view/Azure/job/CloudImages_Azure-Custom_or_Test_Images/configure
To make sure the test images are generated with a proper SUITE setting.

Jose L. VG (josvaz) wrote :
Jose L. VG (josvaz) wrote :

For some reason, the KVM builds of precise & trusty is STILL not getting my SUITE setting right.

Jose L. VG (josvaz) wrote :

Turns out that inside KVM the SUITE var used is in lowercase "suite"!

So instead of fixing the lack of consistency I should probably just fix this MP instead and use ${suite} instead of ${SUITE}

Jose L. VG (josvaz) wrote :

Suite variable used now by this MP is lowercase, so lets try it...

Jose L. VG (josvaz) wrote :

precise test image created correctly now:

Ubuntu_DAILY_BUILD-precise-12_04_5-LTS-amd64-server-20161109-ethx-1479204698-en-us-30GB

https://cloud-images-jenkins.canonical.com/view/Azure/job/CloudImages_Azure-Custom_or_Test_Images/307/console

Jose L. VG (josvaz) wrote :
Jose L. VG (josvaz) wrote :

trusty test image createc correctly:
Ubuntu_DAILY_BUILD-trusty-14_04_5-LTS-amd64-server-20161111-ethx-1479205498-en-us-30GB

https://cloud-images-jenkins.canonical.com/view/Azure/job/CloudImages_Azure-Custom_or_Test_Images/308/console

Jose L. VG (josvaz) wrote :
Jose L. VG (josvaz) wrote :

trusty test image passed AzureTests as expected (only unstable at lxd tests):
https://cloud-images-jenkins.canonical.com/job/Azure-Tests/792/

precise test experienced a single failure, a transient:
https://cloud-images-jenkins.canonical.com/view/Azure/job/Azure-Tests/791/

Rerun of the failed precise test passed at:
https://cloud-images-jenkins.canonical.com/view/Azure/job/Azure-Tests/793/

Jose L. VG (josvaz) wrote :

This MP right now passes all AzureTests for all supported suites.

Zesty is missing but I fear I will continue to have issues creating a test image for it.

Please review and approve, also let me know if we should or not wait for zesty tests to marge this MP.

Jose L. VG (josvaz) wrote :

Might have fixed the zesty test image building for Azure, testing it here:
https://cloud-images-jenkins.canonical.com/view/Azure/job/CloudImages_Azure-Custom_or_Test_Images/311/console

Jose L. VG (josvaz) wrote :

zesty test image produced:
https://cloud-images-jenkins.canonical.com/view/Azure/job/CloudImages_Azure-Custom_or_Test_Images/311/console

Ubuntu_DAILY_BUILD-zesty-17_04-amd64-server-20161111-ethx-1479217570-en-us-30GB

Now I need to validate is probably built with this MP changes applied to the image.

Jose L. VG (josvaz) wrote :

Zesty image is good, it has the MP changes as expected.

Testing now at:
https://cloud-images-jenkins.canonical.com/view/Azure/job/Azure-Tests/794/

Jose L. VG (josvaz) wrote :

Zesty passed:
https://cloud-images-jenkins.canonical.com/view/Azure/job/Azure-Tests/794/

As zesty can pass right now in Azure, which is azure-general fails due to a known issue, which bug I can't find at the moment.

Jose L. VG (josvaz) wrote :

Please, review, all test passed this is ready to go!

Jose L. VG (josvaz) wrote :

BTW, the zesty azure-general issue is:
https://bugs.launchpad.net/cloud-images/+bug/1638964

Philip Roche (philroche) wrote :

LGTM

review: Approve
Robert C Jennings (rcj) wrote :

+1 on the SuItE change.

Robert C Jennings (rcj) :
review: Approve
775. By Jose L. VG on 2016-11-16

Re-apply eth1+ changes to be fixed

776. By Jose L. VG on 2016-11-16

Remove the ifup call that was breaking the boot

ifup should be unnecesary with allow-hotplug, but in this case it was
making the first boot hung, even if invoked in the background.

777. By Jose L. VG on 2016-11-16

Enhance udev rule: skip eth0 and do RUN

The udev expressions are not full regex, eth[1-9]* just means:
'eth' followed by a number 1-9 and 'zero or more chars'
That will NOT match eth0 (or eth0something) but will match eth1 to eth99
(and will also match things like eth2xd)

Also looking at udev man RUN is more appropriate as it is an action,
while PROGRAM is still part of the matching filters.

778. By Jose L. VG on 2016-11-16

Place mkdir at the proper time for upstart

The mkdir was was misplaced for upstart code path, as the new directory
we use under /run is already mounted by the OS we don't need to create it
at image preparation time, BUT we do need it to be there for autoconfig
eth1+ to work.

779. By Jose L. VG on 2016-11-16

Fix ${SUITE} to ${suite}

Turns out that KVM templates in general (and Azure ones specifically) use the
variable name $suite} lowercase instead of the more common uppercase ${SUITE}
in jenkins and jerff env variables.

Jose L. VG (josvaz) wrote :

This has been "git pull --rebase"d so that now they can be mergen cleanly

Jose L. VG (josvaz) wrote :

merged cleanly I meant

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'templates/img-extra-nets.tmpl'
2--- templates/img-extra-nets.tmpl 2016-11-02 12:46:14 +0000
3+++ templates/img-extra-nets.tmpl 2016-11-16 17:32:59 +0000
4@@ -1,29 +1,16 @@
5 ######################
6 ## BEGIN NICS
7 ## This adds upstart jobs for the creation of hot-plug NICS
8+## For xenial onward, udev is configured instead
9 # vi: ts=4 noexpandtab syntax=sh
10
11-int_d="/etc/network/interfaces.dynamic.d"
12-xchroot mkdir -p ${int_d}
13-
14-## Place readme to notify people what is going on
15-cat << EOF > ${mp}${int_d}/README
16-WARNING: This is mounted over during boot!
17-
18-If you are seeing this file, it means that you have disabled the tmpfs mount
19- in /etc/fstab for ${int_d}. Therefore, this directory
20- is ephemeral.
21-
22-This directory is normally populated at boot for any interface that is not
23- eth0 with a dynamic configuration.
24-
25-${CLOUD_IMG_STR}
26-EOF
27-
28-# Give an upstart job for defining a secondary interface
29-# if needed.
30-cat << EOF > ${mp}/etc/init/network-conf-ethX.conf
31-# Enable DHCP configuration for additional ethX devices
32+int_d="/run/network/interfaces.ephemeral.d"
33+
34+function config_upstart {
35+ # Give an upstart job for defining a secondary interface
36+ # if needed.
37+ cat << EOF > ${mp}/etc/init/network-conf-ethX.conf
38+# Enable DHCP configuration for eth1+ devices as they appear
39 ${CLOUD_IMG_STR}
40
41 description "Dynamically populate ${int_d}"
42@@ -39,7 +26,10 @@
43 case \$INTERFACE in
44 eth0) #skip, this is static
45 ;;
46- eth*) cat << EOM > \$net_int_d/\$INTERFACE.cfg
47+ eth*)
48+ # Ensure \${net_int_d} exists on the ephemeral mount
49+ mkdir -p \${net_int_d}
50+ cat << EOM > \$net_int_d/\$INTERFACE.cfg
51 allow-hotplug \$INTERFACE
52 iface \$INTERFACE inet dhcp
53 EOM
54@@ -50,15 +40,62 @@
55 esac
56 end script
57 EOF
58-
59-# Add an ephemeral mount for holding additional NIC interfaces
60-cat << EOF >> ${mp}/etc/fstab
61-
62+}
63+
64+function config_udev {
65+ # Give a udev script to define eth1+ interfaces, as they appear
66+ cat << EOF > ${mp}/usr/local/sbin/ephemeral_eth.sh
67+#!/bin/bash
68 ${CLOUD_IMG_STR}
69-# The following is used to dynamically configured additional
70-# NICs. Do not remove unless you know what you are doing.
71-none ${int_d} tmpfs nodev,noexec,nosuid,size=64K 0 0
72-EOF
73+# Enable DHCP configuration for ethx devices other than eth0
74+# Called by udev to define eth1+ interfaces, as they appear
75+
76+INTERFACE=\$1
77+net_int_d="${int_d}"
78+
79+function configure_nic {
80+ # Ensure \${net_int_d} exists on the ephemeral mount
81+ mkdir -p \${net_int_d}
82+
83+ # Setup the interface config file
84+ cat << EOM > \${net_int_d}/\${INTERFACE}.cfg
85+# Added by \$0
86+allow-hotplug \${INTERFACE}
87+iface \${INTERFACE} inet dhcp
88+EOM
89+}
90+
91+case \${INTERFACE} in
92+ eth0) #skip, this is static
93+ ;;
94+ eth*)
95+ if [ ! -e \${net_int_d}/\${INTERFACE}.cfg ]
96+ then
97+ configure_nic
98+ fi
99+ ;;
100+ *)
101+ ;;
102+esac
103+EOF
104+ # Make the script executable
105+ xchroot chmod +x /usr/local/sbin/ephemeral_eth.sh
106+
107+ # Place an udev rule to call the script when an net device is added
108+ cat << EOF > ${mp}/etc/udev/rules.d/10-net-device-added.rules
109+# Run /usr/local/sbin/ephemeral_eth.sh every time a network device is added
110+ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth[1-9]*", RUN="/usr/local/sbin/ephemeral_eth.sh %k"
111+EOF
112+}
113+
114+case ${suite} in
115+ precise|trusty)
116+ config_upstart
117+ ;;
118+ *)
119+ config_udev
120+ ;;
121+esac
122
123 # Add the network ephemeral mount...
124 cat << EOF >> ${mp}/etc/network/interfaces

Subscribers

People subscribed via source and target branches