Skip to content

Commit

Permalink
Merging below commits from R2.1
Browse files Browse the repository at this point in the history
4648977 (HEAD, merge_5) Server Manager: provision complete status is lost when compute role is present Closes-Bug: #1424870
2f9356b Server Manager: provision complete status is lost when compute role is present Closes-Bug: #1424870
74c49e8 Server Manager: external_vip Partial-Bug: #1423179
b23de15 Partial-Bug: #1413364 Server Manager HA, configuration for mysql, nova , haproxy were different from fab provisioning
b28a286 Closes-Bug: #1413364
7f67138 Partial-Bug: #1413364
6ce4a85 Partial-Bug: #1413364
681e420 Closes-Bug: #1416585 Fixing multi interface related code changes for 1415585.
c7e800c Closes-Bug: #1413364 Server Manager HA, configuration for mysql, nova , haproxy were different from fab provisioning
c3278ea Closes-Bug: #1417411 Server Manager: Remove keystone-auth.conf for config server, untill multi-tenancy is enabled
5b179d3 Closes-Bug: #1413365 server manager HA , rabbitmq clustering should happen on control interface
0d3522f Partial-Bug: #1416585     Changes to clean up parameter list passed to puppet modules and document." into R2.1
847e258 Closes-Bug: #1416354 Provisioning External router is not happening through server-manager
d4a9b95 Closes-Bug: #1412757 Not able to login to WebUI
c191800 Partial-Bug: #1397496 Server Manager changes to make use of new structure puppet modules for contrail and openstack (from puppet-labs)."
	into R2.1"
8bc7246 Closes-Bug: #1415787 Nova is not able to connect to AMQP server
5290115 Partial-Bug: #1397496 Server Manager changes to make use of new structure puppet modules for contrail and openstack (from puppet-labs)."
	into R2.1
ae53bf4 Closes-bug: #1413361 server manager HA , supervisor is not starting contrail-api service when it is down.
60d20eb Partial: #1413364 server manager HA , configuration for mysql ,nova , haproxy were different from fab provisioning.
7478e72 Partial-Bug: #1397496 Server Manager changes to make use of new structure puppet modules for contrail and openstack (from puppet-labs)."
	into R2.1
95f4b05 Partial-Bug: #1397496   Server Manager changes to make use of new   structure puppet modules for contrail and openstack (from
	puppet-labs)." into R2.1
700dd4c Partial-Bug: #1397496   Server Manager changes to make use of new   structure puppet modules for contrail and openstack (from
	puppet-labs)." into R2.1
292b0ba Partial-Bug: #1397496   Server Manager changes to make use of new   structure puppet modules for contrail and openstack (from
	puppet-labs)." into R2.1
b797518 Partial-Bug: #1397496   Server Manager changes to make use of new structure puppet modules for contrail and openstack (from
	puppet-labs).

Change-Id: If3f4512e9fb2aa4cc7ad99239d4011ee9838db6d
  • Loading branch information
thilakrajs committed Feb 26, 2015
1 parent 1f5b951 commit 2e3b091
Show file tree
Hide file tree
Showing 52 changed files with 1,644 additions and 480 deletions.
28 changes: 21 additions & 7 deletions contrail/environment/modules/cinder/manifests/api.pp
Expand Up @@ -124,15 +124,29 @@
if $enabled {

Cinder_config<||> ~> Exec['cinder-manage db_sync']
$sync_db = $::contrail::params::sync_db

exec { 'cinder-manage db_sync':
command => $::cinder::params::db_sync_command,
path => '/usr/bin',
user => 'cinder',
refreshonly => true,
logoutput => 'on_failure',
require => Package['cinder'],
if ($sync_db)
{
exec { 'cinder-manage db_sync':
command => $::cinder::params::db_sync_command,
path => '/usr/bin',
user => 'cinder',
refreshonly => true,
logoutput => 'on_failure',
require => Package['cinder'],
}
} else {
exec { 'cinder-manage db_sync':
command => "touch /tmp/cinder_db_sync.1",
path => '/usr/bin',
user => 'cinder',
refreshonly => true,
logoutput => 'on_failure',
require => Package['cinder'],
}
}

if $manage_service {
$ensure = 'running'
}
Expand Down
27 changes: 20 additions & 7 deletions contrail/environment/modules/cinder/manifests/db/sync.pp
Expand Up @@ -2,13 +2,26 @@
class cinder::db::sync {

include cinder::params
$sync_db = $::contrail::params::sync_db

exec { 'cinder-manage db_sync':
command => $::cinder::params::db_sync_command,
path => '/usr/bin',
user => 'cinder',
refreshonly => true,
require => [File[$::cinder::params::cinder_conf], Class['cinder']],
logoutput => 'on_failure',

if( $sync_db) {
exec { 'cinder-manage db_sync':
command => $::cinder::params::db_sync_command,
path => '/usr/bin',
user => 'cinder',
refreshonly => true,
require => [File[$::cinder::params::cinder_conf], Class['cinder']],
logoutput => 'on_failure',
}
} else {
exec { 'cinder-manage db_sync':
command => "touch /tmp/cinder_db_sync",
path => '/usr/bin',
user => 'cinder',
refreshonly => true,
require => [File[$::cinder::params::cinder_conf], Class['cinder']],
logoutput => 'on_failure',
}
}
}
27 changes: 27 additions & 0 deletions contrail/environment/modules/contrail/files/add_etc_host.py
@@ -0,0 +1,27 @@
#!/usr/bin/python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import sys
import argparse
import ConfigParser
import commands
import itertools
import paramiko
import sys, getopt, string
import os, stat
from stat import S_ISDIR

def main(args_str=None):
config_ip_list_str = sys.argv[1]
config_name_list_str = sys.argv[2]

config_ip_list = config_ip_list_str.split(",")
config_name_list = config_name_list_str.split(",")

for config_name, config_ip in zip(config_name_list, config_ip_list):
status, output = commands.getstatusoutput("echo '%s %sctl' >> /etc/hosts" %(config_ip, config_name))

if __name__ == "__main__":
main(sys.argv[1:])

35 changes: 35 additions & 0 deletions contrail/environment/modules/contrail/files/add_reserved_ports.py
@@ -0,0 +1,35 @@
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import commands
import sys



def main(args_str=None):

ports_str = sys.argv[1]

status, output = commands.getstatusoutput("cat /proc/sys/net/ipv4/ip_local_reserved_ports")
if status != 0:
sys.exit(-1)
else:
existing_ports = output

status, output = commands.getstatusoutput("sysctl -w net.ipv4.ip_local_reserved_ports=%s,%s" % (ports_str, existing_ports))

if status != 0:
sys.exit(-1)

status, output = commands.getstatusoutput("grep '^net.ipv4.ip_local_reserved_ports' /etc/sysctl.conf > /dev/null 2>&1")


if status != 0:
status, output = commands.getstatusoutput('echo "net.ipv4.ip_local_reserved_ports = %s" >> /etc/sysctl.conf' % ports_str)
else:
status, output = commands.getstatusoutput("sed -i 's/net.ipv4.ip_local_reserved_ports\s*=\s*/net.ipv4.ip_local_reserved_ports=%s,/' /etc/sysctl.conf" % ports_str)

if status != 0:
sys.exit(-1)

if __name__ == "__main__":
main(sys.argv[1:])
23 changes: 23 additions & 0 deletions contrail/environment/modules/contrail/files/check-mysql-status.py
@@ -0,0 +1,23 @@
import commands
import sys
import os.path

def main(args_str=None):

status,output = commands.getstatusoutput("cat /etc/contrail/mysql.token")
mysql_token = output
status,output = commands.getstatusoutput('service mysql status')

# if status != 0:
# sys.exit(0)

# If we are not able to connect to mysql,its probably stucik , kill it!
status,output = commands.getstatusoutput('mysql -uroot -p%s -e "show status like \'wsrep_cluster_size\'"' % mysql_token )
print "wsrep_cluster_size: %s" % output
#if output.find("4") == -1:
if status != 0:
status,output = commands.getstatusoutput('pkill -9 mysql')

if __name__ == "__main__":
main(sys.argv[1:])

@@ -1,6 +1,6 @@
import commands
import sys

import os.path

def main(args_str=None):
openstack_ip_list_str = sys.argv[1]
Expand All @@ -22,6 +22,16 @@ def main(args_str=None):
print "wsrep_cluster_size: %s" % output
#if output.find("4") == -1:
if output.find(str(number_openstack_nodes)) == -1:
uuid, output = commands.getstatusoutput("cat /var/lib/mysql/grastate.dat | grep uuid | awk '{print $2;}'")
commands.getstatusoutput("service mysql restart")

for os_ip in os_ip_list:
# if not os.path.exists("/etc/clear_mysql"):
status,output = commands.getstatusoutput('ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null %s "rm -rf /var/lib/mysql/grastate.dat"' % (os_ip))
status,output = commands.getstatusoutput('ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null %s "service mysql restart"' % (os_ip))
print "cleaning mysql in %s" % (output)
open("/etc/clear_mysql", 'a').close()

sys.exit(1)
if __name__ == "__main__":
main(sys.argv[1:])
Expand Down
7 changes: 7 additions & 0 deletions contrail/environment/modules/contrail/files/contrail_sudoers
@@ -0,0 +1,7 @@

Defaults:contrail !requiretty

Cmnd_Alias CONFIGRESTART = /usr/sbin/service supervisor-config restart

contrail ALL = (root) NOPASSWD:CONFIGRESTART

Expand Up @@ -7,15 +7,6 @@
import paramiko
import os.path

def create_ssh_keys():
if not os.path.isfile('/root/.ssh/id_rsa') and not os.path.isfile('/root/.ssh/id_rsa.pub'):
commands.getstatusoutput('ssh-keygen -b 2048 -t rsa -f /root/.ssh/id_rsa -q -N ""')
elif not os.path.isfile('/root/.ssh/id_rsa') or not os.path.isfile('/root/.ssh/id_rsa.pub'):
commands.getstatusoutput('rm -rf /root/.ssh/id_rsa*')
commands.getstatusoutput('ssh-keygen -b 2048 -t rsa -f /root/.ssh/id_rsa -q -N ""')



def main(args_str=None):
compute_host_list_str = sys.argv[1]
config_host_list_str = sys.argv[2]
Expand All @@ -31,31 +22,14 @@ def main(args_str=None):

computes = 'COMPUTES=("' + '" "'.join(compute_host_list) + '")'
commands.getstatusoutput("echo '%s' >> %s" % (computes, cmon_param))
commands.getstatusoutput("echo 'COMPUTES_SIZE=%s' >> %s" % (compute_sz, cmon_param))
commands.getstatusoutput("echo 'COMPUTES_SIZE=%s' >> %s" % ("${#COMPUTES[@]}", cmon_param))
commands.getstatusoutput("echo 'COMPUTES_USER=root' >> %s" % cmon_param)
commands.getstatusoutput("echo 'PERIODIC_RMQ_CHK_INTER=60' >> %s" % cmon_param)
commands.getstatusoutput("echo 'RABBITMQ_RESET=True' >> %s" % cmon_param)
amqps = 'DIPHOSTS=("' + '" "'.join(amqp_host_list) + '")'
commands.getstatusoutput("echo '%s' >> %s" % (amqps, cmon_param))
commands.getstatusoutput("echo 'DIPS_HOST_SIZE=%s' >> %s" % (amqp_sz, cmon_param))

commands.getstatusoutput("echo 'DIPS_HOST_SIZE=%s' >> %s" % ("${#DIPHOSTS[@]}", cmon_param))

#Copy the ssh keys of openstack to every compute
create_ssh_keys()
status,output = commands.getstatusoutput("cat /root/.ssh/id_rsa.pub")
publick_key = output
port = 22
username = "root"
password = "c0ntrail123"
for compute_host in compute_host_list:
s = paramiko.SSHClient()
s.load_system_host_keys()
s.set_missing_host_key_policy(paramiko.AutoAddPolicy())
s.connect(compute_host, port, username, password)
command = "mkdir -p /root/ssh/"
s.exec_command(command)
command = "echo %s > /root/.ssh/authorized_keys" % output
s.exec_command(command)
s.close()

if __name__ == "__main__":
main(sys.argv[1:])
4 changes: 4 additions & 0 deletions contrail/environment/modules/contrail/files/fix-mem-cache.py
Expand Up @@ -43,6 +43,10 @@ def main(args_str=None):
commands.getstatusoutput('echo "net.ipv4.tcp_tw_reuse = 1" >> /etc/sysctl.conf')
if commands.getstatusoutput("grep '^net.ipv4.tcp_fin_timeout' /etc/sysctl.conf")[0] != 0:
commands.getstatusoutput('echo "net.ipv4.tcp_fin_timeout = 30" >> /etc/sysctl.conf')
if commands.getstatusoutput("grep '^net.unix.max_dgram_qlen' /etc/sysctl.conf")[0] != 0:
commands.getstatusoutput('echo "net.unix.max_dgram_qlen = 1000" >> /etc/sysctl.conf')

commands.getstatusoutput('sysctl -p')

if __name__ == "__main__":
main(sys.argv[1:])

0 comments on commit 2e3b091

Please sign in to comment.