diff options
Diffstat (limited to 'fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files')
-rwxr-xr-x | fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/agents_flavors_update.sh (renamed from fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/remove_agent.sh) | 12 | ||||
-rwxr-xr-x | fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/clean.sh | 45 | ||||
-rwxr-xr-x | fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/configure_bridges.sh | 26 | ||||
-rw-r--r-- | fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/linux_net.py | 45 | ||||
-rw-r--r-- | fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/neutron-plugin-openvswitch-agent.conf | 17 | ||||
-rwxr-xr-x | fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch-switch.conf | 13 | ||||
-rwxr-xr-x | fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch.service | 11 |
7 files changed, 39 insertions, 130 deletions
diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/remove_agent.sh b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/agents_flavors_update.sh index 98ee30a..83164c1 100755 --- a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/remove_agent.sh +++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/agents_flavors_update.sh @@ -1,15 +1,11 @@ #!/usr/bin/env bash set -x -# access openstack cli -export OS_PROJECT_NAME=admin -export OS_USERNAME=$1 -export OS_PASSWORD=$2 -export OS_TENANT_NAME=$3 -export OS_AUTH_URL=https://$4:5000/v2.0 +# access openstack cli +source /root/openrc -sleep 150 +sleep 10 neutron agent-list # Force update of vswitch agents @@ -17,7 +13,7 @@ for i in `neutron agent-list | grep "Open vSwitch agent" | awk {'print $2'}`; do neutron agent-update $i done -sleep 150 +sleep 10 neutron agent-list # grep id and remove dead agent on all compute nodes diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/clean.sh b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/clean.sh deleted file mode 100755 index 9110b45..0000000 --- a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/clean.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -# Short script for uninstallation of OVS with DPDK - -# enable debugging: -#set -o xtrace - -# Stopping service if needed -echo "[debug] stopping ovs-dpdk (if needed)" -sudo service ovs-dpdk status 2>&1 1>/dev/null -res=$? - -if [ $res -eq 2 ]; then - echo "[warning] service ovs-dpdk is already stopped" -else - echo "[debug] stopping ovs-dpdk service" - sudo service ovs-dpdk stop 2>&1 1>/dev/null -fi - -# Remove ovs-dpdk service -echo "[debug] removing ovs-dpdk service" -sudo rm -f /etc/default/ovs-dpdk -sudo rm -f /etc/init.d/ovs-dpdk - -# kvm wrapper -echo "[debug] replacing kvm wrapper" -if [ -e /usr/bin/kvm ]; then - KVM_CMD="/usr/bin/kvm" -elif [ -e /usr/bin/qemu-kvm ]; then - KVM_CMD="/usr/bin/qemu-kvm" -elif [ -e /usr/libexec/qemu-kvm ]; then - KVM_CMD="/usr/libexec/qemu-kvm" -else - echo "[warning] package qemu-kvm probably not installed" -fi - -cat << 'EOF' | sudo tee $KVM_CMD -#!/bin/sh - -exec /usr/bin/qemu-system-x86_64 "${args[@]}" -EOF - - -# remove git repos -echo "[warning] git repos were not automatically removed, you can remove it once you're finished with them" diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/configure_bridges.sh b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/configure_bridges.sh index c77258f..4a5c806 100755 --- a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/configure_bridges.sh +++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/configure_bridges.sh @@ -1,25 +1,5 @@ #!/usr/bin/env bash -for bridge in `sudo ovs-vsctl list-br`; do sudo ovs-vsctl --no-wait set Bridge $bridge datapath_type=netdev; done; - -# Configure integration bridge with specified datapath -#sudo ovs-vsctl --no-wait -- --may-exist add-br br-int -#if [ "$1" != "" ]; then - #sudo ovs-vsctl --no-wait set Bridge br-int datapath_type=$1 -#fi -#sudo ovs-vsctl --no-wait br-set-external-id br-int bridge-id br-int - -# Configure external bridge with specified datapath -#sudo ovs-vsctl --no-wait -- --may-exist add-br br-ex -#if [ "$1" != "" ]; then - #sudo ovs-vsctl --no-wait set Bridge br-ex datapath_type=$1 -#fi -#sudo ovs-vsctl --no-wait br-set-external-id br-ex bridge-id br-ex - -# Configure br-tun bridge with specified datapath -#sudo ovs-vsctl --no-wait -- --may-exist add-br br-tun -#if [ "$1" != "" ]; then - #sudo ovs-vsctl --no-wait set Bridge br-tun datapath_type=$1 -#fi -#sudo ovs-vsctl --no-wait br-set-external-id br-tun bridge-id br-tun - +for bridge in `sudo ovs-vsctl list-br`; do + sudo ovs-vsctl --no-wait set Bridge $bridge datapath_type=$1; +done; diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/linux_net.py b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/linux_net.py index bbbcc98..10ddff7 100644 --- a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/linux_net.py +++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/linux_net.py @@ -24,11 +24,13 @@ import re import time import netaddr +import netifaces from oslo_concurrency import processutils from oslo_config import cfg from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_utils import excutils +from oslo_utils import fileutils from oslo_utils import importutils from oslo_utils import timeutils import six @@ -36,7 +38,6 @@ import six from nova import exception from nova.i18n import _, _LE, _LW from nova import objects -from nova.openstack.common import fileutils from nova import paths from nova.pci import utils as pci_utils from nova import utils @@ -108,6 +109,8 @@ linux_net_opts = [ help='The IP address for the metadata API server'), cfg.IntOpt('metadata_port', default=8775, + min=1, + max=65535, help='The port for the metadata API port'), cfg.StrOpt('iptables_top_regex', default='', @@ -394,7 +397,7 @@ class IptablesManager(object): elif ip_version == 6: tables = self.ipv6 - for table, chains in builtin_chains[ip_version].iteritems(): + for table, chains in six.iteritems(builtin_chains[ip_version]): for chain in chains: tables[table].add_chain(chain) tables[table].add_rule(chain, '-j $%s' % (chain,), @@ -426,11 +429,11 @@ class IptablesManager(object): self.apply() def dirty(self): - for table in self.ipv4.itervalues(): + for table in six.itervalues(self.ipv4): if table.dirty: return True if CONF.use_ipv6: - for table in self.ipv6.itervalues(): + for table in six.itervalues(self.ipv6): if table.dirty: return True return False @@ -461,7 +464,7 @@ class IptablesManager(object): run_as_root=True, attempts=5) all_lines = all_tables.split('\n') - for table_name, table in tables.iteritems(): + for table_name, table in six.iteritems(tables): start, end = self._find_table(all_lines, table_name) all_lines[start:end] = self._modify_rules( all_lines[start:end], table, table_name) @@ -485,7 +488,7 @@ class IptablesManager(object): def _modify_rules(self, current_lines, table, table_name): unwrapped_chains = table.unwrapped_chains - chains = table.chains + chains = sorted(table.chains) remove_chains = table.remove_chains rules = table.rules remove_rules = table.remove_rules @@ -1549,9 +1552,11 @@ class LinuxBridgeInterfaceDriver(LinuxNetInterfaceDriver): @staticmethod @utils.synchronized('lock_vlan', external=True) - def ensure_vlan(vlan_num, bridge_interface, mac_address=None, mtu=None): + def ensure_vlan(vlan_num, bridge_interface, mac_address=None, mtu=None, + interface=None): """Create a vlan unless it already exists.""" - interface = 'vlan%s' % vlan_num + if interface is None: + interface = 'vlan%s' % vlan_num if not device_exists(interface): LOG.debug('Starting VLAN interface %s', interface) _execute('ip', 'link', 'add', 'link', bridge_interface, @@ -1599,14 +1604,16 @@ class LinuxBridgeInterfaceDriver(LinuxNetInterfaceDriver): """ if not device_exists(bridge): LOG.debug('Starting Bridge %s', bridge) - _execute('brctl', 'addbr', bridge, run_as_root=True) + out, err = _execute('brctl', 'addbr', bridge, + check_exit_code=False, run_as_root=True) + if (err and err != "device %s already exists; can't create " + "bridge with the same name\n" % (bridge)): + msg = _('Failed to add bridge: %s') % err + raise exception.NovaException(msg) + _execute('brctl', 'setfd', bridge, 0, run_as_root=True) # _execute('brctl setageing %s 10' % bridge, run_as_root=True) _execute('brctl', 'stp', bridge, 'off', run_as_root=True) - # (danwent) bridge device MAC address can't be set directly. - # instead it inherits the MAC address of the first device on the - # bridge, which will either be the vlan interface, or a - # physical NIC. _execute('ip', 'link', 'set', bridge, 'up', run_as_root=True) if interface: @@ -1619,6 +1626,18 @@ class LinuxBridgeInterfaceDriver(LinuxNetInterfaceDriver): msg = _('Failed to add interface: %s') % err raise exception.NovaException(msg) + # NOTE(apmelton): Linux bridge's default behavior is to use the + # lowest mac of all plugged interfaces. This isn't a problem when + # it is first created and the only interface is the bridged + # interface. But, as instance interfaces are plugged, there is a + # chance for the mac to change. So, set it here so that it won't + # change in the future. + if not CONF.fake_network: + interface_addrs = netifaces.ifaddresses(interface) + interface_mac = interface_addrs[netifaces.AF_LINK][0]['addr'] + _execute('ip', 'link', 'set', bridge, 'address', interface_mac, + run_as_root=True) + out, err = _execute('ip', 'link', 'set', interface, 'up', check_exit_code=False, run_as_root=True) diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/neutron-plugin-openvswitch-agent.conf b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/neutron-plugin-openvswitch-agent.conf deleted file mode 100644 index bef0a46..0000000 --- a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/neutron-plugin-openvswitch-agent.conf +++ /dev/null @@ -1,17 +0,0 @@ -# vim:set ft=upstart ts=2 et: -description "Neutron OpenvSwitch Plugin Agent" -author "Chuck Short <zulcss@ubuntu.com>" - -start on neutron-ovs-cleanup or runlevel [2345] -stop on runlevel [!2345] - -respawn - -chdir /var/run - -pre-start script - mkdir -p /var/run/neutron - chown neutron:root /var/run/neutron -end script - -exec start-stop-daemon --start --chuid neutron:neutron --exec /usr/local/bin/networking-ovs-dpdk-agent -- --config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/plugin.ini --log-file=/var/log/neutron/ovsdpdk-agent.log diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch-switch.conf b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch-switch.conf deleted file mode 100755 index 185ae8e..0000000 --- a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch-switch.conf +++ /dev/null @@ -1,13 +0,0 @@ -# vim: set ft=upstart ts=2 et: -description "Open vSwitch switch DPDK" - -start on (local-filesystems and net-device-up IFACE=lo) -stop on runlevel [!2345] - -pre-start script - /etc/init.d/ovs-dpdk start -end script - -post-stop script - /etc/init.d/ovs-dpdk stop -end script diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch.service b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch.service deleted file mode 100755 index f46f9c7..0000000 --- a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Open vSwitch with DPDK - -[Service] -Type=oneshot -ExecStart=/etc/init.d/ovs-dpdk start -ExecStop=/etc/init.d/ovs-dpdk stop -RemainAfterExit=yes - -[Install] -WantedBy=multi-user.target |