aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2016-03-22Fix order-of-operations bug in os-net-config restart_interfacesDan Sneddon2-12/+57
The current order of operations of bringing up interfaces starts with the bridges, and restarts the members of the bridges. This works well when an OVS bond is part of an OVS bridge, but does not work well when Linux bonding is used with no bridges (such as in the case of the Nuage plugin, which creates the bridges outside of the ifcfg files). This change will ensure that Linux bonds are brought up first, then any bridges are brought up, interfaces are brought up next, and the VLAN interfacs are brought up last. This corrects a race condition where any VLAN which was brought up before the bond would not be active, and the VLAN would have to be brought up by hand. This change also fixes a logging issue where os-net-config would report that no changes were necessary when changes were made. Now, the logging messages indicating that "No changes were necessary" show up when no changes are required, instead of when changes are actually made. Change-Id: I1efee3dfd8e8cef01b054bb57a3085cc7eb60372
2016-03-17Merge "py26 is no longer supported by Infra's CI"Jenkins1-2/+2
2016-03-17Merge "Fix hierarchy for Linux Bonds and Linux Bridges"Jenkins3-1/+21
2016-03-11Add ability to set IPv6 routes in os-net-config templatesDan Sneddon2-16/+96
This change adds the ability to write IPv6 routes to the system NIC configuration. In the ifcfg provider, IPv6 routes must be written to network-scripts/route6-<interface> rather than route-interface. This patch checks the next hop, and if it is an IPv6 address (assumed because of the presence of ":"), then the route will be written to route6-<interface>. This patch includes tests to confirm proper operation. Change-Id: I3563800c774a6082a896c7508f5a92e25418fe63
2016-03-11Fix hierarchy for Linux Bonds and Linux BridgesDan Sneddon3-1/+21
This change cleans up some of the Linux Bond and Linux Bridge logic that processes member interfaces and VLANs. One bug is fixed, where a VLAN might be assigned as a slave interface on a bond. Changes were made so that if VLANs are placed under a Linux Bond, the PHYSDEV is set to the bond, so the device: does not need to be specified in the config. This change ensures that if a bridge has a bond and VLANs as members, that the VLAN will be a member of the bridge and not the bond. Change-Id: Id329737f0032e781b111741086ded83f378297a7
2016-03-07Enable os_net_config to configure IVSxinwu7-0/+357
This change generates /etc/sysconf/network-scripts/ifcfg-* for ivs. It also generates /etc/sysconf/ivs configuration file for ivs. It supports only RedHat at this point. Indigo Virtual Switch (IVS, https://github.com/floodlight/ivs) is a virtual switch for Linux. It is compatible with the KVM hypervisor and leveraging the Open vSwitch kernel module for packet forwarding. There are three major differences between IVS and OVS: 1. Each node can have at most one ivs, name is not required. 2. Bond is not allowed to attach to an ivs. It is the SDN controller's job to dynamically form bonds on ivs. 3. IP address can only be statically assigned. Change-Id: I276d736794d123405de793c2a4eb2c1ee55a0fad
2016-03-02Merge "launchpad bug 1537330, fix _is_active_nic"Jenkins1-5/+3
2016-02-15Allow setting MTU to 1500Ian Pilcher5-11/+23
There are times when it is desirable to set the MTU of an "interface" to 1500 -- when the external network and the storage network are different VLANs on the same physical interface, for example. Change-Id: Ic5ea6ad05118fd57c26c898a460c19969de4109d Closes-Bug: #1539821
2016-02-12launchpad bug 1537330, fix _is_active_nicxinwu1-5/+3
The detailed bug description is at https://bugs.launchpad.net/os-net-config/+bug/1537330 Since kilo, os-net-config starts to support linux bond. However, the addr_assign_type value of an active member interface of a linux bond is 3, but not 0. The consequence of this problem is that the linux bond member links are never considered as active, this further messes up the nicX to interface name mapping. This change checks if device directory exists, instead of checking the addr_assign_type value. This directory exists only when the interface is an actual physical interface. Change-Id: I8e4c95a2efa809fd236b07cbce1b81a2e774f858
2015-12-26py26 is no longer supported by Infra's CIjanonymous1-2/+2
Python 2.6 support would be dropped by Infra team from mitaka,CI would no longer be testing it, so projects should drop it too. Change-Id: Ic7dc4b74d231c47c28e789941cd30897880cb791
2015-11-20ifcfg: add VLAN=yes when neededGonéri Le Bouder2-0/+17
Add the VLAN=yes parameter if the interface name is in the foo.123 format. This is the behavior and Debian allow the same os-net-config configuration file to be consistent with Red Hat systems. See also: https://bugzilla.redhat.com/show_bug.cgi?id=1283812 Change-Id: Iab2a4861e2231b34899c379963abbef59cf73328 Closes-Bug: #1518449
2015-11-04Merge "Added natural sort for interfaces in utils.ordered_active_nics()"Jenkins2-3/+18
2015-10-21Merge "Support multiple addresses assignment with eni"Jenkins3-5/+39
2015-10-19Added natural sort for interfaces in utils.ordered_active_nics()bdemers2-3/+18
This way device eth10 is after eth9, and not directly after eth1 Change-Id: I81eba97cccf6c4f314f9037d16ee1f244dbade02 Closes-Bug: #1482818
2015-10-16Merge "Fix kwarg assignment in objects.py"Jenkins1-16/+35
2015-10-16Merge "Add Linux Bridge capability to os-net-config ifcfg"Jenkins6-2/+241
2015-10-12Fix kwarg assignment in objects.pyDan Sneddon1-16/+35
This change modifies the kwargs in the object instantiation to use immutable default assignments. This is for object safety, since a mutable object will not point to a new memory address on modification. In Python, lists and dicts should not be used as default assignments for kwargs. Change-Id: I73993df12ca317161ba32e02a98a5f40ef8904f3
2015-10-12Add Linux Bridge capability to os-net-config ifcfgDan Sneddon6-2/+241
This patch adds support for Linux Bridges to os-net-config. This is done completely with ifcfg files, brctl is not used directly. Hierarchy is preserved, so a Linux Bridge may have a Linux Bond as a member, which in turn may have multiple interfaces as members. This changeset has been updated to include a more specific example for Linux bridge configuration (that doesn't combine bridging and bonding). This change depends on the change to add support for Linux Bonds. Change-Id: I1ddacd514b02af30139a868071d82cde19b1f946
2015-10-12Merge "Add support for Linux Bonding to os-net-config ifcfg"Jenkins6-0/+204
2015-10-08Merge "Support multiple addresses assignment with ifcfg"Jenkins2-6/+37
2015-10-05Add support for Linux Bonding to os-net-config ifcfgDan Sneddon6-0/+204
This change adds support for Linux Bonding to the impl_ifcfg in os-net-config. This change adds support for configuring Linux Bonds using the Bonding module rather than Open vSwitch. Most of the options for Linux Bonds are the same as OVS, with the exception of bonding_options instead of ovs_options. Change-Id: If8c6de1554234277843de9fac58536dd5b0a941b
2015-10-01Merge "ifcfg: Add support for dns_servers"Jenkins4-15/+69
2015-09-25Merge "Change ignore-errors to ignore_errors"Jenkins1-1/+1
2015-09-24Merge "os-net-config: ensure ifup is called just once"Jenkins2-1/+10
2015-09-23ifcfg: Add support for dns_serversDan Prince4-15/+69
Adds in the ability to optionally configure DNS server settings via the ifcfg file formats. The dns_servers JSON is an array which currently supports either 1 or 2 DNS servers (per limitations of the ifcfg format). Change-Id: I9edecfdd4e1d0f39883b72be554cd92c5685881d
2015-09-21Change ignore-errors to ignore_errorsMonty Taylor1-1/+1
Needed for coverage 4.0 Change-Id: I900ca20ee5e9c70d220c7f17548e8236f4a24658
2015-08-17Support multiple addresses assignment with eniTomoki Sekiyama3-5/+39
Currently only the first IPv4/v6 address is assigned to a NIC even if multiple addresses are specified in config file. With this change, eni implementation can configure multiple IPv4/v6 addresses for a NIC. Also this fixes IPv6 netmask format, which currently causes an error on ifup. Change-Id: I0a38d376bece8af297bddede594962fd3a193d09
2015-08-17Support multiple addresses assignment with ifcfgTomoki Sekiyama2-6/+37
Currently only the first IPv4/v6 address is assigned to a NIC even if multiple addresses are specified in config file. With this change, ifcfg implementation can configure multiple IPv4/v6 addresses for a NIC. Also this enables os-net-config to configure IPv6 netmasks. Change-Id: I31b39abae36e0620dbbcb1001fa51f5ca2bd9ea2
2015-08-17os-net-config: ensure ifup is called just onceDan Prince2-1/+10
This patch fixes an issue in the ifcfg provider implementation that caused interfaces to be started twice. This can cause failures if the interface uses DHCP and dhclient was already running. The child_members function was incorrectly adding the interface name to the child members set on key error. This patch removes that logic and simply ignores key errors. Change-Id: Ibe0e32bc09979bc68b92a722b2bfa383e77502a9 Closes-bug: #1485634
2015-08-14Correct class comment for NetConfigDan Prince1-1/+1
Change-Id: I3c2614028a8a009e24615dff7a8e2f0c570cbf70
2015-08-14Add --detailed-exit-codesDan Prince2-0/+36
This patch adds a new --detailed-exit-codes option which can be used to optionally enable the os-net-config CLI to return exit code 2 if there have been modifications. Detailed exit codes are useful if you need to trigger subsequent external actions based whether os-net-config made changes or not. Change-Id: I8f22fa15335d1276f4e444a6454a24ff486e1495
2015-08-02Allow to specify the root directory of the filesystemFrederic Lepied6-29/+47
Change-Id: Ice1b8d17804cf7a0aafd308945a5e960fe927bbc
2015-07-01Add support for dhclient_argsDan Prince4-15/+50
This patch adds an optional flag that can be used to pass in args for dhclient when using DHCP. This use case for this is to be able to control which DHCP options dhclient listens for and we can thus disable specific options (like routing) for some network configurations. Change-Id: Ic21de0615ea0ef304843c55cc5abe43cb1771169
2015-06-09Automate selection of active bond slaveDan Sneddon2-1/+18
This change selects an interface to be the active slave in a bond with active/passive characteristics. If one of the interfaces is marked as primary, it will be the active slave. If none of the interfaces are marked, the interface with the lowest alphanumeric value will be chosen. For instance em2 comes before em3. Co-Authored-By: Dan Prince <dprince@redhat.com> Change-Id: Ic9b4e8c68b788b98a19ea33a76c9210a80deabeb
2015-06-09Set primary interface on OVS bondsDan Sneddon3-1/+29
This change sets one of the member interfaces of a bond as the primary interface, which results in that interface being the active slave. This change adds a step to the apply method in impl_ifcfg which runs 'ovs-appctl bond/set-active-slave <bond> <iface>' after bringing up the bond interfaces. This step ensures that the bonds work correctly without LACP switch support. If a member interface on the bond is set as primary, that interface will be used. Co-Authored-By: Dan Prince <dprince@redhat.com> Change-Id: I795bb3b8ef977f9276bfec062b197c473393942e
2015-06-04Merge "Don't set OVSDHCPINTERFACES if bridge is static"Jenkins2-1/+25
2015-06-03Don't set OVSDHCPINTERFACES if bridge is staticDan Prince2-1/+25
Updates the ifcfg provider so that we don't set the OVSDHCPINTERFACES config setting if the interface is private. This doesn't seem to cause any functional issues but it is not required and can be confusing. Change-Id: I9d51905df87969ae1b221680e8f0b5befc7b6bfe
2015-06-03ifcfg: don't set VLAN=yes if is an ovs_portDan Prince2-5/+14
When using the ifcfg provider vlans on bridges (or bonds) fail to startup correctly. This is because VLANs on an OVS bridge are configured as internal ports and these should not have the VLAN=yes or PHYSDEV ifcfg settings specified. Change-Id: Ieb743eda8f0a25cdaca43bdea767af26bf504f15 Closes-bug: #1453904
2015-06-03Merge "-v trumps -d on the CLI"Jenkins1-3/+3
2015-05-14Add NM_CONTROLLED=no to each interface configurationDan Sneddon2-0/+8
In order to allow os-net-config to coexist with NetworkManager, this patch adds NM_CONTROLLED=no to the top of each interface configuration. This ensures that NetworkManager will not mess with interfaces that are configured by os-net-config. Change-Id: I9d226e032eb1cb411b6ea617936f4425c7fd2c74
2015-05-14Add 'eno*' interfaces to embedded_nicsDan Sneddon1-1/+2
On certain systems, the embedded NICs appear as eno1, eno2, etc. This patch adds 'eno' to 'em' and 'eth' as interface names that should be considered embedded NICs. Change-Id: Icc49596573bdbb8af25f934a647f0a2ab82adaa5
2015-05-11Add flag for DEFROUTE=no in ifcfg files to ignore DHCP gatewayDan Sneddon6-15/+79
When multiple interfaces are configured with DHCP, and more than one interface receives a gateway from the DHCP server(s), the resulting default gateway on the system is unpredictable. This change adds the "defroute" boolean to the configuration syntax for os-net-config. Any interface type may be marked so that the gateway received from the DHCP server will not be eligible as a default gateway for the system. This only works for ifcfg files, /etc/network/interfaces lacks an equivalent option. Change-Id: Id775f3506b2ec60c9a2833efd49fb8319151c00d Closes-Bug: 1449288
2015-04-30-v trumps -d on the CLIDan Prince1-3/+3
This patch updates the handling of the --debug and --verbose options so that if both are specified then log level is set to DEBUG. Change-Id: I65d5665631f5575d1c8343bb7c1b197a61e0e176 Closes-bug: #1450586
2015-03-19Mark ENI files as autogeneratedDan Prince2-6/+12
End users may not realize these files are autogenerated and may be surprised if they make changes to the /etc/sysconfig/network-scripts files which are then overwritten on reboot. Change-Id: I526c228463bd10de2cf3724aa4159b63a9aeff80
2015-03-05Enable renaming of interfaces without rebootSteven Hardy3-2/+28
When using persist_mapping to rename nics, you can either use --no-activate then reboot, or with this patch, allow activation and we'll take the device links down and rename on the fly avoiding the need for a reboot. Change-Id: Ife9486c9f5447e9c7a55f90ba075e22b6344ad67
2015-03-05Add a --no-activate option to disable device up/down actionsSteven Hardy5-21/+70
Allows you to only install the config, but not take interfaces down/up. Useful if you wish to defer activation of a new config until a later time (e.g reboot). Change-Id: I42f3195e1d3d5d3b9d1c9dbb1f7cf1364503cbd3
2015-03-04Merge "Strip trailing whitespace from yaml samples"Jenkins3-13/+13
2015-02-24Refactor ifup/ifdown into base-classSteven Hardy3-21/+19
Refactor some common code so the base-class handles the ifup/down Change-Id: Id1fee1d2d5c9315717611b7bf18f058c49fe3622
2015-02-24Refactor noop to enable logging of disabled operationsSteven Hardy3-40/+58
Currently we only output the config file contents in noop mode, but it's very useful to see what would be done in terms of taking interfaces up and down, and especially what will be removed when --cleanup mode is specified So this refactors the operations skipped by noop into the base-class so we can conveniently log what they would do when --noop is selected. Change-Id: Ia9cfa9a05b2df02c165a2ff992765ab63e55ae6b
2015-02-24Remove deprecated references to oslo-incubatorSteven Hardy17-2275/+9
Purge references to modules which have been deprecated by various oslo libraries. Requires changes to use oslo.utils and oslo.concurrency, which are added to the requirements, syncing with the latest in global requirements so we can also move to the un-namespaced oslo package names. Change-Id: Idacb71b7871330e3b3fabf4a926a5b8987614c4d