Skip to content

Commit

Permalink
Partial-Bug: #1596132
Browse files Browse the repository at this point in the history
Manifests changes to support server manager provisioning centos7.1 target
Add workaround for rabbit not up after reboot, nova password fix, etc.
Change-Id: I1096e5d5f9842637b5d5716b291960f746c95ed3
  • Loading branch information
kamleshp committed Jul 22, 2016
1 parent 7e3512b commit 641e5a8
Show file tree
Hide file tree
Showing 35 changed files with 955 additions and 113 deletions.
@@ -1,9 +1,9 @@
#!/bin/bash
platform=$1
grep -q '^cgroup_device_acl' /etc/libvirt/qemu.conf
if [ "$?" -ne 0 ]
then
grep -q -i -e 'centos' -e 'redhat' /etc/issue
if [ "$?" -eq 0 ]
if [ $platform == 'CentOS' ] || [ $platform == 'Fedora' ]
then
echo "clear_emulator_capabilities = 1" >> /etc/libvirt/qemu.conf
echo 'user = "root"' >> /etc/libvirt/qemu.conf
Expand All @@ -15,5 +15,10 @@ then
echo ' "/dev/ptmx", "/dev/kvm", "/dev/kqemu",' >> /etc/libvirt/qemu.conf
echo ' "/dev/rtc", "/dev/hpet","/dev/net/tun",' >> /etc/libvirt/qemu.conf
echo ']' >> /etc/libvirt/qemu.conf
service libvirt-bin restart
if [ $platform == 'CentOS' ] || [ $platform == 'Fedora' ]
then
service libvirtd restart
else
service libvirt-bin restart
fi
fi
Expand Up @@ -35,7 +35,13 @@
end
Facter.add(:contrail_version) do
setcode do
Facter::Util::Resolution.exec('dpkg -l contrail-lib | grep contrail-lib | awk \'{ printf $3}\'')
operatingsystem = Facter.value('operatingsystem')
case operatingsystem
when "CentOS"
Facter::Util::Resolution.exec('yum list | grep contrail-lib | awk \'{ printf $2}\' | awk -F \'.e\' \'{printf $1}\'')
when "Ubuntu"
Facter::Util::Resolution.exec('dpkg -l contrail-lib | grep contrail-lib | awk \'{ printf $3}\'')
end
end
end
Facter.add(:conductor_idx) do
Expand Down
Expand Up @@ -3,9 +3,14 @@
Facter.add(:contrail_interfaces) do
setcode do
contrail_interfaces = {}
interface_list_str = %x[ifconfig -a | grep HWaddr | awk \'{ print $1 \'}]
operatingsystem = Facter.value('operatingsystem')
case operatingsystem
when "CentOS"
interface_list_str = %x[ifconfig -a | grep flags | awk \'{ print $1 \'} | sed \'s/:$// \']
when "Ubuntu"
interface_list_str = %x[ifconfig -a | grep HWaddr | awk \'{ print $1 \'}]
end
intf_list = interface_list_str.split("\n")

intf_list.each do |intf|
intf_detail = {}
vlan_intf = %x[ip addr show #{intf} | head -1| cut -f2 -d':' | grep -o '@.*']
Expand Down
Expand Up @@ -36,7 +36,12 @@
$contrail_analytics_api_ini_command ="/usr/bin/contrail-analytics-api --conf_file /etc/contrail/contrail-analytics-api.conf --conf_file /etc/contrail/contrail-keystone-auth.conf"
$contrail_alarm_gen_ini_command ="/usr/bin/contrail-alarm-gen --conf_file /etc/contrail/contrail-alarm-gen.conf --conf_file /etc/contrail/contrail-keystone-auth.conf"

$redis_config_file = '/etc/redis/redis.conf'
if ($::operatingsystem == 'Centos' or $::operatingsystem == 'Fedora') {
$redis_config_file = '/etc/redis.conf'
}
if ($::operatingsystem == 'Ubuntu') {
$redis_config_file = '/etc/redis/redis.conf'
}
$redis_augeas_lens_to_use = 'spacevars.lns'

if ($redis_password != "" ) {
Expand Down
@@ -1,7 +1,7 @@
class contrail::collector::install(
$upgrade_needed = $::contrail::params::upgrade_needed,
) {
if ($upgrade_needed == 1) {
if ($upgrade_needed == 1 and $::operatingsystem == 'Ubuntu') {
exec { 'Temporarily delete contrail-analytics to upgrade python-kafka' :
command => "dpkg -P contrail-analytics contrail-openstack-analytics python-kafka-python",
provider => shell,
Expand Down
@@ -1,13 +1,19 @@
class contrail::collector::service(
$contrail_logoutput = $::contrail::params::contrail_logoutput,
) {
if ($::operatingsystem == 'Centos' or $::operatingsystem == 'Fedora') {
$redis_service = 'redis'
}
if ($::operatingsystem == 'Ubuntu') {
$redis_service = 'redis-server'
}
# Ensure the services needed are running.
exec { 'redis-del-db-dir':
command => 'rm -f /var/lib/redis/dump.rb',
provider => shell,
logoutput => $contrail_logoutput
} ->
service { ['redis-server', 'supervisor-analytics'] :
service { [$redis_service, 'supervisor-analytics'] :
ensure => running,
enable => true,
}
Expand Down
35 changes: 21 additions & 14 deletions contrail/environment/modules/contrail/manifests/common.pp
Expand Up @@ -59,17 +59,24 @@
User['nova', 'libvirt-qemu', 'libvirt-dnsmasq'] ->
contrail::lib::contrail_upgrade{ 'contrail_upgrade':
contrail_upgrade => $contrail_upgrade,
contrail_logoutput => $contrail_logoutput,
upgrade_needed => $upgrade_needed
} ->
apt::pin { 'debian_repo_preferences':
priority => '-10',
originator => 'Debian'
} ->
apt::pin { 'contrail_repo_preferences':
priority => '999',
codename => 'contrail'
} ->
contrail_logoutput => $contrail_logoutput
}
if 'Ubuntu' == $::operatingsystem {
apt::pin { 'debian_repo_preferences':
priority => '-10',
originator => 'Debian'
} ->
apt::pin { 'contrail_repo_preferences':
priority => '999',
codename => 'contrail'
}
}
if ($::operatingsystem == 'Ubuntu') {
$ssl_package='libssl0.9.8'
}
if ($::operatingsystem == 'Centos' or $::operatingsystem == 'Fedora') {
$ssl_package='openssl'
}
# Create repository config on target.
contrail::lib::contrail_setup_repo{ $contrail_repo_name:
contrail_repo_ip => $contrail_repo_ip,
Expand All @@ -87,7 +94,7 @@
ensure => present,
ip => $host_mgmt_ip
} ->
package { 'libssl0.9.8' : ensure => present,} ->
package { $ssl_package : ensure => present,} ->
sysctl::value { 'kernel.core_pattern':
value => '/var/crashes/core.%e.%p.%h.%t'
} ->
Expand All @@ -102,10 +109,9 @@
ensure => 'directory',
} ->
Class['::contrail::enable_kernel_core']

# Disable SELINUX on boot, if not already disabled.
if ($::operatingsystem == 'Centos' or $::operatingsystem == 'Fedora') {
Package['libssl0.9.8']->
Package['openssl']->
# Set SELINUX as disabled in selinux config
contrail::lib::augeas_conf_set { 'SELINUX':
config_file => '/etc/selinux/config',
Expand All @@ -126,6 +132,7 @@
lens_to_use => 'properties.lns',
} ->
Sysctl::Value['kernel.core_pattern']
package { 'yum-plugin-priorities' : ensure => present,}
contain ::contrail::disable_selinux
}

Expand Down
5 changes: 4 additions & 1 deletion contrail/environment/modules/contrail/manifests/compute.pp
Expand Up @@ -164,7 +164,10 @@
) {
contrail::lib::report_status { 'compute_started': } ->
Class['::contrail::compute::install'] ->
Class['::contrail::compute::config'] ~>
# Commenting out line below as service manifest is never executed, execution is
# looping in config never goes to server.pp.
#Class['::contrail::compute::config'] ~>
Class['::contrail::compute::config'] ->
Class['::contrail::compute::service'] ->
contrail::lib::report_status { "compute_completed": }
contain ::contrail::compute::install
Expand Down
@@ -1,6 +1,7 @@
class contrail::compute::add_dev_tun_in_cgroup_device_acl (
$contrail_logoutput = $::contrail::params::contrail_logoutput,
) {
$os = $::operatingsystem
file { '/etc/contrail/contrail_setup_utils/add_dev_tun_in_cgroup_device_acl.sh':
ensure => present,
mode => '0755',
Expand All @@ -9,7 +10,7 @@
source => "puppet:///modules/${module_name}/add_dev_tun_in_cgroup_device_acl.sh"
} ->
exec { 'add_dev_tun_in_cgroup_device_acl' :
command => './add_dev_tun_in_cgroup_device_acl.sh && echo add_dev_tun_in_cgroup_device_acl >> /etc/contrail/contrail_compute_exec.out',
command => "./add_dev_tun_in_cgroup_device_acl.sh $os && echo add_dev_tun_in_cgroup_device_acl >> /etc/contrail/contrail_compute_exec.out",
cwd => '/etc/contrail/contrail_setup_utils/',
unless => 'grep -qx add_dev_tun_in_cgroup_device_acl /etc/contrail/contrail_compute_exec.out',
provider => shell,
Expand Down
22 changes: 15 additions & 7 deletions contrail/environment/modules/contrail/manifests/compute/config.pp
Expand Up @@ -183,12 +183,6 @@
}
}

# Install interface rename package for centos.
if (inline_template('<%= @operatingsystem.downcase %>') == 'centos') {
Notify["vmware_physical_intf = ${vmware_physical_intf}"] ->
contrail::lib::contrail_rename_interface { 'centos-rename-interface' :
}
}
# for storage
## Same condition as compute/service.pp
if ($nfs_server == 'xxx' and $host_control_ip == $compute_ip_list[0] ) {
Expand All @@ -215,9 +209,12 @@
'compute/compute_driver'=> { value => "libvirt.LibvirtDriver" },
'DEFAULT/rabbit_hosts' => {value => "${nova_compute_rabbit_hosts}"},
}
if ($::operatingsystem == 'Centos' or $::operatingsystem == 'Fedora') {
$nova_params['keystone_authtoken/password'] = { value =>"${keystone_admin_password}" }
}
if ($keystone_ip) {
$vnc_base_url_port = '5999'
nova_config { 'DEFAULT/novncproxy_base_url': value => "http://${keystone_ip}:${vnc_base_url_port}/vnc_auto.html" }
$nova_params['DEFAULT/novncproxy_base_url'] = { value => "http://${keystone_ip}:${vnc_base_url_port}/vnc_auto.html" }
}
if (!('openstack' in $host_roles)){
nova_config { 'glance/api_servers': value => "http://${glance_management_address}:9292"}
Expand Down Expand Up @@ -413,10 +410,21 @@
subscribe => Exec ["setup-compute-server-setup"],
timeout => 0,
}

contain ::contrail::compute::setup_compute_server_setup
contain ::contrail::compute::add_vnc_config
# Now reboot the system
if ($::operatingsystem == 'Centos' or $::operatingsystem == 'Fedora') {
Class['::contrail::compute::setup_compute_server_setup'] ->
Class['::contrail::compute::cp_ifcfg_file'] ->
# remove blank password line from nova.conf
exec { "set-nova-password":
command => "sed -i \'s/^password=$/password=${keystone_admin_password}/\' /etc/nova/nova.conf && echo exec-set-nova-password >> /etc/contrail/exec-contrail-compute.out",
provider => shell,
unless => "grep -qx set-nova-conf /etc/contrail/exec-contrail-compute.out",
logoutput => true
} ->
Reboot['compute']
contain ::contrail::compute::cp_ifcfg_file
}

Expand Down
Expand Up @@ -8,7 +8,5 @@
logoutput => $contrail_logoutput
}
->
Reboot['compute']
->
notify { "executed cp_ifcfg_file" :; }
}
Expand Up @@ -77,6 +77,12 @@
# Ensure all needed packages are latest
package { [ $vrouter_pkg, 'contrail-openstack-vrouter'] : ensure => latest, notify => Service['supervisor-vrouter']}

# Install interface rename package for centos.
if (inline_template('<%= @operatingsystem.downcase %>') == 'centos') {
contrail::lib::contrail_rename_interface { 'centos-rename-interface' :
}
}

if ($enable_lbaas == true) {
Package[$vrouter_pkg, 'contrail-openstack-vrouter'] ->
package{ ['haproxy', 'iproute'] : ensure => present,}
Expand Down
Expand Up @@ -11,7 +11,17 @@
enable => true,
}
}
service { 'nova-compute' :
if ($::operatingsystem == 'Centos' or $::operatingsystem == 'Fedora') {
$nova_service_name = "openstack-nova-compute"
exec { 'sevc-openstk-nova-restart' :
command => "service ${nova_service_name} restart",
provider => shell,
logoutput => $contrail_logoutput,
}
} else {
$nova_service_name = "nova-compute"
}
service { $nova_service_name :
enable => $nova_compute_status,
ensure => $nova_compute_status,
}
Expand Down
12 changes: 8 additions & 4 deletions contrail/environment/modules/contrail/manifests/config/config.pp
Expand Up @@ -85,8 +85,8 @@

$contrail_api_ubuntu_command = join(["/usr/bin/contrail-api --conf_file /etc/contrail/contrail-api.conf --conf_file /etc/contrail/contrail-keystone-auth.conf --listen_port ",$api_port_base,"%(process_num)01d --worker_id %(process_num)s"],'')
$contrail_discovery_ubuntu_command = join(["/usr/bin/contrail-discovery --conf_file /etc/contrail/contrail-discovery.conf --listen_port ",$disc_port_base,"%(process_num)01d --worker_id %(process_num)s"],'')
$contrail_api_centos_command = join(['/bin/bash -c "source /opt/contrail/api-venv/bin/activate && exec python /opt/contrail/api-venv/lib/python2.7/site-packages/vnc_cfg_api_server/vnc_cfg_api_server.py --conf_file /etc/contrail/contrail-api.conf --listen_port ',$api_port_base,'%(process_num)01d --worker_id %(process_num)s"'],'')
$contrail_discovery_centos_command = join(['/bin/bash -c "source /opt/contrail/api-venv/bin/activate && exec python /opt/contrail/api-venv/lib/python2.7/site-packages/discovery/disc_server_zk.py --conf_file /etc/contrail/contrail-discovery.conf --listen_port ',$disc_port_base,'%(process_num)01d --worker_id %(process_num)s"'],'')
$contrail_api_centos_command = join(["/usr/bin/contrail-api --conf_file /etc/contrail/contrail-api.conf --conf_file /etc/contrail/contrail-keystone-auth.conf --conf_file /etc/contrail/contrail-database.conf --listen_port ",$api_port_base,"%(process_num)01d --worker_id %(process_num)s"],'')
$contrail_discovery_centos_command = join(["/usr/bin/contrail-discovery --conf_file /etc/contrail/contrail-discovery.conf --listen_port ",$disc_port_base,"%(process_num)01d --worker_id %(process_num)s"],'')


$keystone_auth_server = $keystone_ip_to_use
Expand Down Expand Up @@ -363,6 +363,8 @@
'APISERVER/multi_tenancy' : value => "$multi_tenancy";
'APISERVER/contrail_extensions': value => 'ipam:neutron_plugin_contrail.plugins.opencontrail.contrail_plugin_ipam.NeutronPluginContrailIpam,policy:neutron_plugin_contrail.plugins.opencontrail.contrail_plugin_policy.NeutronPluginContrailPolicy,route-table:neutron_plugin_contrail.plugins.opencontrail.contrail_plugin_vpc.NeutronPluginContrailVpc,contrail:None,service-interface:None,vf-binding:None';
'KEYSTONE/auth_url' : value => "$keystone_auth_url";
'KEYSTONE/admin_user' : value => "$keystone_admin_user";
'KEYSTONE/admin_password' : value => "$keystone_admin_password";
'KEYSTONE/auth_user' : value => "$keystone_admin_user";
'KEYSTONE/admin_tenant_name': value => "$keystone_admin_tenant";
} ->
Expand All @@ -378,6 +380,8 @@
'APISERVER/multi_tenancy' : value => "$multi_tenancy";
'APISERVER/contrail_extensions': value => 'ipam:neutron_plugin_contrail.plugins.opencontrail.contrail_plugin_ipam.NeutronPluginContrailIpam,policy:neutron_plugin_contrail.plugins.opencontrail.contrail_plugin_policy.NeutronPluginContrailPolicy,route-table:neutron_plugin_contrail.plugins.opencontrail.contrail_plugin_vpc.NeutronPluginContrailVpc,contrail:None';
'KEYSTONE/auth_url' : value => "$keystone_auth_url";
'KEYSTONE/admin_user' : value => "$keystone_admin_user";
'KEYSTONE/admin_password' : value => "$keystone_admin_password";
'KEYSTONE/auth_user' : value => "$keystone_admin_user";
'KEYSTONE/admin_tenant_name': value => "$keystone_admin_tenant";
'COLLECTOR/analytics_api_ip': value => "$collector_ip";
Expand All @@ -389,7 +393,7 @@
lens_to_use => 'properties.lns',
} ->

Class['::contrail::config::config_neutron_server'] ->
#Class['::contrail::config::config_neutron_server'] ->

# initd script wrapper for contrail-discovery
file { '/etc/init.d/contrail-discovery' :
Expand All @@ -414,6 +418,6 @@
}
contain ::contrail::openstackrc
contain ::contrail::keystone
contain ::contrail::config::config_neutron_server
#contain ::contrail::config::config_neutron_server
contain ::contrail::config::setup_quantum_server_setup
}
29 changes: 19 additions & 10 deletions contrail/environment/modules/contrail/manifests/config/install.pp
Expand Up @@ -10,26 +10,35 @@
#
if ($contrail_internal_vip == "" and ($internal_vip == "" or !('openstack' in $contrail_host_roles))) {

if ($lsbdistrelease == "14.04") {
$keepalived_pkg = '1.2.13-0~276~ubuntu14.04.1'
} else {
$keepalived_pkg = '1:1.2.13-1~bpo70+1'
}
if ($::operatingsystem == 'Ubuntu') {
if ($lsbdistrelease == "14.04") {
$keepalived_pkg = '1.2.13-0~276~ubuntu14.04.1'
} else {
$keepalived_pkg = '1:1.2.13-1~bpo70+1'
}

package { 'keepalived' :
ensure => $keepalived_pkg,
package { 'keepalived' :
ensure => $keepalived_pkg,
}
}
->
service { "keepalived" :
enable => false,
ensure => stopped,
}
Package['keepalived'] -> Package['contrail-openstack-config']
if defined(Package['keepalived']) {
Package['keepalived'] -> Package['contrail-openstack-config']
}
}

if ($::operatingsystem == 'Centos' or $::operatingsystem == 'Fedora') {
$cmd='yum -y remove contrail-openstack-config contrail-config-openstack'
}
else {
$cmd="apt-get -y --force-yes purge contrail-openstack-config contrail-config-openstack"
}
if ($upgrade_needed == 1) {
exec { 'Temporarily delete contrail-openstack-config, contrail-config-openstack' :
command => "apt-get -y --force-yes purge contrail-openstack-config contrail-config-openstack",
command => $cmd,
provider => shell,
logoutput => $contrail_logoutput,
}
Expand Down
Expand Up @@ -4,14 +4,18 @@
service { 'supervisor-config':
ensure => running,
enable => true,
} ->
service { 'supervisor-support-service':
ensure => running,
enable => true,
}
if ($::operatingsystem == 'Ubuntu') {
service { 'supervisor-support-service':
ensure => running,
enable => true,
}
}
#Set rabbit params for both internal and contrail_internal_vip
if($vip != '') {
Service['supervisor-support-service'] ->
if ($::operatingsystem == 'Ubuntu') {
Service['supervisor-support-service'] -> Exec['rabbit_os_fix']
}
exec { 'rabbit_os_fix':
command => "rabbitmqctl set_policy HA-all \"\" '{\"ha-mode\":\"all\",\"ha-sync-mode\":\"automatic\"}' && echo rabbit_os_fix >> /etc/contrail/contrail_openstack_exec.out",
unless => 'grep -qx rabbit_os_fix /etc/contrail/contrail_openstack_exec.out',
Expand Down

0 comments on commit 641e5a8

Please sign in to comment.