From e525200dcf33b91f65790451f01aa92d455ebcea Mon Sep 17 00:00:00 2001 From: Billy O'Mahony Date: Wed, 27 Jan 2016 15:55:55 +0000 Subject: fuel-plugins: Fuel8 Liberty rebase Change-Id: I9c0e3ab4c8fde13765ec286d4c7c717070230983 Signed-off-by: Michal Ptacek Reviewed-by: Mark D. Gray Reviewed-by: Billy O'Mahony (cherry picked from commit 7ce21aebcdabafaa24601104643cbd1c0b4bc8e4) Change-Id: I5bb3dd48f5104606b4b024f99517b0b059003bea --- .../modules/ovsdpdk/files/agents_flavors_update.sh | 30 +++++ .../puppet/modules/ovsdpdk/files/clean.sh | 45 ------- .../modules/ovsdpdk/files/configure_bridges.sh | 26 +---- .../puppet/modules/ovsdpdk/files/linux_net.py | 45 ++++--- .../files/neutron-plugin-openvswitch-agent.conf | 17 --- .../modules/ovsdpdk/files/openvswitch-switch.conf | 13 --- .../modules/ovsdpdk/files/openvswitch.service | 11 -- .../puppet/modules/ovsdpdk/files/remove_agent.sh | 34 ------ .../modules/ovsdpdk/manifests/install_ovs_dpdk.pp | 130 ++++++--------------- .../ovsdpdk/manifests/postinstall_ovs_dpdk.pp | 82 ++++++------- 10 files changed, 141 insertions(+), 292 deletions(-) create mode 100755 fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/agents_flavors_update.sh delete mode 100755 fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/clean.sh delete mode 100644 fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/neutron-plugin-openvswitch-agent.conf delete mode 100755 fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch-switch.conf delete mode 100755 fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/openvswitch.service delete mode 100755 fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/remove_agent.sh (limited to 'fuel-plugin-ovsnfv/deployment_scripts/puppet/modules') diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/agents_flavors_update.sh b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/agents_flavors_update.sh new file mode 100755 index 0000000..83164c1 --- /dev/null +++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/agents_flavors_update.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -x + +# access openstack cli +source /root/openrc + +sleep 10 +neutron agent-list + +# Force update of vswitch agents +for i in `neutron agent-list | grep "Open vSwitch agent" | awk {'print $2'}`; do + neutron agent-update $i +done + +sleep 10 +neutron agent-list + +# grep id and remove dead agent on all compute nodes +for i in `nova host-list | grep compute | awk {'print $2'}`; do + dead_agent_id=`neutron agent-list | grep $i | grep xxx | grep "Open vSwitch agent" | awk {'print $2'}` + neutron agent-delete $dead_agent_id +done + +# modify flavors +for i in `nova flavor-list | grep m1 | awk {'print $4'}`; do + nova flavor-key $i set "hw:mem_page_size=large" +done + +set +x 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 " - -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 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/remove_agent.sh deleted file mode 100755 index 98ee30a..0000000 --- a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/files/remove_agent.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/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 - -sleep 150 -neutron agent-list - -# Force update of vswitch agents -for i in `neutron agent-list | grep "Open vSwitch agent" | awk {'print $2'}`; do - neutron agent-update $i -done - -sleep 150 -neutron agent-list - -# grep id and remove dead agent on all compute nodes -for i in `nova host-list | grep compute | awk {'print $2'}`; do - dead_agent_id=`neutron agent-list | grep $i | grep xxx | grep "Open vSwitch agent" | awk {'print $2'}` - neutron agent-delete $dead_agent_id -done - -# modify flavors -for i in `nova flavor-list | grep m1 | awk {'print $4'}`; do - nova flavor-key $i set "hw:mem_page_size=large" -done - -set +x diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/install_ovs_dpdk.pp b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/install_ovs_dpdk.pp index d049077..3ee6328 100755 --- a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/install_ovs_dpdk.pp +++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/install_ovs_dpdk.pp @@ -16,7 +16,11 @@ class ovsdpdk::install_ovs_dpdk ( if $compute == 'True' { exec {'create_ovs_dpdk': - command => "mv /etc/init.d/openvswitch-switch /tmp/openvswitch-switch.bak;cp ${networking_ovs_dpdk_dir}/devstack/ovs-dpdk/ovs-dpdk-init /etc/init.d/openvswitch-switch;chmod +x /etc/init.d/openvswitch-switch; ln -sf /etc/init.d/openvswitch-switch /etc/init.d/ovs-dpdk; cp /etc/openvswitch/conf.db /etc/openvswitch/conf.db.pre_dpdk", + command => "mv /etc/init.d/openvswitch-switch /tmp/openvswitch-switch.bak;\ + cp ${networking_ovs_dpdk_dir}/devstack/ovs-dpdk/ovs-dpdk-init /etc/init.d/openvswitch-switch;\ + chmod +x /etc/init.d/openvswitch-switch;\ + ln -sf /etc/init.d/openvswitch-switch /etc/init.d/ovs-dpdk;\ + cp /etc/openvswitch/conf.db /etc/openvswitch/conf.db.pre_dpdk", user => root, path => ['/usr/bin','/bin'], } @@ -29,102 +33,36 @@ class ovsdpdk::install_ovs_dpdk ( require => File['/etc/default/ovs-dpdk'], } -# exec { 'update ovs service': -# command => "cp ${plugin_dir}/files/${openvswitch_service_file} ${openvswitch_service_path}/${openvswitch_service_file}", -# path => ['/usr/bin','/bin'], -# user => root, -# onlyif => "test -f ${openvswitch_service_path}/${openvswitch_service_file}", -# } - -# if $::operatingsystem == 'CentOS' { -# exec { 'systemctl daemon-reload': -# path => ['/usr/bin','/bin','/usr/sbin'], -# user => root, -# require => Exec['update ovs service'], -# } -# } - - package { 'zlib1g-dev': - ensure => installed, - } - - package { 'libglib2.0-dev': - ensure => installed, - } - - package { 'libxml2-dev': - ensure => installed, - } - - package { 'libdevmapper-dev': - ensure => installed, - } - - package { 'libpciaccess-dev': - ensure => installed, - } - - package { 'libnl-dev': - ensure => installed, - } - - package { 'pkg-config': - ensure => installed, - } - - package { 'bison': - ensure => installed, - } - - package { 'flex': - ensure => installed, - } - - package { 'libyajl2': - ensure => installed, - } - - package { 'libyajl-dev': - ensure => installed, - } - - package { 'bc': - ensure => installed, - } - - package { 'python-dev': - ensure => installed, - } - - package { 'numactl': - ensure => installed, - } - - package { 'libdbus-1-dev': - ensure => installed, - } - - package { 'libnuma1': - ensure => installed, - } - - package { 'libnuma-dev': - ensure => installed, - } - - package { 'libgnutls26': - ensure => installed, - } - - package { 'libgnutls-dev': - ensure => installed, - } + package { 'zlib1g-dev': ensure => 'installed' } + package { 'libglib2.0-dev': ensure => 'installed' } + package { 'libxml2-dev': ensure => 'installed' } + package { 'libdevmapper-dev': ensure => 'installed' } + package { 'libpciaccess-dev': ensure => 'installed' } + package { 'libnl-dev': ensure => 'installed' } + package { 'pkg-config': ensure => 'installed' } + package { 'bison': ensure => 'installed' } + package { 'flex': ensure => 'installed' } + package { 'libyajl2': ensure => 'installed' } + package { 'libyajl-dev': ensure => 'installed' } + package { 'python-dev': ensure => 'installed' } + package { 'numactl': ensure => 'installed' } + package { 'libdbus-1-dev': ensure => 'installed' } + package { 'libnuma1': ensure => 'installed' } + package { 'libnuma-dev': ensure => 'installed' } + package { 'libgnutls26': ensure => 'installed' } + package { 'libgnutls-dev': ensure => 'installed' } + + package { 'bc': ensure => 'installed' } exec {'build qemu': command => "true && cd /opt/code/qemu && ./configure --enable-kvm --target-list=x86_64-softmmu && make && make install", user => root, path => ['/usr/bin','/bin'], - require => [ Package['flex'], Package['bison'], Package['pkg-config'], Package['libnl-dev'], Package['libpciaccess-dev'], Package['libdevmapper-dev'], Package['libxml2-dev'], Package['libglib2.0-dev'], Package['zlib1g-dev'], Package['numactl'], Package['python-dev'],Package['libdbus-1-dev'],Package['bc'],Package['libnuma1'], Package['libnuma-dev'] , Package['libgnutls26'], Package['libgnutls-dev']], + require => [ Package['flex'], Package['bison'], Package['pkg-config'], Package['libnl-dev'], + Package['libpciaccess-dev'], Package['libdevmapper-dev'], Package['libxml2-dev'], + Package['libglib2.0-dev'], Package['zlib1g-dev'], Package['numactl'], Package['python-dev'], + Package['libdbus-1-dev'],Package['bc'],Package['libnuma1'], Package['libnuma-dev'], + Package['libgnutls26'], Package['libgnutls-dev']], timeout => 0, } @@ -163,16 +101,14 @@ class ovsdpdk::install_ovs_dpdk ( user => root, onlyif => 'test -f /etc/init.d/libvirtd', } -#exec {'init ovs-dpdk': -#command => '/etc/init.d/ovs-dpdk init', -#user => root, -#require => [ Exec['create_ovs_dpdk'], File['/etc/default/ovs-dpdk'] ], -#} + + # schema convert required as we are not removing original db exec { "ovsdb-tool convert /etc/openvswitch/conf.db ${ovs_dir}/vswitchd/vswitch.ovsschema": path => ['/usr/bin','/bin'], user => root, } + # patching of linux_net.py is required for removing error when setting of MTU exec { 'patch linux_net': command => "cp ${plugin_dir}/files/linux_net.py /usr/lib/python2.7/dist-packages/nova/network/linux_net.py", path => ['/usr/bin','/bin'], diff --git a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/postinstall_ovs_dpdk.pp b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/postinstall_ovs_dpdk.pp index a3fd60f..12230c6 100755 --- a/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/postinstall_ovs_dpdk.pp +++ b/fuel-plugin-ovsnfv/deployment_scripts/puppet/modules/ovsdpdk/manifests/postinstall_ovs_dpdk.pp @@ -16,6 +16,7 @@ class ovsdpdk::postinstall_ovs_dpdk ( package {'crudini': ensure => installed } + # compute node specific changes if $compute == 'True' { # adapt configuration files exec {'adapt_nova_conf': @@ -27,10 +28,18 @@ class ovsdpdk::postinstall_ovs_dpdk ( } exec {'adapt_ml2_conf_datapath': - command => "sudo crudini --set ${ml2_ovs_conf} ovs datapath_type ${ovs_datapath_type}", + command => "sudo crudini --set ${ml2_conf} ovs datapath_type ${ovs_datapath_type}", path => ['/usr/bin','/bin'], user => root, - onlyif => "test -f ${ml2_ovs_conf}", + onlyif => "test -f ${ml2_conf}", + require => Package['crudini'], + } + + exec {'adapt_ml2_conf_agent_type': + command => "sudo crudini --set ${ml2_conf} agent agent_type 'DPDK OVS Agent'", + path => ['/usr/bin','/bin'], + user => root, + onlyif => "test -f ${ml2_conf}", require => Package['crudini'], } @@ -53,7 +62,8 @@ class ovsdpdk::postinstall_ovs_dpdk ( require => Service["${openvswitch_service_name}"], } - exec { "${plugin_dir}/files/configure_bridges.sh ${ovs_datapath_type}": + exec {'configure_bridges': + command => "${plugin_dir}/files/configure_bridges.sh ${ovs_datapath_type}", user => root, require => Exec['restart_ovs'], } @@ -73,39 +83,36 @@ class ovsdpdk::postinstall_ovs_dpdk ( user => root, require => [ Exec['libvirtd_disable_tls'], Service['libvirtd'] ], } - } - exec {'adapt_ml2_conf_mechanism_driver': - command => "sudo crudini --set ${ml2_conf} ml2 mechanism_drivers ovsdpdk", - path => ['/usr/bin','/bin'], - user => root, - onlyif => "test -f ${ml2_conf}", - require => Package['crudini'], - } + service {"${openvswitch_agent}": + ensure => 'running', + require => [ Exec['restart_ovs'], Service["${openvswitch_service_name}"], Exec['adapt_ml2_conf_datapath'], Exec['adapt_ml2_conf_agent_type'] ], + } - exec {'adapt_ml2_conf_security_group': - command => "sudo crudini --set ${ml2_conf} securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver", - path => ['/usr/bin','/bin'], - user => root, - onlyif => "test -f ${ml2_conf}", - require => Package['crudini'], + exec { "ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=${ovs_pmd_core_mask}": + path => ['/usr/bin','/bin'], + user => root, + require => Service["${openvswitch_agent}"], + } } + # controller specific part if $controller == 'True' { service {'neutron-server': ensure => 'running', } exec {'append_NUMATopologyFilter': - command => "sudo crudini --set ${nova_conf} DEFAULT scheduler_default_filters RetryFilter,AvailabilityZoneFilter,RamFilter,CoreFilter,DiskFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,NUMATopologyFilter", + command => "sudo crudini --set ${nova_conf} DEFAULT scheduler_default_filters RetryFilter,AvailabilityZoneFilter,RamFilter,\ +CoreFilter,DiskFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,NUMATopologyFilter", path => ['/usr/bin','/bin'], user => root, onlyif => "test -f ${nova_conf}", require => Package['crudini'], } - exec { 'remove_old_agent': - command => "${plugin_dir}/files/remove_agent.sh $adminrc_user $adminrc_password $adminrc_tenant $adminrc_hostname", + exec { 'agents_flavors_update': + command => "${plugin_dir}/files/agents_flavors_update.sh", user => 'root', logoutput => 'true', timeout => 0, @@ -115,34 +122,31 @@ class ovsdpdk::postinstall_ovs_dpdk ( exec {'restart_neutron_server': command => "/usr/sbin/service neutron-server restart", user => root, - require => Exec['remove_old_agent'], + require => Exec['agents_flavors_update'], } exec {'restart_nova_scheduler': command => "/usr/sbin/service nova-scheduler restart", user => root, - require => Exec['remove_old_agent'], + require => Exec['agents_flavors_update'], } } - if $compute == 'True' { - exec { 'patch_ovs_agent': - command => "cp ${plugin_dir}/files/neutron-plugin-openvswitch-agent.conf /etc/init/neutron-plugin-openvswitch-agent.conf", - path => ['/usr/bin','/bin'], - user => root, - } - - service {"${openvswitch_agent}": - ensure => 'running', - require => [ Exec['restart_ovs'], Service["${openvswitch_service_name}"], Exec['patch_ovs_agent'] ], - } - - exec { "ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=${ovs_pmd_core_mask}": - path => ['/usr/bin','/bin'], - user => root, - require => Service["${openvswitch_agent}"], - } + # common part + exec {'adapt_ml2_conf_mechanism_driver': + command => "sudo crudini --set ${ml2_conf} ml2 mechanism_drivers ovsdpdk", + path => ['/usr/bin','/bin'], + user => root, + onlyif => "test -f ${ml2_conf}", + require => Package['crudini'], } + exec {'adapt_ml2_conf_security_group': + command => "sudo crudini --set ${ml2_conf} securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver", + path => ['/usr/bin','/bin'], + user => root, + onlyif => "test -f ${ml2_conf}", + require => Package['crudini'], + } } -- cgit 1.2.3-korg