From 829b7940bb1135c446de9f31fc8334305554e42f Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Fri, 17 Aug 2018 15:15:16 -0400 Subject: [PATCH] Use operating system specific IP utilities Operating systems seem to have decided to put network utilities in different places, therefore our network bootstrap code was not working on CentOS because it was not located in the same place as Ubuntu. This fixes it which should bring up the interfaces as needed. Change-Id: I6bf403b4c7d13e6a084ba29fad37b89893321369 --- tests/roles/bootstrap-host/defaults/main.yml | 19 ++++++++++ .../tasks/prepare_networking.yml | 38 +++++++++---------- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/tests/roles/bootstrap-host/defaults/main.yml b/tests/roles/bootstrap-host/defaults/main.yml index 56580a54bd..9c6c962889 100644 --- a/tests/roles/bootstrap-host/defaults/main.yml +++ b/tests/roles/bootstrap-host/defaults/main.yml @@ -118,6 +118,25 @@ netmask: "255.255.252.0" # # NICs bootstrap_host_public_interface: "{{ ansible_default_ipv4.interface }}" +# +# Utility paths +bootstrap_host_network_utils: + apt: + iptables: /sbin/iptables + ethtool: /sbin/ethtool + ip: /sbin/ip + yum: + iptables: /usr/sbin/iptables + ethtool: /usr/sbin/ethtool + ip: /usr/sbin/ip + zypper: + iptables: /usr/sbin/iptables + ethtool: /sbin/ethtool + ip: /sbin/ip +# +bootstrap_host_iptables_path: "{{ bootstrap_host_network_utils[ansible_pkg_mgr]['iptables'] }}" +bootstrap_host_ethtool_path: "{{ bootstrap_host_network_utils[ansible_pkg_mgr]['ethtool'] }}" +bootstrap_host_ip_path: "{{ bootstrap_host_network_utils[ansible_pkg_mgr]['ip'] }}" ## Extra storage # An AIO may optionally be built using a second storage device. If a diff --git a/tests/roles/bootstrap-host/tasks/prepare_networking.yml b/tests/roles/bootstrap-host/tasks/prepare_networking.yml index 9f8b8fbe85..cebe775cd1 100644 --- a/tests/roles/bootstrap-host/tasks/prepare_networking.yml +++ b/tests/roles/bootstrap-host/tasks/prepare_networking.yml @@ -213,26 +213,26 @@ RemainAfterExit: yes service_type: oneshot execstarts: - - "-/sbin/iptables -t nat -A POSTROUTING -o {{ bootstrap_host_public_interface }} -j MASQUERADE" - - "-/sbin/ethtool -K bond0 gso off sg off tso off tx off" - - "-/sbin/ethtool -K bond1 gso off sg off tso off tx off" - - "-/sbin/ethtool -K br-mgmt gso off sg off tso off tx off" - - "-/sbin/ethtool -K br-vxlan gso off sg off tso off tx off" - - "-/sbin/ethtool -K br-storage gso off sg off tso off tx off" - - "-/sbin/ethtool -K br-vlan gso off sg off tso off tx off" - - "-/sbin/ethtool -K br-dbaas gso off sg off tso off tx off" - - "-/sbin/ethtool -K br-lbaas gso off sg off tso off tx off" - - "-/bin/ip link set eth12 up" - - "-/bin/ip link set br-vlan-veth up" - - "-/sbin/ethtool -K eth12 gso off sg off tso off tx off" - - "-/bin/ip link set eth13 up" - - "-/bin/ip link set br-dbaas-veth up" - - "-/sbin/ethtool -K eth13 gso off sg off tso off tx off" - - "-/bin/ip link set eth14 up" - - "-/bin/ip link set br-lbaas-veth up" - - "-/sbin/ethtool -K eth14 gso off sg off tso off tx off" + - "-{{ bootstrap_host_iptables_path }} -t nat -A POSTROUTING -o {{ bootstrap_host_public_interface }} -j MASQUERADE" + - "-{{ bootstrap_host_ethtool_path }} -K bond0 gso off sg off tso off tx off" + - "-{{ bootstrap_host_ethtool_path }} -K bond1 gso off sg off tso off tx off" + - "-{{ bootstrap_host_ethtool_path }} -K br-mgmt gso off sg off tso off tx off" + - "-{{ bootstrap_host_ethtool_path }} -K br-vxlan gso off sg off tso off tx off" + - "-{{ bootstrap_host_ethtool_path }} -K br-storage gso off sg off tso off tx off" + - "-{{ bootstrap_host_ethtool_path }} -K br-vlan gso off sg off tso off tx off" + - "-{{ bootstrap_host_ethtool_path }} -K br-dbaas gso off sg off tso off tx off" + - "-{{ bootstrap_host_ethtool_path }} -K br-lbaas gso off sg off tso off tx off" + - "-{{ bootstrap_host_ip_path }} link set eth12 up" + - "-{{ bootstrap_host_ip_path }} link set br-vlan-veth up" + - "-{{ bootstrap_host_ethtool_path }} -K eth12 gso off sg off tso off tx off" + - "-{{ bootstrap_host_ip_path }} link set eth13 up" + - "-{{ bootstrap_host_ip_path }} link set br-dbaas-veth up" + - "-{{ bootstrap_host_ethtool_path }} -K eth13 gso off sg off tso off tx off" + - "-{{ bootstrap_host_ip_path }} link set eth14 up" + - "-{{ bootstrap_host_ip_path }} link set br-lbaas-veth up" + - "-{{ bootstrap_host_ethtool_path }} -K eth14 gso off sg off tso off tx off" execstops: - - "/sbin/iptables -t nat -D POSTROUTING -o {{ bootstrap_host_public_interface }} -j MASQUERADE" + - "{{ bootstrap_host_iptables_path }} -t nat -D POSTROUTING -o {{ bootstrap_host_public_interface }} -j MASQUERADE" enabled: yes state: started systemd_tempd_prefix: openstack