summaryrefslogtreecommitdiff
path: root/cloudinit/net
AgeCommit message (Collapse)Author
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-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
2016-05-19Remerge against head/masterJoshua Harlow
2016-05-19Adjust net module to be more isolatedJoshua Harlow
This allows it to be used outside of cloudinit more easily in the future.
2016-05-17Don't expose anything but 'render_network_state'Joshua Harlow
This should be the visible api of a network renderer as anything more granular varies between the different render types and will not apply to those renderers.
2016-05-12Fix up a ton of flake8 issuesJoshua Harlow
2016-05-11Remove stray prints leftoverJoshua Harlow
2016-05-11Fix py26 for rhel (and older versions of python)Joshua Harlow
2016-05-10Add some basic eni rendering testsJoshua Harlow
2016-05-10Fix removal of validate_commandJoshua Harlow
2016-05-10Move net/renderers -> netJoshua Harlow
2016-05-10Rename to net/renderers and klibc -> cmdline.pyJoshua Harlow
2016-05-09Use the new renderer in the debian and stages filesJoshua Harlow
2016-05-09Move the current rendering to a debian distro fileJoshua Harlow
This format allows for rendering to work in other distros and clearly separates the API needed to do this (it also moves the klibc parsing into its own module so that the leftover code in net/__init__.py is smaller and only focused on util code).
2016-05-05Use a decorator vs repeated key checks.Joshua Harlow
2016-05-05Add the bridge net typeJoshua Harlow
2016-05-05Work on refactoring (and adding) network conversion testsJoshua Harlow
2016-04-15network: do not write interface as 'auto' from ip= on command line.Scott Moser
When ip= on the kernel command line defines the networking, set those network devices to be manually controlled, instead of 'auto'. The reason for this is that if they're marked as 'auto': a.) a second attempt will be made to ifup them. b.) they'll be brought down on shutdown 'b' is problematic on network root filesystem. Also this picks up 2 changes from curtin's net module: - Cleanup newline logic so we always have a clean '\n\n' between stanza - Add a unittest to validate bonding network config render, specifically when to emit auto $iface for dependent bond slaves. LP: #1568637
2016-04-15write 'allow-hotplug', but 'auto' for auto.Scott Moser
2016-04-15support and render control=manual on initramfs network devicesScott Moser
when reading the initramfs configurewd devices and turning them into network config, we change to not have 'auto' control (or allow=auto). The reason for this is that if the device was still up: a.) it would try to bring it up again (due to bug 1570142) b.) it would be brought down. 'b' is problematic if there is an iscsi or network root filesystem. Note, that ifupdown does now support 'no-auto-down' which means that the nic should not be brought down on 'ifdown -a'. LP: #1568637
2016-04-15sync with curtin on render_interfacesScott Moser
This picks up newline cleanup and some bond fixes from curtin at rev 374. - Cleanup newline logic so we always have a clean '\n\n' between stanza - Add a unittest to validate bonding network config render, specifically when to emit auto $iface for dependent bond slaves.
2016-04-14fallback net config: do not consider devices starting with 'veth'Scott Moser
Just skip devices that are named veth*. The fix here is to ignore lxd created devices, but any other veth device that is created at this point in boot is probably not the right interface to dhcp on. LP: #1569064
2016-04-13skip bridges when generating fallback networkingScott Moser
It does not make sense to consider bridges when searching for fallback networking. If the system is configured with a bridge, then its probably for some purpose other than to get to a metadata service. Considering the bridge could make cloud-init pick the wrong device on reboot. LP: #1569974
2016-03-24some final changesScott Moser
a.) do not write systemd link files if we do not have a mac address. the check is updated to check for value rather than just presense (ie, 'mac_address': None) b.) DataSourceNoCloudNet: search in the nocloud seed dir this is important because NoCloud if dsmode is Net will look only would pass by, expecting NoCloudNet to pick it up but NoCloudNet would not look in /var/lib/cloud/seed/nocloud and thus skip it. c.) support the disabling of network configuration via /var/lib/cloud/data/upgraded-network This is what the package upgrader is writing.
2016-03-24pep8 fixes from last comment mergeScott Moser
2016-03-24support reading network config from kernel command lineScott Moser
This adds support for suppling network configuration on the kernel command line in 2 ways: a.) kernel command line includes 'network-config=<base64>' value of that parameter is base64 encoded json (or yaml) it is taken as network config yaml. In order to save space on kernel command line, it can be base64 encoded gzipped json also. b.) ip= paired with files authored by klibc's ipconfig tool When network devices are brought up in the initramfs, klibc's ipconfig tool writes files are named /run/net-<DEVNAME>.conf. The best documentation available on that tool is /usr/share/doc/libklibc/README.ipconfig.gz. Also changes util.get_cmdline() to return the command line of pid 1 if it is in a container. That is to make it consistent with The systemd generator, and allow passing a command line to lxd, as lxd does not mask /proc/cmdline.
2016-03-24add comments and improve error messagesScott Moser