fuel plugin: Initial version
[ovsnfv.git] / fuel-plugin-ovsnfv / deployment_scripts / puppet / modules / ovsdpdk / manifests / install_ovs_dpdk.pp
1 # == Class ovsdpdk::install_ovs_dpdk
2 #
3 # Installs ovs-dpdk service together with it's configuration file
4 # it also deploys qemu-kvm wrapper responsible for enabling some vhostforce
5 # options and setting huge pages into shared mode
6 #
7 class ovsdpdk::install_ovs_dpdk (
8   $networking_ovs_dpdk_dir          = $::ovsdpdk::params::networking_ovs_dpdk_dir,
9   $plugin_dir                       = $::ovsdpdk::params::plugin_dir,
10   $openvswitch_service_file         = $::ovsdpdk::params::openvswitch_service_file,
11   $openvswitch_service_path         = $::ovsdpdk::params::openvswitch_service_path,
12   $qemu_kvm                         = $::ovsdpdk::params::qemu_kvm,
13 ) inherits ovsdpdk {
14   require ovsdpdk::build_ovs_dpdk
15
16   if $compute == 'True' {
17           exec {'create_ovs_dpdk':
18             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",
19             user    => root,
20             path    => ['/usr/bin','/bin'],
21           }
22
23           file {'/etc/default/ovs-dpdk': content => template("${plugin_dir}/files/ovs-dpdk-conf.erb"), mode => '0644' }
24
25           exec {'adapt_conf_file':
26             command => "${plugin_dir}/files/tune_params.sh",
27             user    => root,
28             require => File['/etc/default/ovs-dpdk'],
29           }
30
31 #         exec { 'update ovs service':
32 #           command => "cp ${plugin_dir}/files/${openvswitch_service_file} ${openvswitch_service_path}/${openvswitch_service_file}",
33 #           path    => ['/usr/bin','/bin'],
34 #           user    => root,
35 #           onlyif  => "test -f ${openvswitch_service_path}/${openvswitch_service_file}",
36 #         }
37
38           if $::operatingsystem == 'CentOS' {
39             exec { 'systemctl daemon-reload':
40               path    => ['/usr/bin','/bin','/usr/sbin'],
41               user    => root,
42               require => Exec['update ovs service'],
43             }
44           }
45
46           package {'qemu-kvm': ensure => installed }
47
48           exec { "cp ${qemu_kvm} ${qemu_kvm}.orig":
49             path    => ['/usr/bin','/bin'],
50             user    => root,
51             onlyif  => "test -f ${qemu_kvm}",
52             require => Package['qemu-kvm'],
53           }
54
55           exec { "cp ${plugin_dir}/files/kvm-wrapper.sh ${qemu_kvm};chmod +x ${qemu_kvm}":
56             path    => ['/usr/bin','/bin'],
57             user    => root,
58             onlyif  => "test -f ${qemu_kvm}",
59             require => [ Exec["cp ${qemu_kvm} ${qemu_kvm}.orig"], Package['qemu-kvm'] ],
60           }
61
62 #exec {'init ovs-dpdk':
63 #command => '/etc/init.d/ovs-dpdk init',
64 #user    => root,
65 #require => [ Exec['create_ovs_dpdk'], File['/etc/default/ovs-dpdk'] ],
66 #}
67   }
68
69   # install mech driver
70   exec {'install mech driver':
71     command => 'python setup.py install',
72     path    => ['/usr/bin','/bin'],
73     cwd     => "${networking_ovs_dpdk_dir}",
74     user    => root,
75   }
76 }