summaryrefslogtreecommitdiff
path: root/cloudinit/net
AgeCommit message (Collapse)Author
2016-12-22LICENSE: Allow dual licensing GPL-3 or Apache 2.0Jon Grimm
This has been a recurring ask and we had initially just made the change to the cloud-init 2.0 codebase. As the current thinking is we'll just continue to enhance the current codebase, its desirable to relicense to match what we'd intended as part of the 2.0 plan here. - put a brief description of license in LICENSE file - put full license versions in LICENSE-GPLv3 and LICENSE-Apache2.0 - simplify the per-file header to reference LICENSE - tox: ignore H102 (Apache License Header check) Add license header to files that ship. Reformat headers, make sure everything has vi: at end of file. Non-shipping files do not need the copyright header, but at the moment tests/ have it.
2016-12-02Replace usage of sys_netdev_info with read_sys_netJoshua Harlow
I've seen cases of unable to read from files as well as the existing os errors so catch io error and skip by using the smarter read_sys_net instead. LP: #1625766
2016-11-22net/cmdline: Consider ip= or ip6= on command line not only ip=Scott Moser
The previous behavior would miss ip6= on the command line and would not pay attention to the written net-* or net6-* files if only ip6= was found. The fix here enables parsing the files if either ip= or ip6= is found, and adds some tests as well. LP: #1639930
2016-11-03net/cmdline: Further adjustments to ipv6 supportLaMont Jones
The implementation to add ipv6 support to Ubuntu initramfs changed (see bug 1621507). The changes here adjust to handle the new path. Now, the ipv6 route includes using the variable 'DEVICE6' in net6-DEVICE.conf files. LP: #1621615
2016-09-21net: support reading ipv6 dhcp config from initramfsLaMont Jones
This adds support for understanding 'dhcp6' as a protocol that can be written into /run/net-IFACE.cfg files by the initramfs. The end result is supporting ipv6 dhcp from initramfs boot all the way into iscsi root. LP: #1621615, #1621507
2016-08-23Generate a dummy bond name for OpenStackScott Moser
The OpenStack network_data.json does not provide a name for bond links. This change makes it so a dummy one is generated and used instead to satisfy cloud-init which does require one. In order to write the correct link (underlying 'link' names) for the bonds, we maintain a list of info by ids so we can easily get the right device name. Also: * add a vlan test case that similarly references an id rather than name. * make bond interfaces auto LP: #1605749
2016-08-22network: fix get_interface_mac for bond slave, read_sys_net for ENOTDIRScott Moser
When using get_interface_mac, on a system with bond slaves, it would return the bond_master's address. That isn't expected, and causes problems in a caller like get_interfaces_by_mac which would then seem to find duplicate macs on the system. Additionally, in read_sys_net catch a errno.ENOTDIR error as ENOENT. Opening a path as a file that has <existing_file>/anything will will raise ENOTDIR rather than ENOENT. This handles that case in read_sys_net as a if the file did not exist.
2016-07-13merge from trunkScott Moser
2016-07-13merge from trunkScott Moser
2016-07-13merge from trunk.lp1602373Scott Moser
this merges in the render_hwaddress support. newly added tests still run, so hwaddress seems correctly getting in.
2016-07-13ConfigDrive: write 'injected' files and legacy networkingScott Moser
Previous commit disabled the consumption of 'injected' files in configdrive (openstack server boot --file=/target/file=local-file) unless the datasource was in 'pass' mode. The default mode is 'net' so that would never happen. Also here are: a.) a fix for 'links_path_prefix' string from debian, to finally disable the rendering of systemd.link files (LP: #1594546) b.) some comments to apply_network_config c.) implement a backwards compatibility for for distros that do not yet implement apply_network_config by converting the network config into ENI format and calling apply_network. This is required because prior to the previous commit, those distros would have had 'apply_network' called with the openstack provided ENI file. But after this change they will have apply_network_config called by cloudinit's main. d.) a network_state_to_eni helper for converting net config to eni it supports the not-actually-correct 'hwaddress' field in ENI. LP: #1602373
2016-07-13String format requires positions on python 2.6Joshua Harlow
2016-07-12Dict comprehensions don't work in 2.6Joshua Harlow
2016-06-21no longer skip 'lo' elements when reading. pass 3rd test.Scott Moser
2016-06-21fix flake8Scott Moser
2016-06-21make 2 of 3 tests passScott Moser
2016-06-21net: fix inet value for subnets, don't add interface attributes to aliasScott Moser
[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. LP: #1588547
2016-06-21fix english in commentScott Moser
2016-06-21merge with trunkScott Moser
2016-06-21fix lost per-interface routes, use post-up to bring up interface aliasesScott Moser
Fix the lack of per-interface routes, and add an example to yaml. in revno 394 in curtin, we added post-up for interface aliases. bring that commit here.
2016-06-21sort attributes in sections, change 'mac_address' to 'hwaddress'Scott Moser
2016-06-21minor cleanupScott Moser
2016-06-21make _render_iface return a list of sections rather than one sectionScott Moser
2016-06-20merge with trunk.Scott Moser
test runs to the point where it did, think I got most of the changes incorporated.
2016-06-20add a header to rendered ENI file describing its contentScott Moser
2016-06-20leave early if no interfaces to renameScott Moser
2016-06-15merge with trunkScott Moser
2016-06-15Fix line length issuesJoshua Harlow
2016-06-15Fixup code review commentsJoshua Harlow
2016-06-14fix pep8 failure introduced in recent commit.Scott Moser
The commit 1232 (Refactor a large part of the networking code) broke pep8.
2016-06-14Make the os samples easier to extend (for new samples)Joshua Harlow
2016-06-13Refactor some of sysconfig changes -> network_state moduleJoshua Harlow
2016-06-10Add a bunch more sample tests for sysconfigJoshua Harlow
2016-06-10Add a sysconfig rendering testJoshua Harlow
2016-06-10Add a sysconfig rendererJoshua Harlow
2016-06-07For now just remove compat.py moduleJoshua Harlow
Let's reduce the size of this change for now.
2016-06-06Get cmdline working againJoshua Harlow
2016-06-06Rebase against masterJoshua Harlow
2016-06-03fix issue with routes on subnets not getting renderedScott Moser
2016-06-03avoid rendering 'lo' twice by not writing it in network config.Scott Moser
2016-06-03improve how 'lo' is handled when rendering network state to interfacesScott Moser
if you provide network state with a proper 'lo' entry, then when you render network interfaces you would get 2 entries. the additional one was because we add an 'lo' always and also because we had to put global 'dns' entries there. this fixes that duplicatation by handling lo specifically.
2016-06-02ConfigDrive: do not use 'id' on a link for the device nameScott Moser
'id' on a link in the openstack spec should be "Generic, generated ID". current implementation was to use the host's name for the host side nic. Which provided names like 'tap-adfasdffd'. We do not want to name devices like that as its quite unexpected and non user friendly. So here we use the system name for any nic that is present, but then require that the nics found also be present at the time of rendering. The end result is that if the system boots with net.ifnames=0 then it will get 'eth0' like names. and if it boots without net.ifnames then it will get enp0s1 like names.
2016-06-02eni parsing: support 'ether' in hwaddress, netmask and broadcastScott Moser
this adds ability to support ENI that has: hwadress ether 36:4c:e1:3b:14:31 or hwaddress 36:4c:e1:3b:14:31 the former is written by openstack (at least on dreamhost). Also, in the conversion of eni to network config support broadcast and netmask.
2016-06-01clean up log message a bit.Scott Moser
2016-06-01support renaming and fix logic in rename_interfacesScott Moser
The one issue i'm aware of currently is that tap devices (ip tuntap add mode tap user root mytap1) do not work correctly with 'is_up' which means the check does not bring them down and the rename fails. The LOG.debug message should be cleaned up too, as it currently references the function rather function.__name__ for nicer message.
2016-05-31add renaming code for renaming interfacesScott Moser
currently does not work in lxc https://github.com/lxc/lxd/issues/2063
2016-05-25commit to push for fear of loss.Scott Moser
== background == DataSource Mode (dsmode) is present in many datasources in cloud-init. dsmode was originally added to cloud-init to specify when this datasource should be 'realized'. cloud-init has 4 stages of boot. a.) cloud-init --local . network is guaranteed not present. b.) cloud-init (--network). network is guaranteed present. c.) cloud-config d.) cloud-init final 'init_modules' [1] are run "as early as possible". And as such, are executed in either 'a' or 'b' based on the datasource. However, executing them means that user-data has been fully consumed. User-data and vendor-data may have '#include http://...' which then rely on the network being present. boothooks are an example of the things run in init_modules. The 'dsmode' was a way for a user to indicate that init_modules should run at 'a' (dsmode=local) or 'b' (dsmode=net) directly. Things were further confused when a datasource could provide networking configuration. Then, we needed to apply the networking config at 'a' but if the user had provided boothooks that expected networking, then the init_modules would need to be executed at 'b'. The config drive datasource hacked its way through this and applies networking if *it* detects it is a new instance. == Suggested Change == The plan is to 1. incorporate 'dsmode' into DataSource superclass 2. make all existing datasources default to network 3. apply any networking configuration from a datasource on first boot only apply_networking will always rename network devices when it runs. for bug 1579130. 4. run init_modules at cloud-init (network) time frame unless datasource is 'local'. 5. Datasources can provide a 'first_boot' method that will be called when a new instance_id is found. This will allow the config drive's write_files to be applied once. Over all, this will very much simplify things. We'll no longer have 2 sources like DataSourceNoCloud and DataSourceNoCloudNet, but would just have one source with a dsmode. == Concerns == Some things have odd reliance on dsmode. For example, OpenNebula's get_hostname uses it to determine if it should do a lookup of an ip address. == Bugs to fix here == http://pad.lv/1577982 ConfigDrive: cloud-init fails to configure network from network_data.json http://pad.lv/1579130 need to support systemd.link renaming of devices in container http://pad.lv/1577844 Drop unnecessary blocking of all net udev rules
2016-05-24Fix up some of the net usage and restore imports and add a mini compat moduleJoshua Harlow
2016-05-24Fix load -> readJoshua Harlow
2016-05-19Fix up tests and flake8 warningsJoshua Harlow