diff --git a/contrail/files/haproxy.cfg b/contrail/files/haproxy.cfg index 1995d9dc..bd4e189a 100644 --- a/contrail/files/haproxy.cfg +++ b/contrail/files/haproxy.cfg @@ -77,12 +77,3 @@ listen appli5-backup 0.0.0.0:10005 #errorloc 502 http://192.168.114.58/error502.html #errorfile 503 /etc/haproxy/errors/503.http - errorfile 400 /etc/haproxy/errors/400.http - errorfile 403 /etc/haproxy/errors/403.http - errorfile 408 /etc/haproxy/errors/408.http - errorfile 500 /etc/haproxy/errors/500.http - errorfile 502 /etc/haproxy/errors/502.http - errorfile 503 /etc/haproxy/errors/503.http - errorfile 504 /etc/haproxy/errors/504.http - - diff --git a/contrail/files/setup_verify_quantum_in_keystone.py b/contrail/files/setup_verify_quantum_in_keystone.py index 5ee461e2..14ff6ef1 100755 --- a/contrail/files/setup_verify_quantum_in_keystone.py +++ b/contrail/files/setup_verify_quantum_in_keystone.py @@ -8,7 +8,7 @@ def setup_quantum(contrail_openstack_ip, contrail_config_ip, contrail_ks_admin_tenant, contrail_ks_admin_user, contrail_ks_admin_passwd, contrail_service_token, contrail_region_name): - cmd = "python /opt/contrail/bin/setup-quantum-in-keystone --ks_server_ip %s --quant_server_ip %s --tenant %s --user %s --password %s --svc_password %s --region_name %s" %(contrail_openstack_ip, contrail_config_ip, contrail_ks_admin_tenant, contrail_ks_admin_user, contrail_ks_admin_passwd, contrail_service_token, contrail_region_name) + cmd = "/opt/contrail/bin/setup-quantum-in-keystone --ks_server_ip %s --quant_server_ip %s --tenant %s --user %s --password %s --svc_password %s --region_name %s" %(contrail_openstack_ip, contrail_config_ip, contrail_ks_admin_tenant, contrail_ks_admin_user, contrail_ks_admin_passwd, contrail_service_token, contrail_region_name) ret,output = commands.getstatusoutput(cmd) if (ret): sys.exit(-1) diff --git a/contrail/files/update_dev_net_config_files.py b/contrail/files/update_dev_net_config_files.py index 93615b29..5ed6bcda 100644 --- a/contrail/files/update_dev_net_config_files.py +++ b/contrail/files/update_dev_net_config_files.py @@ -15,37 +15,48 @@ def find_gateway(dev): gateway = '' cmd = "netstat -rn | grep ^\"0.0.0.0\" | grep %s | awk '{ print $2 }'" % \ dev - gateway = subprocess.check_output(cmd, shell=True).strip() - return gateway + status,result = commands.getstatusoutput(cmd) + if status == 0: + return result + else: + return "" # end find_gateway def get_dns_servers(dev): cmd = "grep \"^nameserver\\>\" /etc/resolv.conf | awk '{print $2}'" - dns_list = subprocess.check_output(cmd, shell=True) - return dns_list.split() + status,result = commands.getstatusoutput(cmd) + if status == 0: + return result.split() + else: + return "" + # end get_dns_servers def get_domain_search_list(): domain_list = '' cmd = "grep ^\"search\" /etc/resolv.conf | awk '{$1=\"\";print $0}'" - domain_list = subprocess.check_output(cmd, shell=True).strip() - if not domain_list: + status,result = commands.getstatusoutput(cmd) + if status == 0: + return result + else: cmd = "grep ^\"domain\" /etc/resolv.conf | awk '{$1=\"\"; print $0}'" - domain_list = subprocess.check_output(cmd, shell=True).strip() - return domain_list - + status,result = commands.getstatusoutput(cmd) + if status == 0: + return result + else: + return "" def get_if_mtu(dev): cmd = "ifconfig %s | grep mtu | awk '{ print $NF }'" % dev - mtu = subprocess.check_output(cmd, shell=True).strip() - if not mtu: - # for debian + result,status = commands.getstatusoutput(cmd) + if not status: + # for debian cmd = "ifconfig %s | grep MTU | sed 's/.*MTU.\([0-9]\+\).*/\1/g'" % dev - mtu = subprocess.check_output(cmd, shell=True).strip() - if mtu and mtu != '1500': - return mtu + result,status = commands.getstatusoutput(cmd) + if result and result != '1500': + return result return '' # end if_mtu diff --git a/contrail/manifests/contrail_collector.pp b/contrail/manifests/contrail_collector.pp index cc62f175..e3c90170 100644 --- a/contrail/manifests/contrail_collector.pp +++ b/contrail/manifests/contrail_collector.pp @@ -73,12 +73,25 @@ # Below is temporary to work-around in Ubuntu as Service resource fails # as upstart is not correctly linked to /etc/init.d/service-name - exec { "redis-conf-exec": - command => "sed -i -e '/^[ ]*bind/s/^/#/' /etc/redis/redis.conf;chkconfig redis-server on; service redis-server restart && echo redis-conf-exec>> /etc/contrail/contrail-collector-exec.out", - onlyif => "test -f /etc/redis/redis.conf", - unless => "grep -qx redis-conf-exec /etc/contrail/contrail-collector-exec.out", - provider => shell, - logoutput => "true" + #TODO - Use puppet service resource instead of calling server * restart + if ($operatingsystem == "Ubuntu") { + + exec { "redis-conf-exec": + command => "sed -i -e '/^[ ]*bind/s/^/#/' /etc/redis/redis.conf;chkconfig redis-server on; service redis-server restart && echo redis-conf-exec>> /etc/contrail/contrail-collector-exec.out", + onlyif => "test -f /etc/redis/redis.conf", + unless => "grep -qx redis-conf-exec /etc/contrail/contrail-collector-exec.out", + provider => shell, + logoutput => "true" + } + } else { + exec { "redis-conf-exec": + command => "sed -i -e '/^[ ]*bind/s/^/#/' /etc/redis.conf;chkconfig redis on; service redis restart && echo redis-conf-exec>> /etc/contrail/contrail-collector-exec.out", + onlyif => "test -f /etc/redis.conf", + unless => "grep -qx redis-conf-exec /etc/contrail/contrail-collector-exec.out", + provider => shell, + logoutput => "true" + } + } if ($operatingsystem == "Ubuntu") { file { '/etc/init.d/supervisor-analytics': diff --git a/contrail/manifests/contrail_common.pp b/contrail/manifests/contrail_common.pp index 7bb7c4f3..c417dc80 100644 --- a/contrail/manifests/contrail_common.pp +++ b/contrail/manifests/contrail_common.pp @@ -59,7 +59,7 @@ source => "puppet:///modules/$module_name/$server_id.cfg" } exec { "haproxy-exec": - command => "sudo sed -i 's/ENABLED=.*/ENABLED=1/g' /etc/default/haproxy", + command => "sed -i 's/ENABLED=.*/ENABLED=1/g' /etc/default/haproxy", provider => shell, logoutput => "true", require => File["/etc/haproxy/haproxy.cfg"] @@ -92,7 +92,7 @@ $contrail_zk_ip_list_for_shell = inline_template('<%= zk_ip_list.map{ |ip| "#{ip}" }.join(" ") %>') - exec { "setup-config-zk-files-setup" : + exec { "setup-config-zk-files-setup" : command => "/bin/bash /etc/contrail/contrail_setup_utils/config-zk-files-setup.sh $operatingsystem $zk_index $contrail_zk_ip_list_for_shell && echo setup-config-zk-files-setup >> /etc/contrail/contrail_config_exec.out", require => File["/etc/contrail/contrail_setup_utils/config-zk-files-setup.sh"], unless => "grep -qx setup-config-zk-files-setup /etc/contrail/contrail_config_exec.out", @@ -182,7 +182,7 @@ if ($operatingsystem == "Centos" or $operatingsystem == "Fedora") { file { "/etc/yum.repos.d/cobbler-config.repo" : ensure => present, - content => template("contrail-common/contrail-yum-repo.erb") + content => template("$module_name/contrail-yum-repo.erb") } } if ($operatingsystem == "Ubuntu") { @@ -201,16 +201,17 @@ define contrail-install-repo( $contrail_repo_type ) { - if($contrail_repo_type == "contrail-ubuntu-package") { - $setup_script = "./setup.sh && echo exec-contrail-setup-$contrail_repo_type-sh >> exec-contrail-setup-sh.out" - $package_name = "contrail-install-packages" - } elsif ($contrail_repo_type == "contrail-centos-repo") { - $setup_script = "./setup.sh && echo exec-contrail-setup-$contrail_repo_type-sh >> exec-contrail-setup-sh.out" - $package_name = "contrail-install-packages" - } elsif ($contrail_repo_type == "contrail-ubuntu-stroage-repo") { - $setup_script = "./setup_storage.sh && echo exec-contrail-setup-$contrail_repo_type-sh >> exec-contrail-setup-sh.out" - $package_name = "contrail-storage" - } + + if($contrail_repo_type == "contrail-ubuntu-package") { + $setup_script = "./setup.sh && echo exec-contrail-setup-$contrail_repo_type-sh >> exec-contrail-setup-sh.out" + $package_name = "contrail-install-packages" + } elsif ($contrail_repo_type == "contrail-centos-package") { + $setup_script = "./setup.sh && echo exec-contrail-setup-$contrail_repo_type-sh >> exec-contrail-setup-sh.out" + $package_name = "contrail-install-packages" + } elsif ($contrail_repo_type == "contrail-ubuntu-stroage-repo") { + $setup_script = "./setup_storage.sh && echo exec-contrail-setup-$contrail_repo_type-sh >> exec-contrail-setup-sh.out" + $package_name = "contrail-storage" + } package {$package_name: ensure => present} @@ -225,10 +226,10 @@ } define report_status($state) { - if ! defined(Package['curl']) { - package { 'curl' : ensure => present,} - - +/* + if ! defined(Package['curl']) { + package { 'curl' : ensure => present,} + } } exec { "contrail-status-$state" : @@ -238,7 +239,7 @@ unless => "grep -qx contrail-status-$state /etc/contrail/contrail_common_exec.out", logoutput => "true" } - +*/ } define contrail_setup_gid($group_gid ) { @@ -267,19 +268,22 @@ } define contrail_setup_users_groups() { - $contrail_groups_details = { - 'nova' => { group_gid => '499' }, - 'libvirtd' => { group_gid => '498' }, - 'kvm' => { group_gid => '497' }, - } - - $contrail_users_details = { - 'nova' => { user_uid => '499', user_group_name => 'nova', user_home_dir => '/var/lib/nova' }, - 'libvirt-qemu' => { user_uid => '498', user_group_name => 'kvm' , user_home_dir => '/var/lib/libvirt'}, - 'libvirt-dnsmasq' => { user_uid => '497', user_group_name => 'libvirtd' , user_home_dir => '/var/lib/libvirt/dnsmasq'}, + if ($operatingsystem == "Ubuntu") { + + $contrail_groups_details = { + 'nova' => { group_gid => '499' }, + 'libvirtd' => { group_gid => '498' }, + 'kvm' => { group_gid => '497' }, + } + + $contrail_users_details = { + 'nova' => { user_uid => '499', user_group_name => 'nova', user_home_dir => '/var/lib/nova' }, + 'libvirt-qemu' => { user_uid => '498', user_group_name => 'kvm' , user_home_dir => '/var/lib/libvirt'}, + 'libvirt-dnsmasq' => { user_uid => '497', user_group_name => 'libvirtd' , user_home_dir => '/var/lib/libvirt/dnsmasq'}, + } + create_resources(__$VERSION__::Contrail_common::Contrail_setup_uid, $contrail_users_details, {}) + create_resources(__$VERSION__::Contrail_common::Contrail_setup_gid, $contrail_groups_details, {}) } - create_resources(__$VERSION__::Contrail_common::Contrail_setup_uid, $contrail_users_details, {}) - create_resources(__$VERSION__::Contrail_common::Contrail_setup_gid, $contrail_groups_details, {}) } # macro to perform common functions diff --git a/contrail/manifests/contrail_compute.pp b/contrail/manifests/contrail_compute.pp index f34badc8..147855f0 100644 --- a/contrail/manifests/contrail_compute.pp +++ b/contrail/manifests/contrail_compute.pp @@ -337,6 +337,11 @@ $contrail_gway = $contrail_gateway } + if ($operatingsystem == "Ubuntu") { + $contrail_kmod = "vrouter" + } elsif ($operatingsystem == "Centos") { + $contrail_kmod = "/lib/modules/2.6.32-358.el6.x86_64/extra/net/vrouter/vrouter.ko" + } # Ensure all config files with correct content are present. compute-template-scripts { ["default_pmac", "agent_param.tmpl", @@ -523,6 +528,16 @@ } } elsif ($contrail_interface_rename_done == "1") { + + + exec{"check_service": + command => '/bin/bash -c "service rabbitmq-server restart"', + onlyif => "test -f /etc/rabbitmq/rabbitmq.config", + provider => shell, + logoutput => "true", + cwd => "/etc/contrail/" + } + -> contrail_compute_part_2 { contrail_compute_2 : contrail_config_ip => $contrail_config_ip, contrail_compute_ip => $contrail_compute_ip, diff --git a/contrail/manifests/contrail_config.pp b/contrail/manifests/contrail_config.pp index a7535e0c..f231e8dd 100644 --- a/contrail/manifests/contrail_config.pp +++ b/contrail/manifests/contrail_config.pp @@ -23,11 +23,39 @@ file { "/etc/contrail/${title}" : ensure => present, require => Package["contrail-openstack-config"], - notify => Service["supervisor-config"], + notify => Service["supervisor-config"], content => template("$module_name/${title}.erb"), } } +define setup-haproxy { + if ! defined(File["/etc/haproxy/haproxy.cfg"]) { + file { "/etc/haproxy/haproxy.cfg": + ensure => present, + mode => 0755, + owner => root, + group => root, + source => "puppet:///modules/$module_name/$hostname.cfg" + } + if ($operatingsystem == "Ubuntu") { + + exec { "haproxy-exec": + command => "sudo sed -i 's/ENABLED=.*/ENABLED=1/g' /etc/default/haproxy && echo haproxy-exec >> /etc/contrail/contrail_config_exec.out", + require => File["/etc/haproxy/haproxy.cfg"], + unless => "grep -qx haproxy-exec /etc/contrail/contrail_config_exec.out", + provider => shell, + logoutput => "true" + } + } + service { "haproxy" : + enable => true, + subscribe => File["/etc/haproxy/haproxy.cfg"], + ensure => running + } + } + +} + # Main module code # Following variables need to be set for this resource. # Those specified with value assiged are optional, if not @@ -109,30 +137,9 @@ # java-1.7.0-openjdk, haproxy, rabbitmq-server, python-bottle, contrail-nodemgr # enable haproxy in haproxy config file for ubuntu. + setup-haproxy {"setup_haproxy":} if ($operatingsystem == "Ubuntu") { - if ! defined(File["/etc/haproxy/haproxy.cfg"]) { - file { "/etc/haproxy/haproxy.cfg": - ensure => present, - mode => 0755, - owner => root, - group => root, - source => "puppet:///modules/$module_name/$hostname.cfg" - } - exec { "haproxy-exec": - command => "sudo sed -i 's/ENABLED=.*/ENABLED=1/g' /etc/default/haproxy && echo haproxy-exec >> /etc/contrail/contrail_config_exec.out", - require => File["/etc/haproxy/haproxy.cfg"], - unless => "grep -qx haproxy-exec /etc/contrail/contrail_config_exec.out", - provider => shell, - logoutput => "true" - } - service { "haproxy" : - enable => true, - subscribe => File['/etc/haproxy/haproxy.cfg'], - ensure => running - } - } - file {"/etc/init/supervisor-config.override": ensure => absent, require => Package['contrail-openstack-config']} file {"/etc/init/neutron-server.override": ensure => absent, require => Package['contrail-openstack-config']} } @@ -176,7 +183,7 @@ if ! defined(Exec["neutron-conf-exec"]) { exec { "neutron-conf-exec": - command => "sudo sed -i 's/rpc_backend\s*=\s*neutron.openstack.common.rpc.impl_qpid/#rpc_backend = neutron.openstack.common.rpc.impl_qpid/g' /etc/neutron/neutron.conf && echo neutron-conf-exec >> /etc/contrail/contrail_openstack_exec.out", + command => "sed -i 's/rpc_backend\s*=\s*neutron.openstack.common.rpc.impl_qpid/#rpc_backend = neutron.openstack.common.rpc.impl_qpid/g' /etc/neutron/neutron.conf && echo neutron-conf-exec >> /etc/contrail/contrail_openstack_exec.out", onlyif => "test -f /etc/neutron/neutron.conf", unless => "grep -qx neutron-conf-exec /etc/contrail/contrail_openstack_exec.out", provider => shell, @@ -186,7 +193,7 @@ if ! defined(Exec["quantum-conf-exec"]) { exec { "quantum-conf-exec": - command => "sudo sed -i 's/rpc_backend\s*=\s*quantum.openstack.common.rpc.impl_qpid/#rpc_backend = quantum.openstack.common.rpc.impl_qpid/g' /etc/quantum/quantum.conf && echo quantum-conf-exec >> /etc/contrail/contrail_openstack_exec.out", + command => "sed -i 's/rpc_backend\s*=\s*quantum.openstack.common.rpc.impl_qpid/#rpc_backend = quantum.openstack.common.rpc.impl_qpid/g' /etc/quantum/quantum.conf && echo quantum-conf-exec >> /etc/contrail/contrail_openstack_exec.out", onlyif => "test -f /etc/quantum/quantum.conf", unless => "grep -qx quantum-conf-exec /etc/contrail/contrail_openstack_exec.out", provider => shell, @@ -202,32 +209,64 @@ #} # Ensure log4j.properties file is present with right content. - file { "/etc/ifmap-server/log4j.properties" : - ensure => present, - require => Package["contrail-openstack-config"], - content => template("$module_name/log4j.properties.erb"), - } - # Ensure authorization.properties file is present with right content. - file { "/etc/ifmap-server/authorization.properties" : - ensure => present, - require => Package["contrail-openstack-config"], - content => template("$module_name/authorization.properties.erb"), - } - # Ensure basicauthusers.proprties file is present with right content. - file { "/etc/ifmap-server/basicauthusers.properties" : - ensure => present, - require => Package["contrail-openstack-config"], - content => template("$module_name/basicauthusers.properties.erb"), - } - # Ensure publisher.properties file is present with right content. - file { "/etc/ifmap-server/publisher.properties" : - ensure => present, - require => Package["contrail-openstack-config"], - content => template("$module_name/publisher.properties.erb"), - } + if ( $operatingsystem == "Ubuntu" ) { + + file { "/etc/ifmap-server/log4j.properties" : + ensure => present, + require => Package["contrail-openstack-config"], + content => template("$module_name/log4j.properties.erb"), + } + + # Ensure authorization.properties file is present with right content. + file { "/etc/ifmap-server/authorization.properties" : + ensure => present, + require => Package["contrail-openstack-config"], + content => template("$module_name/authorization.properties.erb"), + } + + # Ensure basicauthusers.proprties file is present with right content. + file { "/etc/ifmap-server/basicauthusers.properties" : + ensure => present, + require => Package["contrail-openstack-config"], + content => template("$module_name/basicauthusers.properties.erb"), + } + + # Ensure publisher.properties file is present with right content. + file { "/etc/ifmap-server/publisher.properties" : + ensure => present, + require => Package["contrail-openstack-config"], + content => template("$module_name/publisher.properties.erb"), + } + + } elsif ( $operatingsystem == "Centos" ) { + file { "/etc/ifmap-server/log4j.properties" : + ensure => present, + require => Package["contrail-openstack-config"], + content => template("$module_name/log4j.properties.erb"), + } + + # Ensure authorization.properties file is present with right content. + file { "/etc/ifmap-server/authorization.properties" : + ensure => present, + require => Package["contrail-openstack-config"], + content => template("$module_name/authorization.properties.erb"), + } + + file { "/etc/ifmap-server/basicauthusers.properties" : + ensure => present, + require => Package["contrail-openstack-config"], + content => template("$module_name/basicauthusers.properties.erb"), + } + # Ensure publisher.properties file is present with right content. + file { "/etc/ifmap-server/publisher.properties" : + ensure => present, + require => Package["contrail-openstack-config"], + content => template("$module_name/publisher.properties.erb"), + } +} # Ensure all config files with correct content are present. config-template-scripts { ["contrail-api.conf", @@ -239,19 +278,10 @@ # Supervisor contrail-api.ini $contrail_api_port_base = '910' - if ($operatingsystem == "Ubuntu") { - file { "/etc/contrail/supervisord_config_files/contrail-api.ini" : - ensure => present, - require => Package["contrail-openstack-config"], - content => template("$module_name/contrail-api.ini.erb"), - } - } - else { - file { "/etc/contrail/supervisord_config_files/contrail-api.ini" : - ensure => present, - require => Package["contrail-openstack-config"], - content => template("$module_name/contrail-api-centos.ini.erb"), - } + file { "/etc/contrail/supervisord_config_files/contrail-api.ini" : + ensure => present, + require => Package["contrail-openstack-config"], + content => template("$module_name/contrail-api.ini.erb"), } # initd script wrapper for contrail-api @@ -280,19 +310,10 @@ # Supervisor contrail-discovery.ini $contrail_disc_port_base = '911' $contrail_disc_nworkers = '1' - if ($operatingsystem == "Ubuntu") { - file { "/etc/contrail/supervisord_config_files/contrail-discovery.ini" : - ensure => present, - require => Package["contrail-openstack-config"], - content => template("$module_name/contrail-discovery.ini.erb"), - } - } - else { - file { "/etc/contrail/supervisord_config_files/contrail-discovery.ini" : - ensure => present, - require => Package["contrail-openstack-config"], - content => template("$module_name/contrail-discovery-centos.ini.erb"), - } + file { "/etc/contrail/supervisord_config_files/contrail-discovery.ini" : + ensure => present, + require => Package["contrail-openstack-config"], + content => template("$module_name/contrail-discovery.ini.erb"), } # initd script wrapper for contrail-discovery @@ -482,7 +503,7 @@ } - Exec["haproxy-exec"]->Exec["exec-cfg-rabbitmq"]->Exec["setup-rabbitmq-cluster"]->Exec["check-rabbitmq-cluster"]->Config-scripts["config-server-setup"]->Config-scripts["quantum-server-setup"]->Exec["setup-verify-quantum-in-keystone"]->Exec["config-neutron-server"]->Exec["provision-metadata-services"]->Exec["provision-encap-type"]->Exec["exec-provision-control"]->Exec["provision-external-bgp"] + Setup-haproxy["setup_haproxy"]->Exec["exec-cfg-rabbitmq"]->Exec["setup-rabbitmq-cluster"]->Exec["check-rabbitmq-cluster"]->Config-scripts["config-server-setup"]->Config-scripts["quantum-server-setup"]->Exec["setup-verify-quantum-in-keystone"]->Exec["config-neutron-server"]->Exec["provision-metadata-services"]->Exec["provision-encap-type"]->Exec["exec-provision-control"]->Exec["provision-external-bgp"] # Below is temporary to work-around in Ubuntu as Service resource fails # as upstart is not correctly linked to /etc/init.d/service-name diff --git a/contrail/manifests/contrail_control.pp b/contrail/manifests/contrail_control.pp index 4507ed9b..7ca44fe4 100644 --- a/contrail/manifests/contrail_control.pp +++ b/contrail/manifests/contrail_control.pp @@ -93,7 +93,7 @@ # update rndc conf exec { "update-rndc-conf-file" : - command => "sudo sed -i 's/secret \"secret123\"/secret \"xvysmOR8lnUQRBcunkC6vg==\"/g' /etc/contrail/dns/rndc.conf && echo update-rndc-conf-file >> /etc/contrail/contrail_control_exec.out", + command => "sed -i 's/secret \"secret123\"/secret \"xvysmOR8lnUQRBcunkC6vg==\"/g' /etc/contrail/dns/rndc.conf && echo update-rndc-conf-file >> /etc/contrail/contrail_control_exec.out", require => package["contrail-openstack-control"], onlyif => "test -f /etc/contrail/dns/rndc.conf", unless => "grep -qx update-rndc-conf-file /etc/contrail/contrail_control_exec.out", diff --git a/contrail/manifests/contrail_openstack.pp b/contrail/manifests/contrail_openstack.pp index 1dacc8dd..f65a7c54 100644 --- a/contrail/manifests/contrail_openstack.pp +++ b/contrail/manifests/contrail_openstack.pp @@ -17,6 +17,53 @@ } } +define setup-keystone-2 { +# repeat keystone setup (workaround for now) Needs to be fixed .. Abhay + if ($operatingsystem == "Ubuntu") { + exec { "setup-keystone-server-2setup" : + command => "/opt/contrail/bin/keystone-server-setup.sh $operatingsystem && echo setup-keystone-server-2setup >> /etc/contrail/contrail_openstack_exec.out", + require => [ File["/opt/contrail/bin/keystone-server-setup.sh"], + File["/etc/contrail/ctrl-details"], + Openstack-scripts['nova-server-setup'] ], + unless => "grep -qx setup-keystone-server-2setup /etc/contrail/contrail_openstack_exec.out", + provider => shell, + logoutput => "true", + before => Service['mysqld'] + } +# Below is temporary to work-around in Ubuntu as Service resource fails +# as upstart is not correctly linked to /etc/init.d/service-name + file { '/etc/init.d/mysqld': + ensure => link, + target => '/lib/init/upstart-job', + before => Service["mysqld"] + } + file { '/etc/init.d/openstack-keystone': + ensure => link, + target => '/lib/init/upstart-job', + before => Service["openstack-keystone"] + } + } + +} + +define setup-keystone-service { + if ($operatingsystem == "Ubuntu") { + service { "openstack-keystone" : + enable => true, + require => [ Package['contrail-openstack'], + Openstack-scripts["nova-server-setup"] ], + ensure => running, + } + + } else { + service { "keystone" : + enable => true, + require => [ Package['contrail-openstack'], + Openstack-scripts["nova-server-setup"] ], + ensure => running, + } + } +} # Following variables need to be set for this resource. # Those specified with value assiged are optional, if not # set the assigned value below is used. @@ -62,7 +109,7 @@ if ($operatingsystem == "Centos" or $operatingsystem == "Fedora") { exec { "dashboard-local-settings-1" : - command => "sudo sed -i 's/ALLOWED_HOSTS =/#ALLOWED_HOSTS =/g' /etc/openstack_dashboard/local_settings && echo dashboard-local-settings-1 >> /etc/contrail/contrail_openstack_exec.out", + command => "sed -i 's/ALLOWED_HOSTS =/#ALLOWED_HOSTS =/g' /etc/openstack_dashboard/local_settings && echo dashboard-local-settings-1 >> /etc/contrail/contrail_openstack_exec.out", require => package["contrail-openstack"], onlyif => "test -f /etc/openstack_dashboard/local_settings", unless => "grep -qx dashboard-local-settings-1 /etc/contrail/contrail_openstack_exec.out", @@ -70,7 +117,7 @@ logoutput => 'true' } exec { "dashboard-local-settings-2" : - command => "sudo sed -i 's/ALLOWED_HOSTS =/#ALLOWED_HOSTS =/g' /etc/openstack-dashboard/local_settings && echo dashboard-local-settings-2 >> /etc/contrail/contrail_openstack_exec.out", + command => "sed -i 's/ALLOWED_HOSTS =/#ALLOWED_HOSTS =/g' /etc/openstack-dashboard/local_settings && echo dashboard-local-settings-2 >> /etc/contrail/contrail_openstack_exec.out", require => package["contrail-openstack"], onlyif => "test -f /etc/openstack-dashboard/local_settings", unless => "grep -qx dashboard-local-settings-2 /etc/contrail/contrail_openstack_exec.out", @@ -83,7 +130,7 @@ $line1="HORIZON_CONFIG[\'customization_module\']=\'contrail_openstack_dashboard.overrides\'" exec { "dashboard-local-settings-3" : - command => "sudo sed -i '/HORIZON_CONFIG.*customization_module.*/d' /etc/openstack-dashboard/local_settings.py && echo \"$line1\" >> /etc/openstack-dashboard/local_settings.py && echo dashboard-local-settings-3 >> /etc/contrail/contrail_openstack_exec.out", + command => "sed -i '/HORIZON_CONFIG.*customization_module.*/d' /etc/openstack-dashboard/local_settings.py && echo \"$line1\" >> /etc/openstack-dashboard/local_settings.py && echo dashboard-local-settings-3 >> /etc/contrail/contrail_openstack_exec.out", require => package["contrail-openstack"], onlyif => "test -f /etc/openstack-dashboard/local_settings.py", unless => "grep -qx dashboard-local-settings-3 /etc/contrail/contrail_openstack_exec.out", @@ -94,7 +141,7 @@ $line2="LOGOUT_URL=\'/horizon/auth/logout/\'" exec { "dashboard-local-settings-4" : - command => "sudo sed -i '/LOGOUT_URL.*/d' /etc/openstack-dashboard/local_settings.py && echo \"$line2\" >> /etc/openstack-dashboard/local_settings.py && service apache2 restart && echo dashboard-local-settings-4 >> /etc/contrail/contrail_openstack_exec.out", + command => "sed -i '/LOGOUT_URL.*/d' /etc/openstack-dashboard/local_settings.py && echo \"$line2\" >> /etc/openstack-dashboard/local_settings.py && service apache2 restart && echo dashboard-local-settings-4 >> /etc/contrail/contrail_openstack_exec.out", require => package["contrail-openstack"], onlyif => "test -f /etc/openstack-dashboard/local_settings.py", unless => "grep -qx dashboard-local-settings-4 /etc/contrail/contrail_openstack_exec.out", @@ -104,7 +151,7 @@ } if ($operatingsystem == "Centos") { exec { "dashboard-local-settings-3" : - command => "sudo sed -i '/HORIZON_CONFIG.*customization_module.*/d' /etc/openstack-dashboard/local_settings && echo HORIZON_CONFIG['customization_module'] = 'contrail_openstack_dashboard.overrides' >> etc/openstack-dashboard/local_settings && echo dashboard-local-settings-3 >> /etc/contrail/contrail_openstack_exec.out", + command => "echo dashboard-local-settings-3 >> /etc/contrail/contrail_openstack_exec.out", require => package["contrail-openstack"], onlyif => "test -f /etc/openstack-dashboard/local_settings", unless => "grep -qx dashboard-local-settings-3 /etc/contrail/contrail_openstack_exec.out", @@ -113,7 +160,7 @@ } exec { "dashboard-local-settings-4" : - command => "sudo sed -i '/LOGOUT_URL.*/d' etc/openstack-dashboard/local_settings && echo LOGOUT_URL='/horizon/auth/logout/' >> etc/openstack-dashboard/local_settings && service httpd restart && echo dashboard-local-settings-4 >> /etc/contrail/contrail_openstack_exec.out", + command => "echo dashboard-local-settings-4 >> /etc/contrail/contrail_openstack_exec.out", require => package["contrail-openstack"], onlyif => "test -f /etc/openstack-dashboard/local_settings", unless => "grep -qx dashboard-local-settings-4 /etc/contrail/contrail_openstack_exec.out", @@ -123,7 +170,7 @@ } exec { "update-nova-conf-file" : - command => "sudo sed -i 's/rpc_backend = nova.openstack.common.rpc.impl_qpid/#rpc_backend = nova.openstack.common.rpc.impl_qpid/g' /etc/nova/nova.conf && echo update-nova-conf-file >> /etc/contrail/contrail_openstack_exec.out", + command => "sed -i 's/rpc_backend = nova.openstack.common.rpc.impl_qpid/#rpc_backend = nova.openstack.common.rpc.impl_qpid/g' /etc/nova/nova.conf && echo update-nova-conf-file >> /etc/contrail/contrail_openstack_exec.out", require => package["contrail-openstack"], onlyif => "test -f /etc/nova/nova.conf", unless => "grep -qx update-nova-conf-file /etc/contrail/contrail_openstack_exec.out", @@ -133,7 +180,7 @@ ##Chhandak Added this section to update nova.conf with corect rabit_host ip exec { "update-nova-conf-file1" : - #command => "sudo sed -i 's/#rabbit_host\s*=\s*127.0.0.1/rabbit_host = $contrail_amqp_server_ip/g' /etc/nova/nova.conf && echo update-nova-conf-file1 >> /etc/contrail/contrail_openstack_exec.out", + #command => "sed -i 's/#rabbit_host\s*=\s*127.0.0.1/rabbit_host = $contrail_amqp_server_ip/g' /etc/nova/nova.conf && echo update-nova-conf-file1 >> /etc/contrail/contrail_openstack_exec.out", command => "openstack-config --set /etc/nova/nova.conf DEFAULT rabbit_host $contrail_amqp_server_ip && echo update-nova-conf-file1 >> /etc/contrail/contrail_openstack_exec.out", require => package["contrail-openstack"], onlyif => "test -f /etc/nova/nova.conf", @@ -154,7 +201,7 @@ } exec { "update-cinder-conf-file" : - command => "sudo sed -i 's/rpc_backend = cinder.openstack.common.rpc.impl_qpid/#rpc_backend = cinder.openstack.common.rpc.impl_qpid/g' /etc/cinder/cinder.conf && echo update-cinder-conf-file >> /etc/contrail/contrail_openstack_exec.out", + command => "sed -i 's/rpc_backend = cinder.openstack.common.rpc.impl_qpid/#rpc_backend = cinder.openstack.common.rpc.impl_qpid/g' /etc/cinder/cinder.conf && echo update-cinder-conf-file >> /etc/contrail/contrail_openstack_exec.out", require => package["contrail-openstack"], onlyif => "test -f /etc/cinder/cinder.conf", unless => "grep -qx update-cinder-conf-file /etc/contrail/contrail_openstack_exec.out", @@ -232,7 +279,7 @@ if ! defined(Exec["neutron-conf-exec"]) { exec { "neutron-conf-exec": - command => "sudo sed -i 's/rpc_backend\s*=\s*neutron.openstack.common.rpc.impl_qpid/#rpc_backend = neutron.openstack.common.rpc.impl_qpid/g' /etc/neutron/neutron.conf && echo neutron-conf-exec >> /etc/contrail/contrail_openstack_exec.out", + command => "sed -i 's/rpc_backend\s*=\s*neutron.openstack.common.rpc.impl_qpid/#rpc_backend = neutron.openstack.common.rpc.impl_qpid/g' /etc/neutron/neutron.conf && echo neutron-conf-exec >> /etc/contrail/contrail_openstack_exec.out", onlyif => "test -f /etc/neutron/neutron.conf", unless => "grep -qx neutron-conf-exec /etc/contrail/contrail_openstack_exec.out", provider => shell, @@ -242,7 +289,7 @@ if ! defined(Exec["quantum-conf-exec"]) { exec { "quantum-conf-exec": - command => "sudo sed -i 's/rpc_backend\s*=\s*quantum.openstack.common.rpc.impl_qpid/#rpc_backend = quantum.openstack.common.rpc.impl_qpid/g' /etc/quantum/quantum.conf && echo quantum-conf-exec >> /etc/contrail/contrail_openstack_exec.out", + command => "sed -i 's/rpc_backend\s*=\s*quantum.openstack.common.rpc.impl_qpid/#rpc_backend = quantum.openstack.common.rpc.impl_qpid/g' /etc/quantum/quantum.conf && echo quantum-conf-exec >> /etc/contrail/contrail_openstack_exec.out", onlyif => "test -f /etc/quantum/quantum.conf", unless => "grep -qx quantum-conf-exec /etc/contrail/contrail_openstack_exec.out", provider => shell, @@ -262,7 +309,7 @@ source => "puppet:///modules/$module_name/$hostname.cfg" } exec { "haproxy-exec": - command => "sudo sed -i 's/ENABLED=.*/ENABLED=1/g' /etc/default/haproxy;", + command => "sed -i 's/ENABLED=.*/ENABLED=1/g' /etc/default/haproxy;", provider => shell, logoutput => "true", require => File["/etc/haproxy/haproxy.cfg"] @@ -275,34 +322,10 @@ } } - # repeat keystone setup (workaround for now) Needs to be fixed .. Abhay - if ($operatingsystem == "Ubuntu") { - exec { "setup-keystone-server-2setup" : - command => "/opt/contrail/bin/keystone-server-setup.sh $operatingsystem && echo setup-keystone-server-2setup >> /etc/contrail/contrail_openstack_exec.out", - require => [ File["/opt/contrail/bin/keystone-server-setup.sh"], - File["/etc/contrail/ctrl-details"], - Openstack-scripts['nova-server-setup'] ], - unless => "grep -qx setup-keystone-server-2setup /etc/contrail/contrail_openstack_exec.out", - provider => shell, - logoutput => "true", - before => Service['mysqld'] - } -# Below is temporary to work-around in Ubuntu as Service resource fails -# as upstart is not correctly linked to /etc/init.d/service-name - file { '/etc/init.d/mysqld': - ensure => link, - target => '/lib/init/upstart-job', - before => Service["mysqld"] - } - file { '/etc/init.d/openstack-keystone': - ensure => link, - target => '/lib/init/upstart-job', - before => Service["openstack-keystone"] - } - } - ##Chhandak Added this section to update /etc/mysql/my.cnf to remove bind address + setup-keystone-2 {"setup_keystone_2":} + exec { "update-mysql-file1" : - command => "sudo sed -i -e 's/bind-address/#bind-address/g' /etc/mysql/my.cnf && echo update-mysql-file1 >> /etc/contrail/contrail_openstack_exec.out", + command => "sed -i -e 's/bind-address/#bind-address/g' /etc/mysql/my.cnf && echo update-mysql-file1 >> /etc/contrail/contrail_openstack_exec.out", require => package["contrail-openstack"], onlyif => "test -f /etc/mysql/my.cnf", unless => "grep -qx update-mysql-file1 /etc/contrail/contrail_openstack_exec.out", @@ -324,19 +347,17 @@ ensure => running, } - service { "openstack-keystone" : - enable => true, - require => [ Package['contrail-openstack'], - Openstack-scripts["nova-server-setup"] ], - ensure => running, - } + + setup-keystone-service {"setup_keystone_service":} service { "memcached" : enable => true, ensure => running, } -> __$version__::contrail_common::report_status {"openstack_completed": state => "openstack_completed"} - Package['contrail-openstack']->File['/etc/contrail/contrail_setup_utils/api-paste.sh']->Exec['exec-api-paste']->Exec['exec-openstack-qpid-rabbitmq-hostname']->File["/etc/contrail/ctrl-details"]->File["/etc/contrail/service.token"]->Openstack-scripts["keystone-server-setup"]->Openstack-scripts["glance-server-setup"]->Openstack-scripts["cinder-server-setup"]->Openstack-scripts["nova-server-setup"]->Exec['setup-keystone-server-2setup']->Service['openstack-keystone']->Service['mysqld']->Service['memcached']->Exec['neutron-conf-exec']->Exec['dashboard-local-settings-3']->Exec['dashboard-local-settings-4']->Exec['restart-supervisor-openstack'] + + Package['contrail-openstack']->File['/etc/contrail/contrail_setup_utils/api-paste.sh']->Exec['exec-api-paste']->Exec['exec-openstack-qpid-rabbitmq-hostname']->File["/etc/contrail/ctrl-details"]->File["/etc/contrail/service.token"]->Openstack-scripts["keystone-server-setup"]->Openstack-scripts["glance-server-setup"]->Openstack-scripts["cinder-server-setup"]->Openstack-scripts["nova-server-setup"]->Setup-keystone-2["setup_keystone_2"]->Setup-keystone-service['setup_keystone_service']->Service['mysqld']->Service['memcached']->Exec['neutron-conf-exec']->Exec['dashboard-local-settings-3']->Exec['dashboard-local-settings-4']->Exec['restart-supervisor-openstack'] + } # end of user defined type contrail_openstack. diff --git a/contrail/templates/agent_param.tmpl.erb b/contrail/templates/agent_param.tmpl.erb index aa243292..98bcda86 100644 --- a/contrail/templates/agent_param.tmpl.erb +++ b/contrail/templates/agent_param.tmpl.erb @@ -1,9 +1,9 @@ LOG=/var/log/contrail.log CONFIG=/etc/contrail/agent.conf -prog=/usr/bin/vnswad -kmod=vrouter +prog=/usr/bin/contrail-vrouter-agent +kmod=<%= contrail_kmod %> -pname=vnswad +pname=contrail-vrouter-agent LIBDIR=/usr/lib64 DEVICE=vhost0 dev=__DEVICE__ diff --git a/contrail/templates/config.global.js.erb b/contrail/templates/config.global.js.erb index c7a11276..a58438b6 100644 --- a/contrail/templates/config.global.js.erb +++ b/contrail/templates/config.global.js.erb @@ -137,6 +137,7 @@ config.analytics.ca = ''; /* Discovery Service */ config.discoveryService = {}; +config.discoveryService.server_ip = '127.0.0.1'; config.discoveryService.server_port = '5998'; /* Specifiy true if subscription to discovery server should be enabled, else * specify false. Other than true/false value here is treated as true @@ -152,6 +153,11 @@ config.jobServer.server_port = '3000'; config.files = {}; config.files.download_path = '/tmp'; +/* Redis Server */ +config.redis = {}; +config.redis.server_port = '6379'; +config.redis.server_ip = '127.0.0.1'; + /* Cassandra Server */ config.cassandra = {}; config.cassandra.server_ips = [<%= contrail_cassandra_ip_list.map{ |ip| "\"#{ip}\"" }.join(',') %>]; @@ -195,8 +201,13 @@ config.redis_server_port = '6379'; config.redis_server_ip = '127.0.0.1'; config.redis_dump_file = '/var/lib/redis/dump-webui.rdb'; +/* Cache Expiry Time */ +config.cacheExpire = {}; +config.cacheExpire.flow_stat_time = 600; /* Seconds */ +config.cacheExpire.topo_tree_time = 600; /* Seconds */ + /* Logo File: Use complete path of logo file location */ -config.logo_file = '/usr/src/contrail/contrail-web-core/webroot/img/juniper-networks-logo.png'; +config.logo_file = '/usr/src/contrail/contrail-web-core/webroot/img/opencontrail-logo.png'; config.featurePkg = {}; /* Add new feature Package Config details below */