Merge lp:~raharper/curtin/trunk.delete-eth0-cfg-in-target into lp:~curtin-dev/curtin/trunk

Proposed by Ryan Harper
Status: Merged
Merged at revision: 389
Proposed branch: lp:~raharper/curtin/trunk.delete-eth0-cfg-in-target
Merge into: lp:~curtin-dev/curtin/trunk
Diff against target: 576 lines (+129/-56)
19 files modified
curtin/commands/curthooks.py (+38/-0)
curtin/util.py (+10/-0)
examples/network-iscsiroot.yaml (+3/-3)
examples/tests/basic_network.yaml (+3/-3)
examples/tests/basic_network_static.yaml (+1/-1)
examples/tests/bonding_network.yaml (+5/-5)
examples/tests/network_source.yaml (+4/-4)
examples/tests/vlan_network.yaml (+20/-20)
tests/unittests/test_net.py (+14/-14)
tests/vmtests/__init__.py (+12/-0)
tests/vmtests/test_basic.py (+2/-0)
tests/vmtests/test_bcache_basic.py (+1/-0)
tests/vmtests/test_bonding.py (+1/-0)
tests/vmtests/test_lvm.py (+1/-0)
tests/vmtests/test_mdadm_bcache.py (+2/-0)
tests/vmtests/test_network.py (+8/-6)
tests/vmtests/test_nvme.py (+1/-0)
tests/vmtests/test_raid5_bcache.py (+2/-0)
tests/vmtests/test_uefi_basic.py (+1/-0)
To merge this branch: bzr merge lp:~raharper/curtin/trunk.delete-eth0-cfg-in-target
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Scott Moser Pending
Review via email: mp+295084@code.launchpad.net

Commit message

Detect and remove legacy /etc/network/interfaces.d/eth0.cfg from target

Prior to Xenial release, Ubuntu Cloud images included a default network
configuration in /etc/network/interfaces.d/eth0.conf. The presence of
this legacy configuration file can cause a delay during boot when cloud-
init is expecting a non-existent interface to become available. curtin
installations handle configuring networking in the target installed
system subsequently the embedded configuration is not needed.

This patch reuses most of cloud-init's version of detecting and examining the legacy config, confirming if the contents are what is expected. Upon finding expected content, the file will be removed, otherwise it will remain.

Additional changes to vmtest and unittest were added to remove the reliance on fallback nic naming (eth0); we always use non-kernel names in our configuration now. An additional common test has been added to check that in all cases we ensure we remove the embedded config.

Description of the change

Detect and remove legacy /etc/network/interfaces.d/eth0.cfg from target

Prior to Xenial release, Ubuntu Cloud images included a default network
configuration in /etc/network/interfaces.d/eth0.conf. The presence of
this legacy configuration file can cause a delay during boot when cloud-
init is expecting a non-existent interface to become available. curtin
installations handle configuring networking in the target installed
system subsequently the embedded configuration is not needed.

This patch reuses most of cloud-init's version of detecting and examining the legacy config, confirming if the contents are what is expected. Upon finding expected content, the file will be removed, otherwise it will remain.

Additional changes to vmtest and unittest were added to remove the reliance on fallback nic naming (eth0); we always use non-kernel names in our configuration now. An additional common test has been added to check that in all cases we ensure we remove the embedded config.

To post a comment you must log in.
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 :

one nit pick inline other than that, looks great.
i'd keep the '_maybe_remove', but for curtin's case it is much more a 'probably_remove'.

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

oh yeah, and move your description to the commit m essage and fix the new lines that seemed inserted somehow.

Revision history for this message
Ryan Harper (raharper) wrote :

On Thu, May 19, 2016 at 11:41 AM, Scott Moser <email address hidden> wrote:

> one nit pick inline other than that, looks great.
> i'd keep the '_maybe_remove', but for curtin's case it is much more a
> 'probably_remove'.
>

Indeed; other than when users have touched it (which in curtin's case will
almost never happen).

>
>
> Diff comments:
>
> >
> > === modified file 'curtin/util.py'
> > --- curtin/util.py 2016-04-04 19:09:47 +0000
> > +++ curtin/util.py 2016-05-18 14:11:09 +0000
> > @@ -288,6 +288,15 @@
> > return fp.read()
> >
> >
> > +def del_file(path):
> > + LOG.debug("Attempting to remove %s", path)
> > + try:
>
> attempting to remove seems not that useful. rather 'removed' or 'did not
> remove' would be better.
> LOG.debug("del_file: removed %s", path)
> except..
> LOG.debug("del_file: %s did not exist.").
>

This is lift 100% from cloud-init. So, I'll fix here and then MP to
cloud-init =)

>
> just thinking as we look at a log, 'attempting to remove' doesn't tell you
> all that much.
>

Yeah, but I was lazy.

>
> > + os.unlink(path)
> > + except OSError as e:
> > + if e.errno != errno.ENOENT:
> > + raise e
> > +
> > +
> > def disable_daemons_in_root(target):
> > contents = "\n".join(
> > ['#!/bin/sh',
>
>
> --
>
> https://code.launchpad.net/~raharper/curtin/trunk.delete-eth0-cfg-in-target/+merge/295084
> You are the owner of lp:~raharper/curtin/trunk.delete-eth0-cfg-in-target.
>

391. By Ryan Harper

curtin/util.del_file: make log messages more useful.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
392. By Ryan Harper

util.del_file: don't log success until the file is removed.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'curtin/commands/curthooks.py'
--- curtin/commands/curthooks.py 2016-04-17 22:35:20 +0000
+++ curtin/commands/curthooks.py 2016-05-19 18:43:17 +0000
@@ -149,6 +149,42 @@
149 os.unlink(dpkg_cfg)149 os.unlink(dpkg_cfg)
150150
151151
152def _maybe_remove_legacy_eth0(target,
153 path="/etc/network/interfaces.d/eth0.cfg"):
154 """Ubuntu cloud images previously included a 'eth0.cfg' that had
155 hard coded content. That file would interfere with the rendered
156 configuration if it was present.
157
158 if the file does not exist do nothing.
159 If the file exists:
160 - with known content, remove it and warn
161 - with unknown content, leave it and warn
162 """
163
164 cfg = os.path.sep.join([target, path])
165 if not os.path.exists(cfg):
166 LOG.warn('Failed to find legacy conf file %s', cfg)
167 return
168
169 bmsg = "Dynamic networking config may not apply."
170 try:
171 contents = util.load_file(cfg)
172 known_contents = ["auto eth0", "iface eth0 inet dhcp"]
173 lines = [f.strip() for f in contents.splitlines()
174 if not f.startswith("#")]
175 if lines == known_contents:
176 util.del_file(cfg)
177 msg = "removed %s with known contents" % cfg
178 else:
179 msg = (bmsg + " '%s' exists with user configured content." % cfg)
180 except:
181 msg = bmsg + " %s exists, but could not be read." % cfg
182 LOG.exception(msg)
183 return
184
185 LOG.warn(msg)
186
187
152def setup_zipl(cfg, target):188def setup_zipl(cfg, target):
153 if platform.machine() != 's390x':189 if platform.machine() != 's390x':
154 return190 return
@@ -522,6 +558,8 @@
522 LOG.debug("copying interfaces")558 LOG.debug("copying interfaces")
523 copy_interfaces(interfaces, target)559 copy_interfaces(interfaces, target)
524560
561 _maybe_remove_legacy_eth0(target)
562
525563
526def copy_interfaces(interfaces, target):564def copy_interfaces(interfaces, target):
527 if not interfaces:565 if not interfaces:
528566
=== modified file 'curtin/util.py'
--- curtin/util.py 2016-04-04 19:09:47 +0000
+++ curtin/util.py 2016-05-19 18:43:17 +0000
@@ -288,6 +288,16 @@
288 return fp.read()288 return fp.read()
289289
290290
291def del_file(path):
292 try:
293 os.unlink(path)
294 LOG.debug("del_file: removed %s", path)
295 except OSError as e:
296 LOG.exception("del_file: %s did not exist.", path)
297 if e.errno != errno.ENOENT:
298 raise e
299
300
291def disable_daemons_in_root(target):301def disable_daemons_in_root(target):
292 contents = "\n".join(302 contents = "\n".join(
293 ['#!/bin/sh',303 ['#!/bin/sh',
294304
=== modified file 'examples/network-iscsiroot.yaml'
--- examples/network-iscsiroot.yaml 2016-04-15 20:33:51 +0000
+++ examples/network-iscsiroot.yaml 2016-05-19 18:43:17 +0000
@@ -5,14 +5,14 @@
5 # to prevent networking restarts from up/down'ing the5 # to prevent networking restarts from up/down'ing the
6 # interface6 # interface
7 - type: physical7 - type: physical
8 name: eth08 name: interface0
9 mac_address: "c0:d6:9f:2c:e8:80"9 mac_address: "c0:d6:9f:2c:e8:80"
10 subnets:10 subnets:
11 - type: dhcp411 - type: dhcp4
12 control: manual12 control: manual
13 # control: auto this is the default if control isn't present13 # control: auto this is the default if control isn't present
14 - type: physical14 - type: physical
15 name: eth115 name: interface1
16 mtu: 149216 mtu: 1492
17 mac_address: "aa:d6:9f:2c:e8:80"17 mac_address: "aa:d6:9f:2c:e8:80"
18 subnets:18 subnets:
@@ -25,7 +25,7 @@
25 # and we want to auto configure this 25 # and we want to auto configure this
26 # when present26 # when present
27 - type: physical27 - type: physical
28 name: eth228 name: interface2
29 mac_address: "cf:d6:af:48:e8:80"29 mac_address: "cf:d6:af:48:e8:80"
30 subnets:30 subnets:
31 - type: static31 - type: static
3232
=== modified file 'examples/tests/basic_network.yaml'
--- examples/tests/basic_network.yaml 2016-04-04 16:03:32 +0000
+++ examples/tests/basic_network.yaml 2016-05-19 18:43:17 +0000
@@ -4,12 +4,12 @@
4 config:4 config:
5 # Physical interfaces.5 # Physical interfaces.
6 - type: physical6 - type: physical
7 name: eth07 name: interface0
8 mac_address: "52:54:00:12:34:00"8 mac_address: "52:54:00:12:34:00"
9 subnets:9 subnets:
10 - type: dhcp410 - type: dhcp4
11 - type: physical11 - type: physical
12 name: eth112 name: interface1
13 mtu: 149213 mtu: 1492
14 mac_address: "52:54:00:12:34:02"14 mac_address: "52:54:00:12:34:02"
15 subnets:15 subnets:
@@ -22,5 +22,5 @@
22 dns_search:22 dns_search:
23 - barley.maas23 - barley.maas
24 - type: physical24 - type: physical
25 name: eth225 name: interface2
26 mac_address: "52:54:00:12:34:04"26 mac_address: "52:54:00:12:34:04"
2727
=== modified file 'examples/tests/basic_network_static.yaml'
--- examples/tests/basic_network_static.yaml 2016-04-04 16:03:32 +0000
+++ examples/tests/basic_network_static.yaml 2016-05-19 18:43:17 +0000
@@ -4,7 +4,7 @@
4 config:4 config:
5 # Physical interfaces.5 # Physical interfaces.
6 - type: physical6 - type: physical
7 name: eth07 name: interface0
8 mac_address: "52:54:00:12:34:00"8 mac_address: "52:54:00:12:34:00"
9 subnets:9 subnets:
10 - type: static10 - type: static
1111
=== modified file 'examples/tests/bonding_network.yaml'
--- examples/tests/bonding_network.yaml 2016-04-17 22:35:20 +0000
+++ examples/tests/bonding_network.yaml 2016-05-19 18:43:17 +0000
@@ -4,23 +4,23 @@
4 config:4 config:
5 # Physical interfaces.5 # Physical interfaces.
6 - type: physical6 - type: physical
7 name: eth07 name: interface0
8 mac_address: "52:54:00:12:34:00"8 mac_address: "52:54:00:12:34:00"
9 subnets:9 subnets:
10 - type: dhcp410 - type: dhcp4
11 - type: physical11 - type: physical
12 name: eth112 name: interface1
13 mac_address: "52:54:00:12:34:02"13 mac_address: "52:54:00:12:34:02"
14 - type: physical14 - type: physical
15 name: eth215 name: interface2
16 mac_address: "52:54:00:12:34:04"16 mac_address: "52:54:00:12:34:04"
17 # Bond.17 # Bond.
18 - type: bond18 - type: bond
19 name: bond019 name: bond0
20 mac_address: "52:54:00:12:34:06"20 mac_address: "52:54:00:12:34:06"
21 bond_interfaces:21 bond_interfaces:
22 - eth122 - interface1
23 - eth223 - interface2
24 params:24 params:
25 bond-mode: active-backup25 bond-mode: active-backup
26 subnets:26 subnets:
2727
=== modified file 'examples/tests/network_source.yaml'
--- examples/tests/network_source.yaml 2016-04-07 15:06:04 +0000
+++ examples/tests/network_source.yaml 2016-05-19 18:43:17 +0000
@@ -3,12 +3,12 @@
3 config:3 config:
4 # Physical interfaces.4 # Physical interfaces.
5 - type: physical5 - type: physical
6 name: eth06 name: interface0
7 mac_address: "52:54:00:12:34:00"7 mac_address: "52:54:00:12:34:00"
8 subnets:8 subnets:
9 - type: dhcp49 - type: dhcp4
10 - type: physical10 - type: physical
11 name: eth111 name: interface1
12 mtu: 149212 mtu: 1492
13 mac_address: "52:54:00:12:34:02"13 mac_address: "52:54:00:12:34:02"
14 subnets:14 subnets:
@@ -21,11 +21,11 @@
21 dns_search:21 dns_search:
22 - barley.maas22 - barley.maas
23 - type: physical23 - type: physical
24 name: eth224 name: interface2
25 mac_address: "52:54:00:12:34:04"25 mac_address: "52:54:00:12:34:04"
2626
27curthooks_commands:27curthooks_commands:
28 # use curtin to inject a eni config file outside of the network yaml28 # use curtin to inject a eni config file outside of the network yaml
29 # this allows us to test user installed configurations outside of29 # this allows us to test user installed configurations outside of
30 # curtin's control30 # curtin's control
31 aa_cleanup: ['curtin', 'in-target', '--', 'sh', '-c', "rm -f /etc/network/interfaces.d/eth0.cfg; /bin/echo -e 'auto eth2\niface eth2 inet static\n address 192.168.23.23/24\n' > /etc/network/interfaces.d/eth2.cfg"]31 aa_cleanup: ['curtin', 'in-target', '--', 'sh', '-c', "rm -f /etc/network/interfaces.d/eth0.cfg; /bin/echo -e 'auto interface2\niface interface2 inet static\n address 192.168.23.23/24\n' > /etc/network/interfaces.d/interface2.cfg"]
3232
=== modified file 'examples/tests/vlan_network.yaml'
--- examples/tests/vlan_network.yaml 2016-04-14 19:14:11 +0000
+++ examples/tests/vlan_network.yaml 2016-05-19 18:43:17 +0000
@@ -1,9 +1,9 @@
1network:1network:
2 config:2 config:
3 - id: eth03 - id: interface0
4 mac_address: d4:be:d9:a8:49:134 mac_address: d4:be:d9:a8:49:13
5 mtu: 15005 mtu: 1500
6 name: eth06 name: interface0
7 subnets:7 subnets:
8 - address: 10.245.168.16/218 - address: 10.245.168.16/21
9 dns_nameservers:9 dns_nameservers:
@@ -11,69 +11,69 @@
11 gateway: 10.245.168.111 gateway: 10.245.168.1
12 type: static12 type: static
13 type: physical13 type: physical
14 - id: eth114 - id: interface1
15 mac_address: d4:be:d9:a8:49:1515 mac_address: d4:be:d9:a8:49:15
16 mtu: 150016 mtu: 1500
17 name: eth117 name: interface1
18 subnets:18 subnets:
19 - address: 10.245.188.2/2419 - address: 10.245.188.2/24
20 dns_nameservers: []20 dns_nameservers: []
21 type: static21 type: static
22 type: physical22 type: physical
23 - id: eth223 - id: interface2
24 mac_address: d4:be:d9:a8:49:1724 mac_address: d4:be:d9:a8:49:17
25 mtu: 150025 mtu: 1500
26 name: eth226 name: interface2
27 subnets:27 subnets:
28 - type: manual28 - type: manual
29 type: physical29 type: physical
30 - id: eth330 - id: interface3
31 mac_address: d4:be:d9:a8:49:1931 mac_address: d4:be:d9:a8:49:19
32 mtu: 150032 mtu: 1500
33 name: eth333 name: interface3
34 subnets:34 subnets:
35 - type: manual35 - type: manual
36 type: physical36 type: physical
37 - id: eth1.266737 - id: interface1.2667
38 mtu: 150038 mtu: 1500
39 name: eth1.266739 name: interface1.2667
40 subnets:40 subnets:
41 - address: 10.245.184.2/2441 - address: 10.245.184.2/24
42 dns_nameservers: []42 dns_nameservers: []
43 type: static43 type: static
44 type: vlan44 type: vlan
45 vlan_id: 266745 vlan_id: 2667
46 vlan_link: eth146 vlan_link: interface1
47 - id: eth1.266847 - id: interface1.2668
48 mtu: 150048 mtu: 1500
49 name: eth1.266849 name: interface1.2668
50 subnets:50 subnets:
51 - address: 10.245.185.1/2451 - address: 10.245.185.1/24
52 dns_nameservers: []52 dns_nameservers: []
53 type: static53 type: static
54 type: vlan54 type: vlan
55 vlan_id: 266855 vlan_id: 2668
56 vlan_link: eth156 vlan_link: interface1
57 - id: eth1.266957 - id: interface1.2669
58 mtu: 150058 mtu: 1500
59 name: eth1.266959 name: interface1.2669
60 subnets:60 subnets:
61 - address: 10.245.186.1/2461 - address: 10.245.186.1/24
62 dns_nameservers: []62 dns_nameservers: []
63 type: static63 type: static
64 type: vlan64 type: vlan
65 vlan_id: 266965 vlan_id: 2669
66 vlan_link: eth166 vlan_link: interface1
67 - id: eth1.267067 - id: interface1.2670
68 mtu: 150068 mtu: 1500
69 name: eth1.267069 name: interface1.2670
70 subnets:70 subnets:
71 - address: 10.245.187.2/2471 - address: 10.245.187.2/24
72 dns_nameservers: []72 dns_nameservers: []
73 type: static73 type: static
74 type: vlan74 type: vlan
75 vlan_id: 267075 vlan_id: 2670
76 vlan_link: eth176 vlan_link: interface1
77 - address: 10.245.168.277 - address: 10.245.168.2
78 search:78 search:
79 - dellstack79 - dellstack
8080
=== modified file 'tests/unittests/test_net.py'
--- tests/unittests/test_net.py 2016-04-20 20:03:00 +0000
+++ tests/unittests/test_net.py 2016-05-19 18:43:17 +0000
@@ -497,16 +497,16 @@
497 auto lo497 auto lo
498 iface lo inet loopback498 iface lo inet loopback
499499
500 auto eth0500 auto interface0
501 iface eth0 inet dhcp501 iface interface0 inet dhcp
502502
503 auto eth1503 auto interface1
504 iface eth1 inet manual504 iface interface1 inet manual
505 bond-mode active-backup505 bond-mode active-backup
506 bond-master bond0506 bond-master bond0
507507
508 auto eth2508 auto interface2
509 iface eth2 inet manual509 iface interface2 inet manual
510 bond-mode active-backup510 bond-mode active-backup
511 bond-master bond0511 bond-master bond0
512512
@@ -537,22 +537,22 @@
537 auto lo537 auto lo
538 iface lo inet loopback538 iface lo inet loopback
539539
540 # control-manual eth0540 # control-manual interface0
541 iface eth0 inet dhcp541 iface interface0 inet dhcp
542542
543 auto eth1543 auto interface1
544 iface eth1 inet static544 iface interface1 inet static
545 address 192.168.14.2/24545 address 192.168.14.2/24
546 gateway 192.168.14.1546 gateway 192.168.14.1
547 mtu 1492547 mtu 1492
548548
549 auto eth1:1549 auto interface1:1
550 iface eth1:1 inet static550 iface interface1:1 inet static
551 address 192.168.14.4/24551 address 192.168.14.4/24
552 mtu 1492552 mtu 1492
553553
554 allow-hotplug eth2554 allow-hotplug interface2
555 iface eth2 inet static555 iface interface2 inet static
556 gateway 10.11.12.1556 gateway 10.11.12.1
557 address 10.11.12.13/22557 address 10.11.12.13/22
558558
559559
=== modified file 'tests/vmtests/__init__.py'
--- tests/vmtests/__init__.py 2016-04-20 20:06:01 +0000
+++ tests/vmtests/__init__.py 2016-05-19 18:43:17 +0000
@@ -745,6 +745,15 @@
745 self.assertIn(link, contents)745 self.assertIn(link, contents)
746 self.assertIn(diskname, contents)746 self.assertIn(diskname, contents)
747747
748 def test_interfacesd_eth0_removed(self):
749 """ Check that curtin has removed /etc/network/interfaces.d/eth0.cfg
750 by examining the output of a find /etc/network > find_interfaces.d
751 """
752 fpath = os.path.join(self.td.collect, "find_interfacesd")
753 interfacesd = util.load_file(fpath)
754 self.assertNotIn("/etc/network/interfaces.d/eth0.cfg",
755 interfacesd.split("\n"))
756
748 def run(self, result):757 def run(self, result):
749 super(VMBaseClass, self).run(result)758 super(VMBaseClass, self).run(result)
750 self.record_result(result)759 self.record_result(result)
@@ -844,6 +853,9 @@
844 def test_dname(self):853 def test_dname(self):
845 pass854 pass
846855
856 def test_interfacesd_eth0_removed(self):
857 pass
858
847 def _maybe_raise(self, exc):859 def _maybe_raise(self, exc):
848 if self.allow_test_fails:860 if self.allow_test_fails:
849 raise exc861 raise exc
850862
=== modified file 'tests/vmtests/test_basic.py'
--- tests/vmtests/test_basic.py 2016-04-04 18:20:33 +0000
+++ tests/vmtests/test_basic.py 2016-05-19 18:43:17 +0000
@@ -25,6 +25,7 @@
25 cat /etc/fstab > fstab25 cat /etc/fstab > fstab
26 mkdir -p /dev/disk/by-dname26 mkdir -p /dev/disk/by-dname
27 ls /dev/disk/by-dname/ > ls_dname27 ls /dev/disk/by-dname/ > ls_dname
28 find /etc/network/interfaces.d > find_interfacesd
2829
29 v=""30 v=""
30 out=$(apt-config shell v Acquire::HTTP::Proxy)31 out=$(apt-config shell v Acquire::HTTP::Proxy)
@@ -145,6 +146,7 @@
145 cat /etc/fstab > fstab146 cat /etc/fstab > fstab
146 mkdir -p /dev/disk/by-dname147 mkdir -p /dev/disk/by-dname
147 ls /dev/disk/by-dname/ > ls_dname148 ls /dev/disk/by-dname/ > ls_dname
149 find /etc/network/interfaces.d > find_interfacesd
148150
149 v=""151 v=""
150 out=$(apt-config shell v Acquire::HTTP::Proxy)152 out=$(apt-config shell v Acquire::HTTP::Proxy)
151153
=== modified file 'tests/vmtests/test_bcache_basic.py'
--- tests/vmtests/test_bcache_basic.py 2016-04-04 15:48:10 +0000
+++ tests/vmtests/test_bcache_basic.py 2016-05-19 18:43:17 +0000
@@ -18,6 +18,7 @@
18 cat /sys/block/bcache0/bcache/cache_mode > bcache_cache_mode18 cat /sys/block/bcache0/bcache/cache_mode > bcache_cache_mode
19 cat /proc/mounts > proc_mounts19 cat /proc/mounts > proc_mounts
20 cat /proc/partitions > proc_partitions20 cat /proc/partitions > proc_partitions
21 find /etc/network/interfaces.d > find_interfacesd
21 """)]22 """)]
2223
23 def test_bcache_output_files_exist(self):24 def test_bcache_output_files_exist(self):
2425
=== modified file 'tests/vmtests/test_bonding.py'
--- tests/vmtests/test_bonding.py 2016-04-04 18:53:03 +0000
+++ tests/vmtests/test_bonding.py 2016-05-19 18:43:17 +0000
@@ -59,6 +59,7 @@
59 ip -o route show > ip_route_show59 ip -o route show > ip_route_show
60 route -n > route_n60 route -n > route_n
61 dpkg-query -W -f '${Status}' ifenslave > ifenslave_installed61 dpkg-query -W -f '${Status}' ifenslave > ifenslave_installed
62 find /etc/network/interfaces.d > find_interfacesd
62 """)]63 """)]
6364
64 def test_output_files_exist(self):65 def test_output_files_exist(self):
6566
=== modified file 'tests/vmtests/test_lvm.py'
--- tests/vmtests/test_lvm.py 2016-03-03 11:46:13 +0000
+++ tests/vmtests/test_lvm.py 2016-05-19 18:43:17 +0000
@@ -12,6 +12,7 @@
12 cd OUTPUT_COLLECT_D12 cd OUTPUT_COLLECT_D
13 cat /etc/fstab > fstab13 cat /etc/fstab > fstab
14 ls /dev/disk/by-dname > ls_dname14 ls /dev/disk/by-dname > ls_dname
15 find /etc/network/interfaces.d > find_interfacesd
15 pvdisplay -C --separator = -o vg_name,pv_name --noheadings > pvs16 pvdisplay -C --separator = -o vg_name,pv_name --noheadings > pvs
16 lvdisplay -C --separator = -o lv_name,vg_name --noheadings > lvs17 lvdisplay -C --separator = -o lv_name,vg_name --noheadings > lvs
17 """)]18 """)]
1819
=== modified file 'tests/vmtests/test_mdadm_bcache.py'
--- tests/vmtests/test_mdadm_bcache.py 2016-04-17 22:35:20 +0000
+++ tests/vmtests/test_mdadm_bcache.py 2016-05-19 18:43:17 +0000
@@ -16,6 +16,7 @@
16 mdadm --detail --scan | grep -c ubuntu > mdadm_active116 mdadm --detail --scan | grep -c ubuntu > mdadm_active1
17 grep -c active /proc/mdstat > mdadm_active217 grep -c active /proc/mdstat > mdadm_active2
18 ls /dev/disk/by-dname > ls_dname18 ls /dev/disk/by-dname > ls_dname
19 find /etc/network/interfaces.d > find_interfacesd
19 """)]20 """)]
2021
21 def test_mdadm_output_files_exist(self):22 def test_mdadm_output_files_exist(self):
@@ -55,6 +56,7 @@
55 cat /sys/block/bcache1/bcache/cache_mode >> bcache_cache_mode56 cat /sys/block/bcache1/bcache/cache_mode >> bcache_cache_mode
56 cat /sys/block/bcache2/bcache/cache_mode >> bcache_cache_mode57 cat /sys/block/bcache2/bcache/cache_mode >> bcache_cache_mode
57 cat /proc/mounts > proc_mounts58 cat /proc/mounts > proc_mounts
59 find /etc/network/interfaces.d > find_interfacesd
58 """)]60 """)]
59 fstab_expected = {61 fstab_expected = {
60 '/dev/vda1': '/media/sda1',62 '/dev/vda1': '/media/sda1',
6163
=== modified file 'tests/vmtests/test_network.py'
--- tests/vmtests/test_network.py 2016-04-14 19:14:11 +0000
+++ tests/vmtests/test_network.py 2016-05-19 18:43:17 +0000
@@ -57,6 +57,7 @@
57 ifconfig -a > ifconfig_a57 ifconfig -a > ifconfig_a
58 cp -av /etc/network/interfaces .58 cp -av /etc/network/interfaces .
59 cp -av /etc/network/interfaces.d .59 cp -av /etc/network/interfaces.d .
60 find /etc/network/interfaces.d > find_interfacesd
60 cp /etc/resolv.conf .61 cp /etc/resolv.conf .
61 cp -av /etc/udev/rules.d/70-persistent-net.rules .62 cp -av /etc/udev/rules.d/70-persistent-net.rules .
62 ip -o route show > ip_route_show63 ip -o route show > ip_route_show
@@ -245,10 +246,10 @@
245 collect_scripts = TestNetworkAbs.collect_scripts + [textwrap.dedent("""246 collect_scripts = TestNetworkAbs.collect_scripts + [textwrap.dedent("""
246 cd OUTPUT_COLLECT_D247 cd OUTPUT_COLLECT_D
247 dpkg-query -W -f '${Status}' vlan > vlan_installed248 dpkg-query -W -f '${Status}' vlan > vlan_installed
248 ip -d link show eth1.2667 > ip_link_show_eth1.2667249 ip -d link show interface1.2667 > ip_link_show_interface1.2667
249 ip -d link show eth1.2668 > ip_link_show_eth1.2668250 ip -d link show interface1.2668 > ip_link_show_interface1.2668
250 ip -d link show eth1.2669 > ip_link_show_eth1.2669251 ip -d link show interface1.2669 > ip_link_show_interface1.2669
251 ip -d link show eth1.2670 > ip_link_show_eth1.2670252 ip -d link show interface1.2670 > ip_link_show_interface1.2670
252 """)]253 """)]
253254
254 def get_vlans(self):255 def get_vlans(self):
@@ -309,6 +310,7 @@
309 ifconfig -a > ifconfig_a310 ifconfig -a > ifconfig_a
310 cp -av /etc/network/interfaces .311 cp -av /etc/network/interfaces .
311 cp -a /etc/network/interfaces.d .312 cp -a /etc/network/interfaces.d .
313 find /etc/network/interfaces.d > find_interfacesd
312 cp /etc/resolv.conf .314 cp /etc/resolv.conf .
313 cp -av /etc/udev/rules.d/70-persistent-net.rules .315 cp -av /etc/udev/rules.d/70-persistent-net.rules .
314 ip -o route show > ip_route_show316 ip -o route show > ip_route_show
@@ -317,7 +319,7 @@
317319
318 def test_source_cfg_exists(self):320 def test_source_cfg_exists(self):
319 """Test that our curthooks wrote our injected config."""321 """Test that our curthooks wrote our injected config."""
320 self.output_files_exist(["interfaces.d/eth2.cfg"])322 self.output_files_exist(["interfaces.d/interface2.cfg"])
321323
322 def test_etc_network_interfaces_source_cfg(self):324 def test_etc_network_interfaces_source_cfg(self):
323 """ Compare injected configuration as parsed by curtin matches325 """ Compare injected configuration as parsed by curtin matches
@@ -344,7 +346,7 @@
344 print('parsed ifconfig dict:\n{}'.format(346 print('parsed ifconfig dict:\n{}'.format(
345 yaml.dump(ifconfig_dict, default_flow_style=False, indent=4)))347 yaml.dump(ifconfig_dict, default_flow_style=False, indent=4)))
346348
347 iface = 'eth2'349 iface = 'interface2'
348 self.assertTrue(iface in curtin_ifaces)350 self.assertTrue(iface in curtin_ifaces)
349351
350 expected_address = curtin_ifaces[iface].get('address', None)352 expected_address = curtin_ifaces[iface].get('address', None)
351353
=== modified file 'tests/vmtests/test_nvme.py'
--- tests/vmtests/test_nvme.py 2016-04-04 18:20:33 +0000
+++ tests/vmtests/test_nvme.py 2016-05-19 18:43:17 +0000
@@ -33,6 +33,7 @@
33 cat /etc/fstab > fstab33 cat /etc/fstab > fstab
34 mkdir -p /dev/disk/by-dname34 mkdir -p /dev/disk/by-dname
35 ls /dev/disk/by-dname/ > ls_dname35 ls /dev/disk/by-dname/ > ls_dname
36 find /etc/network/interfaces.d > find_interfacesd
3637
37 v=""38 v=""
38 out=$(apt-config shell v Acquire::HTTP::Proxy)39 out=$(apt-config shell v Acquire::HTTP::Proxy)
3940
=== modified file 'tests/vmtests/test_raid5_bcache.py'
--- tests/vmtests/test_raid5_bcache.py 2016-04-17 22:35:20 +0000
+++ tests/vmtests/test_raid5_bcache.py 2016-05-19 18:43:17 +0000
@@ -16,6 +16,7 @@
16 mdadm --detail --scan | grep -c ubuntu > mdadm_active116 mdadm --detail --scan | grep -c ubuntu > mdadm_active1
17 grep -c active /proc/mdstat > mdadm_active217 grep -c active /proc/mdstat > mdadm_active2
18 ls /dev/disk/by-dname > ls_dname18 ls /dev/disk/by-dname > ls_dname
19 find /etc/network/interfaces.d > find_interfacesd
19 """)]20 """)]
2021
21 def test_mdadm_output_files_exist(self):22 def test_mdadm_output_files_exist(self):
@@ -41,6 +42,7 @@
41 cat /sys/block/bcache0/bcache/cache_mode > bcache_cache_mode42 cat /sys/block/bcache0/bcache/cache_mode > bcache_cache_mode
42 cat /proc/mounts > proc_mounts43 cat /proc/mounts > proc_mounts
43 cat /proc/partitions > proc_partitions44 cat /proc/partitions > proc_partitions
45 find /etc/network/interfaces.d > find_interfacesd
44 """)]46 """)]
45 fstab_expected = {47 fstab_expected = {
46 '/dev/bcache0': '/',48 '/dev/bcache0': '/',
4749
=== modified file 'tests/vmtests/test_uefi_basic.py'
--- tests/vmtests/test_uefi_basic.py 2016-04-08 03:43:26 +0000
+++ tests/vmtests/test_uefi_basic.py 2016-05-19 18:43:17 +0000
@@ -23,6 +23,7 @@
23 cat /etc/fstab > fstab23 cat /etc/fstab > fstab
24 mkdir -p /dev/disk/by-dname24 mkdir -p /dev/disk/by-dname
25 ls /dev/disk/by-dname/ > ls_dname25 ls /dev/disk/by-dname/ > ls_dname
26 find /etc/network/interfaces.d > find_interfacesd
26 ls /sys/firmware/efi/ > ls_sys_firmware_efi27 ls /sys/firmware/efi/ > ls_sys_firmware_efi
27 cat /sys/class/block/vda/queue/logical_block_size > vda_lbs28 cat /sys/class/block/vda/queue/logical_block_size > vda_lbs
28 cat /sys/class/block/vda/queue/physical_block_size > vda_pbs29 cat /sys/class/block/vda/queue/physical_block_size > vda_pbs

Subscribers

People subscribed via source and target branches