Merge lp:~smoser/cloud-init/trunk.net-improve-lo-dns into lp:~cloud-init-dev/cloud-init/trunk
| Status: | Merged |
|---|---|
| Merged at revision: | 1256 |
| Proposed branch: | lp:~smoser/cloud-init/trunk.net-improve-lo-dns |
| Merge into: | lp:~cloud-init-dev/cloud-init/trunk |
| Diff against target: |
650 lines (+441/-66) 3 files modified
cloudinit/net/eni.py (+102/-66) tests/unittests/helpers.py (+12/-0) tests/unittests/test_net.py (+327/-0) |
| To merge this branch: | bzr merge lp:~smoser/cloud-init/trunk.net-improve-lo-dns |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| cloud-init commiters | 2016-06-21 | Pending | |
|
Review via email:
|
|||
Commit Message
improvements to eni rendering
Some improvements here, and some bug fixes.
- bring curtin revno 394's change to support post-up for interface aliases.
- sort attributes per interface for nicer order and consistent rendering
- use arrays for each 'section' rather than content += . This allows better
separation of the sections and also will perform better as long strings
with += are slow.
- improve how 'lo' is handled. If a network state that was being rendered
had an entry for 'lo', then the rendered ENI would have 2 'lo' sections.
- no longer skip 'lo' sections when loading an ENI in parse_deb_config
- fix inet value for subnets, don't add interface attributes to alias
(LP: #1588547)
Also add some tests of reading yaml and rendering ENI.
- 1261. By Scott Moser on 2016-06-21
-
fix english in comment
- 1262. By Scott Moser on 2016-06-21
-
net: fix inet value for subnets, don't add interface attributes to alias
[copied from curtin revno 390]
Apply two separate fixes for configuring bonding with ip aliases.Curtin re-used the interface's inet value for each subnet that might
be configured. In the case where the configuration included an ipv4
address after an ipv6 one resulted in emitting 'inet6' for ipv4 address
which is not correct. Resolve this issue by calculating the inet
value independent of the current status of the iface, using the subnet
config instead.When rendering a network_config which includes ip alias interfaces
do not emit any attributes, like MTU, or bond/bridge options Including
these values is almost always wrong or will result in confusing
behavior on the target system. - 1263. By Scott Moser on 2016-06-21
-
make 2 of 3 tests pass
- 1264. By Scott Moser on 2016-06-21
-
fix flake8
- 1265. By Scott Moser on 2016-06-21
-
no longer skip 'lo' elements when reading. pass 3rd test.
| Scott Moser (smoser) wrote : | # |
- 1266. By Scott Moser on 2016-07-14
-
merge with trunk
- 1267. By Scott Moser on 2016-07-14
-
merge from trunk.lp1602373
this merges in the render_hwaddress support.
newly added tests still run, so hwaddress seems correctly getting in. - 1268. By Scott Moser on 2016-07-14
-
merge from trunk
| Ryan Harper (raharper) wrote : | # |
> - use arrays for each 'section' rather than content += . This allows better
> separation of the sections and also will perform better as long strings
> with += are slow.
+1 for better separation. I don't think there is significant difference:
For an 100-line eni (that's rather high for typical usage)
% python3 t.py
Concat: 7.116918564017396
Array : 7.6817819369607605
% python2 t.py
Generating data...
Concat: 8.51635122299
Array : 7.93058490753
For a 10-line eni
% python3 t.py
Generating data...
Concat: 1.0464658139972016
Array : 1.2140009650029242
% python2 t.py
Generating data...
Concat: 0.956037998199
Array : 1.08836984634
% cat t.py
import timeit
concat = """
c=''
for x in range(0, 100):
c += 'iface eth0 inet static'
"""
append = """
c = []
for x in range(0, 100):
c.append('iface eth0 inet static')
"""
print('Generating data...')
print("Concat: %s" % timeit.
print("Array : %s" % timeit.
| Ryan Harper (raharper) wrote : | # |
Looks good. Could we add unittests for distro using apply_network, including one without a _write_network so we can test that fallback logic?
- 1269. By Scott Moser on 2016-07-14
-
merge from trunk
| Scott Moser (smoser) wrote : | # |
i added a test of the _write_network fallback in the fix for 1602373 (revno 1255 on trunk).
and pulled that in here.
going to merge this in now.


passes tox and the 3 added tests now.
The tests are somewhat brittle as they expect exactly rendered ENI content for the provided network yaml.