1 # Copyright (c) 2016 Open Platform for NFV Project, Inc. and its contributors
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # == Class ovsdpdk::postinstall_ovs_dpdk
17 # Postinstall configuration of ovs-dpdk service
19 class ovsdpdk::postinstall_ovs_dpdk (
20 $plugin_dir = $::ovsdpdk::params::plugin_dir,
21 $nova_conf = $::ovsdpdk::params::nova_conf,
22 $openvswitch_service_name = $::ovsdpdk::params::openvswitch_service_name,
23 $ml2_conf = $::ovsdpdk::params::ml2_conf,
24 $ml2_ovs_conf = $::ovsdpdk::params::ml2_ovs_conf,
25 $neutron_l3_conf = $::ovsdpdk::params::neutron_l3_conf,
26 $openvswitch_agent = $::ovsdpdk::params::openvswitch_agent,
29 require ovsdpdk::install_ovs_dpdk
31 package {'crudini': ensure => installed }
33 # compute node specific changes
34 if $compute == 'True' {
35 # adapt configuration files
36 exec {'adapt_nova_conf':
37 command => "${plugin_dir}/files/set_vcpu_pin.sh ${nova_conf}",
38 path => ['/usr/bin','/bin'],
40 onlyif => "test -f ${nova_conf}",
41 require => Package['crudini'],
44 exec {'adapt_ml2_conf_datapath':
45 command => "sudo crudini --set ${ml2_conf} ovs datapath_type ${ovs_datapath_type}",
46 path => ['/usr/bin','/bin'],
48 onlyif => "test -f ${ml2_conf}",
49 require => Package['crudini'],
52 exec {'adapt_ml2_conf_agent_type':
53 command => "sudo crudini --set ${ml2_conf} agent agent_type 'DPDK OVS Agent'",
54 path => ['/usr/bin','/bin'],
56 onlyif => "test -f ${ml2_conf}",
57 require => Package['crudini'],
60 exec {'adapt_neutron_l3':
61 command => "sudo crudini --set ${neutron_l3_conf} DEFAULT external_network_bridge br-ex",
62 path => ['/usr/bin','/bin'],
64 onlyif => "test -f ${neutron_l3_conf}",
65 require => Package['crudini'],
69 service {"${openvswitch_service_name}": ensure => 'running' }
71 # restart OVS to synchronize ovsdb-server with ovs-vswitchd needed
72 # due to several new --no-wait entries
74 command => "/usr/sbin/service ${openvswitch_service_name} restart",
76 require => Service["${openvswitch_service_name}"],
79 exec {'configure_bridges':
80 command => "${plugin_dir}/files/configure_bridges.sh ${ovs_datapath_type}",
82 require => Exec['restart_ovs'],
85 service { 'libvirtd': ensure => running }
87 exec {'libvirtd_disable_tls':
88 command => "sudo crudini --set /etc/libvirt/libvirtd.conf '' listen_tls 0",
89 path => ['/usr/bin','/bin'],
91 require => Package['crudini'],
92 notify => Service['libvirtd'],
95 exec {'restart_nova_compute':
96 command => "/usr/sbin/service nova-compute restart",
98 require => [ Exec['libvirtd_disable_tls'], Service['libvirtd'] ],
101 service {"${openvswitch_agent}":
103 require => [ Exec['restart_ovs'], Service["${openvswitch_service_name}"], Exec['adapt_ml2_conf_datapath'], Exec['adapt_ml2_conf_agent_type'] ],
106 exec { "ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=${ovs_pmd_core_mask}":
107 path => ['/usr/bin','/bin'],
109 require => Service["${openvswitch_agent}"],
113 # controller specific part
114 if $controller == 'True' {
115 service {'neutron-server':
119 exec {'append_NUMATopologyFilter':
120 command => "sudo crudini --set ${nova_conf} DEFAULT scheduler_default_filters RetryFilter,AvailabilityZoneFilter,RamFilter,\
121 CoreFilter,DiskFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,NUMATopologyFilter",
122 path => ['/usr/bin','/bin'],
124 onlyif => "test -f ${nova_conf}",
125 require => Package['crudini'],
128 exec { 'agents_flavors_update':
129 command => "${plugin_dir}/files/agents_flavors_update.sh",
133 require => [ Service['neutron-server'], Exec['append_NUMATopologyFilter'] ],
136 exec {'restart_neutron_server':
137 command => "/usr/sbin/service neutron-server restart",
139 require => Exec['agents_flavors_update'],
142 exec {'restart_nova_scheduler':
143 command => "/usr/sbin/service nova-scheduler restart",
145 require => Exec['agents_flavors_update'],
151 exec {'adapt_ml2_conf_mechanism_driver':
152 command => "sudo crudini --set ${ml2_conf} ml2 mechanism_drivers ovsdpdk",
153 path => ['/usr/bin','/bin'],
155 onlyif => "test -f ${ml2_conf}",
156 require => Package['crudini'],
159 exec {'adapt_ml2_conf_security_group':
160 command => "sudo crudini --set ${ml2_conf} securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver",
161 path => ['/usr/bin','/bin'],
163 onlyif => "test -f ${ml2_conf}",
164 require => Package['crudini'],