Skip to content

Commit

Permalink
Fix the paths and manifest for centos
Browse files Browse the repository at this point in the history
Closes-Bug: #1349803

Change-Id: I02ddc53299f7e855fb3b4df6eae42b138b3c4b06
  • Loading branch information
thilakrajs committed Oct 20, 2014
1 parent 61f44fd commit be7ef97
Show file tree
Hide file tree
Showing 11 changed files with 274 additions and 187 deletions.
9 changes: 0 additions & 9 deletions contrail/files/haproxy.cfg
Expand Up @@ -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


2 changes: 1 addition & 1 deletion contrail/files/setup_verify_quantum_in_keystone.py
Expand Up @@ -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)
Expand Down
41 changes: 26 additions & 15 deletions contrail/files/update_dev_net_config_files.py
Expand Up @@ -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

Expand Down
25 changes: 19 additions & 6 deletions contrail/manifests/contrail_collector.pp
Expand Up @@ -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':
Expand Down
64 changes: 34 additions & 30 deletions contrail/manifests/contrail_common.pp
Expand Up @@ -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"]
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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") {
Expand All @@ -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}

Expand All @@ -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" :
Expand All @@ -238,7 +239,7 @@
unless => "grep -qx contrail-status-$state /etc/contrail/contrail_common_exec.out",
logoutput => "true"
}

*/

}
define contrail_setup_gid($group_gid ) {
Expand Down Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions contrail/manifests/contrail_compute.pp
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit be7ef97

Please sign in to comment.