fuel-plugins: Fuel8 Liberty rebase
[ovsnfv.git] / fuel-plugin-ovsnfv / deployment_scripts / puppet / modules / ovsdpdk / manifests / postinstall_ovs_dpdk.pp
1 # == Class ovsdpdk::postinstall_ovs_dpdk
2 #
3 # Postinstall configuration of ovs-dpdk service
4 #
5 class ovsdpdk::postinstall_ovs_dpdk (
6   $plugin_dir               = $::ovsdpdk::params::plugin_dir,
7   $nova_conf                = $::ovsdpdk::params::nova_conf,
8   $openvswitch_service_name = $::ovsdpdk::params::openvswitch_service_name,
9   $ml2_conf                 = $::ovsdpdk::params::ml2_conf,
10   $ml2_ovs_conf             = $::ovsdpdk::params::ml2_ovs_conf,
11   $neutron_l3_conf          = $::ovsdpdk::params::neutron_l3_conf,
12   $openvswitch_agent        = $::ovsdpdk::params::openvswitch_agent,
13 ) inherits ovsdpdk {
14
15   require ovsdpdk::install_ovs_dpdk
16
17   package {'crudini': ensure => installed }
18
19   # compute node specific changes
20   if $compute == 'True' {
21     # adapt configuration files
22     exec {'adapt_nova_conf':
23       command => "${plugin_dir}/files/set_vcpu_pin.sh ${nova_conf}",
24       path    => ['/usr/bin','/bin'],
25       user    => root,
26       onlyif  => "test -f ${nova_conf}",
27       require => Package['crudini'],
28     }
29
30     exec {'adapt_ml2_conf_datapath':
31       command => "sudo crudini --set ${ml2_conf} ovs datapath_type ${ovs_datapath_type}",
32       path    => ['/usr/bin','/bin'],
33       user    => root,
34       onlyif  => "test -f ${ml2_conf}",
35       require => Package['crudini'],
36     }
37
38     exec {'adapt_ml2_conf_agent_type':
39       command => "sudo crudini --set ${ml2_conf} agent agent_type 'DPDK OVS Agent'",
40       path    => ['/usr/bin','/bin'],
41       user    => root,
42       onlyif  => "test -f ${ml2_conf}",
43       require => Package['crudini'],
44     }
45
46     exec {'adapt_neutron_l3':
47       command => "sudo crudini --set ${neutron_l3_conf} DEFAULT external_network_bridge br-ex",
48       path    => ['/usr/bin','/bin'],
49       user    => root,
50       onlyif  => "test -f ${neutron_l3_conf}",
51       require => Package['crudini'],
52     }
53
54
55     service {"${openvswitch_service_name}": ensure => 'running' }
56
57     # restart OVS to synchronize ovsdb-server with ovs-vswitchd needed
58     # due to several new --no-wait entries
59     exec {'restart_ovs':
60       command => "/usr/sbin/service ${openvswitch_service_name} restart",
61       user    => root,
62       require => Service["${openvswitch_service_name}"],
63     }
64
65     exec {'configure_bridges':
66       command => "${plugin_dir}/files/configure_bridges.sh ${ovs_datapath_type}",
67       user    => root,
68       require => Exec['restart_ovs'],
69     }
70
71     service { 'libvirtd': ensure => running }
72
73     exec {'libvirtd_disable_tls':
74       command => "sudo crudini --set /etc/libvirt/libvirtd.conf '' listen_tls 0",
75       path    => ['/usr/bin','/bin'],
76       user    => root,
77       require => Package['crudini'],
78       notify  => Service['libvirtd'],
79     }
80
81     exec {'restart_nova_compute':
82       command => "/usr/sbin/service nova-compute restart",
83       user    => root,
84       require => [ Exec['libvirtd_disable_tls'], Service['libvirtd'] ],
85     }
86
87     service {"${openvswitch_agent}":
88       ensure  => 'running',
89       require => [ Exec['restart_ovs'], Service["${openvswitch_service_name}"], Exec['adapt_ml2_conf_datapath'], Exec['adapt_ml2_conf_agent_type']  ],
90     }
91
92     exec { "ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=${ovs_pmd_core_mask}":
93       path    => ['/usr/bin','/bin'],
94       user    => root,
95       require => Service["${openvswitch_agent}"],
96     }
97   }
98
99   # controller specific part
100   if $controller == 'True' {
101     service {'neutron-server':
102       ensure => 'running',
103     }
104
105     exec {'append_NUMATopologyFilter':
106       command => "sudo crudini --set ${nova_conf} DEFAULT scheduler_default_filters RetryFilter,AvailabilityZoneFilter,RamFilter,\
107 CoreFilter,DiskFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,NUMATopologyFilter",
108       path    => ['/usr/bin','/bin'],
109       user    => root,
110       onlyif  => "test -f ${nova_conf}",
111       require => Package['crudini'],
112     }
113
114     exec { 'agents_flavors_update':
115       command => "${plugin_dir}/files/agents_flavors_update.sh",
116       user      => 'root',
117       logoutput => 'true',
118       timeout   => 0,
119       require   => [ Service['neutron-server'], Exec['append_NUMATopologyFilter'] ],
120     }
121
122     exec {'restart_neutron_server':
123       command => "/usr/sbin/service neutron-server restart",
124       user    => root,
125       require => Exec['agents_flavors_update'],
126     }
127
128     exec {'restart_nova_scheduler':
129       command => "/usr/sbin/service nova-scheduler restart",
130       user    => root,
131       require => Exec['agents_flavors_update'],
132     }
133
134   }
135
136   # common part
137   exec {'adapt_ml2_conf_mechanism_driver':
138     command => "sudo crudini --set ${ml2_conf} ml2 mechanism_drivers ovsdpdk",
139     path    => ['/usr/bin','/bin'],
140     user    => root,
141     onlyif  => "test -f ${ml2_conf}",
142     require => Package['crudini'],
143   }
144
145   exec {'adapt_ml2_conf_security_group':
146     command => "sudo crudini --set ${ml2_conf} securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver",
147     path    => ['/usr/bin','/bin'],
148     user    => root,
149     onlyif  => "test -f ${ml2_conf}",
150     require => Package['crudini'],
151   }
152 }