Merge ~smoser/curtin:cleanup/always-use-bootif into curtin:master

Proposed by Scott Moser
Status: Merged
Approved by: Scott Moser
Approved revision: 5e65be2056fc88db15d684b1833c86d4e299107c
Merge reported by: Scott Moser
Merged at revision: df7f58977c3d4e4630be894e295eae44be68af88
Proposed branch: ~smoser/curtin:cleanup/always-use-bootif
Merge into: curtin:master
Diff against target: 192 lines (+31/-22)
10 files modified
tests/vmtests/__init__.py (+31/-12)
tests/vmtests/test_centos_basic.py (+0/-2)
tests/vmtests/test_network.py (+0/-1)
tests/vmtests/test_network_alias.py (+0/-1)
tests/vmtests/test_network_bonding.py (+0/-1)
tests/vmtests/test_network_bridging.py (+0/-1)
tests/vmtests/test_network_ipv6.py (+0/-1)
tests/vmtests/test_network_mtu.py (+0/-1)
tests/vmtests/test_network_static.py (+0/-1)
tests/vmtests/test_network_vlan.py (+0/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Ryan Harper (community) Approve
Review via email: mp+337670@code.launchpad.net

Commit message

vmtest: always boot with BOOTIF and ip=:::::BOOTIF:dhcp

This excercises part of boot that was excercised in MAAS but not here.
Cloud-initramfs-dyn-netconf translates BOOTIF to the device name.

See bug #1749019 for some more context.

Description of the change

see commit message

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ryan Harper (raharper) :
Revision history for this message
Scott Moser (smoser) :
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ryan Harper (raharper) wrote :

Nice, thanks for the refactor and comments. Approved with a vmtest run passing.

review: Approve
Revision history for this message
Scott Moser (smoser) wrote :

Ryan,
good catch on hostname.
you were right, I documented the *wrong* format.
Apparently googles' answer to 'klibc ipconfig' was wrong:
  https://kernel.googlesource.com/pub/scm/libs/klibc/klibc/+/klibc-0.130/ipconfig/README
There it is documented:
  addr:server:gateway:netmask:interface:proto

But Ubuntu's version:
  https://git.launchpad.net/ubuntu/+source/klibc/tree/usr/kinit/ipconfig/README.ipconfig
documents (and uses):
  <client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>

So my code was right, but doc was wrong. They're fixed now.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) wrote :
Revision history for this message
Scott Moser (smoser) wrote :

The above run failed on these two tests:
  tests/vmtests/test_network_bridging.py:Centos66TestBridgeNetwork
  tests/vmtests/test_network_alias.py:Centos66TestNetworkAlias

I did not reproduce those failures on diglett, and re-ran again
in jenkins just those tests at:

  https://jenkins.ubuntu.com/server/view/curtin/job/curtin-vmtest-devel-debug/55/console

That was green.

Ryan mentioned in IRC: "those are load related failures".

so... I think this is ready to go.

Revision history for this message
Scott Moser (smoser) wrote :

An upstream commit landed for this bug.

To view that commit see the following URL:
https://git.launchpad.net/curtin/commit/?id=df7f5897

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/tests/vmtests/__init__.py b/tests/vmtests/__init__.py
index b5aa538..4f32c45 100644
--- a/tests/vmtests/__init__.py
+++ b/tests/vmtests/__init__.py
@@ -708,8 +708,8 @@ class VMBaseClass(TestCase):
708 cmd.extend([708 cmd.extend([
709 "--root-arg=root=%s" % root_url,709 "--root-arg=root=%s" % root_url,
710 "--append=overlayroot=tmpfs",710 "--append=overlayroot=tmpfs",
711 "--append=ip=dhcp", # enable networking
712 ])711 ])
712
713 # getting resolvconf configured is only fixed in bionic713 # getting resolvconf configured is only fixed in bionic
714 # the iscsi_auto handles resolvconf setup via call to714 # the iscsi_auto handles resolvconf setup via call to
715 # configure_networking in initramfs715 # configure_networking in initramfs
@@ -733,7 +733,7 @@ class VMBaseClass(TestCase):
733 cls.network_state = curtin_net.parse_net_config(cls.conf_file)733 cls.network_state = curtin_net.parse_net_config(cls.conf_file)
734 logger.debug("Network state: {}".format(cls.network_state))734 logger.debug("Network state: {}".format(cls.network_state))
735735
736 # build -n arg list with macaddrs from net_config physical config736 # build --netdev=arg list with 'physical' nics from net_config
737 macs = []737 macs = []
738 interfaces = {}738 interfaces = {}
739 if cls.network_state:739 if cls.network_state:
@@ -744,16 +744,14 @@ class VMBaseClass(TestCase):
744 hwaddr = iface.get('mac_address')744 hwaddr = iface.get('mac_address')
745 if iface['type'] == 'physical' and hwaddr:745 if iface['type'] == 'physical' and hwaddr:
746 macs.append(hwaddr)746 macs.append(hwaddr)
747 netdevs = []747
748 if len(macs) > 0:748 if len(macs) == 0:
749 # take first mac and mark it as the boot interface to prevent DHCP749 macs = ["52:54:00:12:34:01"]
750 # on multiple interfaces which can hang the install.750
751 cmd.extend(["--append=BOOTIF=01-%s" % macs[0].replace(":", "-")])751 netdevs = ["--netdev=%s,mac=%s" % (DEFAULT_BRIDGE, m) for m in macs]
752 for mac in macs:752
753 netdevs.extend(["--netdev=" + DEFAULT_BRIDGE +753 # Add kernel parameters to simulate network boot from first nic.
754 ",mac={}".format(mac)])754 cmd.extend(kernel_boot_cmdline_for_mac(macs[0]))
755 else:
756 netdevs.extend(["--netdev=" + DEFAULT_BRIDGE])
757755
758 # build disk arguments756 # build disk arguments
759 disks = []757 disks = []
@@ -1737,6 +1735,27 @@ def get_lan_ip():
1737 return addr1735 return addr
17381736
17391737
1738def kernel_boot_cmdline_for_mac(mac):
1739 """Return kernel command line arguments for initramfs dhcp on mac.
1740
1741 Ubuntu initramfs respect klibc's ip= format for network config in
1742 initramfs. That format is:
1743 ip=addr:server:gateway:netmask:interface:proto
1744 see /usr/share/doc/libklibc/README.ipconfig.gz for more info.
1745
1746 If no 'interface' field is provided, dhcp will be tried on all. To allow
1747 specifying the interface in ip= parameter without knowing the name of the
1748 device that the kernel will choose, cloud-initramfs-dyn-netconf replaces
1749 'BOOTIF' in the ip= parameter with the name found in BOOTIF.
1750
1751 Network bootloaders append to kernel command line
1752 BOOTIF=01-<mac-address> to indicate which mac they booted from.
1753
1754 Paired with BOOTIF replacement this ends up being: ip=::::eth0:dhcp."""
1755 return ["--append=ip=:::::BOOTIF:dhcp",
1756 "--append=BOOTIF=01-%s" % mac.replace(":", "-")]
1757
1758
1740def is_unsupported_ubuntu(release):1759def is_unsupported_ubuntu(release):
1741 global _UNSUPPORTED_UBUNTU1760 global _UNSUPPORTED_UBUNTU
1742 udi = 'ubuntu-distro-info'1761 udi = 'ubuntu-distro-info'
diff --git a/tests/vmtests/test_centos_basic.py b/tests/vmtests/test_centos_basic.py
index b576279..7857e74 100644
--- a/tests/vmtests/test_centos_basic.py
+++ b/tests/vmtests/test_centos_basic.py
@@ -11,7 +11,6 @@ import textwrap
11class CentosTestBasicAbs(VMBaseClass):11class CentosTestBasicAbs(VMBaseClass):
12 __test__ = False12 __test__ = False
13 conf_file = "examples/tests/centos_basic.yaml"13 conf_file = "examples/tests/centos_basic.yaml"
14 extra_kern_args = "BOOTIF=eth0-52:54:00:12:34:00"
15 # XXX: command | tee output is required for Centos under SELinux14 # XXX: command | tee output is required for Centos under SELinux
16 # http://danwalsh.livejournal.com/22860.html15 # http://danwalsh.livejournal.com/22860.html
17 collect_scripts = VMBaseClass.collect_scripts + [textwrap.dedent(16 collect_scripts = VMBaseClass.collect_scripts + [textwrap.dedent(
@@ -74,7 +73,6 @@ class Centos66FromXenialTestBasic(relbase.centos66fromxenial,
7473
75class CentosTestBasicNetworkAbs(TestNetworkBaseTestsAbs):74class CentosTestBasicNetworkAbs(TestNetworkBaseTestsAbs):
76 conf_file = "examples/tests/centos_basic.yaml"75 conf_file = "examples/tests/centos_basic.yaml"
77 extra_kern_args = "BOOTIF=eth0-52:54:00:12:34:00"
78 collect_scripts = TestNetworkBaseTestsAbs.collect_scripts + [76 collect_scripts = TestNetworkBaseTestsAbs.collect_scripts + [
79 textwrap.dedent("""77 textwrap.dedent("""
80 cd OUTPUT_COLLECT_D78 cd OUTPUT_COLLECT_D
diff --git a/tests/vmtests/test_network.py b/tests/vmtests/test_network.py
index 6ce4262..59a25fe 100644
--- a/tests/vmtests/test_network.py
+++ b/tests/vmtests/test_network.py
@@ -437,7 +437,6 @@ class TestNetworkBasicAbs(TestNetworkBaseTestsAbs):
437437
438class CentosTestNetworkBasicAbs(TestNetworkBaseTestsAbs):438class CentosTestNetworkBasicAbs(TestNetworkBaseTestsAbs):
439 conf_file = "examples/tests/centos_basic.yaml"439 conf_file = "examples/tests/centos_basic.yaml"
440 extra_kern_args = "BOOTIF=eth0-52:54:00:12:34:00"
441 collect_scripts = TestNetworkBaseTestsAbs.collect_scripts + [440 collect_scripts = TestNetworkBaseTestsAbs.collect_scripts + [
442 textwrap.dedent("""441 textwrap.dedent("""
443 cd OUTPUT_COLLECT_D442 cd OUTPUT_COLLECT_D
diff --git a/tests/vmtests/test_network_alias.py b/tests/vmtests/test_network_alias.py
index 258554f..903b395 100644
--- a/tests/vmtests/test_network_alias.py
+++ b/tests/vmtests/test_network_alias.py
@@ -19,7 +19,6 @@ class TestNetworkAliasAbs(TestNetworkBaseTestsAbs):
1919
2020
21class CentosTestNetworkAliasAbs(TestNetworkAliasAbs):21class CentosTestNetworkAliasAbs(TestNetworkAliasAbs):
22 extra_kern_args = "BOOTIF=eth0-52:54:00:12:34:00"
23 collect_scripts = TestNetworkAliasAbs.collect_scripts + [22 collect_scripts = TestNetworkAliasAbs.collect_scripts + [
24 textwrap.dedent("""23 textwrap.dedent("""
25 cd OUTPUT_COLLECT_D24 cd OUTPUT_COLLECT_D
diff --git a/tests/vmtests/test_network_bonding.py b/tests/vmtests/test_network_bonding.py
index 24cf60f..7d07413 100644
--- a/tests/vmtests/test_network_bonding.py
+++ b/tests/vmtests/test_network_bonding.py
@@ -16,7 +16,6 @@ class TestNetworkBondingAbs(TestNetworkBaseTestsAbs):
1616
1717
18class CentosTestNetworkBondingAbs(TestNetworkBondingAbs):18class CentosTestNetworkBondingAbs(TestNetworkBondingAbs):
19 extra_kern_args = "BOOTIF=eth0-52:54:00:12:34:00"
20 collect_scripts = TestNetworkBondingAbs.collect_scripts + [19 collect_scripts = TestNetworkBondingAbs.collect_scripts + [
21 textwrap.dedent("""20 textwrap.dedent("""
22 cd OUTPUT_COLLECT_D21 cd OUTPUT_COLLECT_D
diff --git a/tests/vmtests/test_network_bridging.py b/tests/vmtests/test_network_bridging.py
index 5691b00..ca8964e 100644
--- a/tests/vmtests/test_network_bridging.py
+++ b/tests/vmtests/test_network_bridging.py
@@ -184,7 +184,6 @@ class TestBridgeNetworkAbs(TestNetworkBaseTestsAbs):
184184
185185
186class CentosTestBridgeNetworkAbs(TestBridgeNetworkAbs):186class CentosTestBridgeNetworkAbs(TestBridgeNetworkAbs):
187 extra_kern_args = "BOOTIF=eth0-52:54:00:12:34:00"
188 collect_scripts = TestBridgeNetworkAbs.collect_scripts + [187 collect_scripts = TestBridgeNetworkAbs.collect_scripts + [
189 textwrap.dedent("""188 textwrap.dedent("""
190 cd OUTPUT_COLLECT_D189 cd OUTPUT_COLLECT_D
diff --git a/tests/vmtests/test_network_ipv6.py b/tests/vmtests/test_network_ipv6.py
index 9bbfc1e..6d87dcf 100644
--- a/tests/vmtests/test_network_ipv6.py
+++ b/tests/vmtests/test_network_ipv6.py
@@ -25,7 +25,6 @@ class TestNetworkIPV6Abs(TestNetworkBaseTestsAbs):
2525
2626
27class CentosTestNetworkIPV6Abs(TestNetworkIPV6Abs):27class CentosTestNetworkIPV6Abs(TestNetworkIPV6Abs):
28 extra_kern_args = "BOOTIF=eth0-bc:76:4e:06:96:b3"
29 collect_scripts = TestNetworkIPV6Abs.collect_scripts + [28 collect_scripts = TestNetworkIPV6Abs.collect_scripts + [
30 textwrap.dedent("""29 textwrap.dedent("""
31 cd OUTPUT_COLLECT_D30 cd OUTPUT_COLLECT_D
diff --git a/tests/vmtests/test_network_mtu.py b/tests/vmtests/test_network_mtu.py
index 86f4e48..41b1383 100644
--- a/tests/vmtests/test_network_mtu.py
+++ b/tests/vmtests/test_network_mtu.py
@@ -120,7 +120,6 @@ class TestNetworkMtuAbs(TestNetworkIPV6Abs):
120120
121class CentosTestNetworkMtuAbs(TestNetworkMtuAbs):121class CentosTestNetworkMtuAbs(TestNetworkMtuAbs):
122 conf_file = "examples/tests/network_mtu.yaml"122 conf_file = "examples/tests/network_mtu.yaml"
123 extra_kern_args = "BOOTIF=eth0-52:54:00:12:34:00"
124 collect_scripts = TestNetworkMtuAbs.collect_scripts + [123 collect_scripts = TestNetworkMtuAbs.collect_scripts + [
125 textwrap.dedent("""124 textwrap.dedent("""
126 cd OUTPUT_COLLECT_D125 cd OUTPUT_COLLECT_D
diff --git a/tests/vmtests/test_network_static.py b/tests/vmtests/test_network_static.py
index 2d226c0..d96d3eb 100644
--- a/tests/vmtests/test_network_static.py
+++ b/tests/vmtests/test_network_static.py
@@ -13,7 +13,6 @@ class TestNetworkStaticAbs(TestNetworkBaseTestsAbs):
1313
1414
15class CentosTestNetworkStaticAbs(TestNetworkStaticAbs):15class CentosTestNetworkStaticAbs(TestNetworkStaticAbs):
16 extra_kern_args = "BOOTIF=eth0-52:54:00:12:34:00"
17 collect_scripts = TestNetworkBaseTestsAbs.collect_scripts + [16 collect_scripts = TestNetworkBaseTestsAbs.collect_scripts + [
18 textwrap.dedent("""17 textwrap.dedent("""
19 cd OUTPUT_COLLECT_D18 cd OUTPUT_COLLECT_D
diff --git a/tests/vmtests/test_network_vlan.py b/tests/vmtests/test_network_vlan.py
index 00eb445..3cb6eae 100644
--- a/tests/vmtests/test_network_vlan.py
+++ b/tests/vmtests/test_network_vlan.py
@@ -54,7 +54,6 @@ class TestNetworkVlanAbs(TestNetworkBaseTestsAbs):
5454
5555
56class CentosTestNetworkVlanAbs(TestNetworkVlanAbs):56class CentosTestNetworkVlanAbs(TestNetworkVlanAbs):
57 extra_kern_args = "BOOTIF=eth0-d4:be:d9:a8:49:13"
58 collect_scripts = TestNetworkVlanAbs.collect_scripts + [57 collect_scripts = TestNetworkVlanAbs.collect_scripts + [
59 textwrap.dedent("""58 textwrap.dedent("""
60 cd OUTPUT_COLLECT_D59 cd OUTPUT_COLLECT_D

Subscribers

People subscribed via source and target branches