P-only cleanup, p+v prep

Change-Id: I3f7c56023e65547276aaf617d22eb4f771e0a309
This commit is contained in:
Kanzhe Jiang 2016-01-11 12:37:56 -08:00
parent efd4d00ab4
commit 10f4965473
5 changed files with 160 additions and 275 deletions

View File

@ -1,64 +0,0 @@
#
# Copyright 2015 BigSwitch Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
class bcf::p_v::ceph {
include bcf
include bcf::params
# all of the exec statements use this path
$binpath = '/usr/local/bin/:/bin/:/usr/bin:/usr/sbin:/usr/local/sbin:/sbin'
$ifcfg_bond0 = '/etc/network/interfaces.d/ifcfg-bond0'
if $bcf::bond {
# ensure bond-mode is 802.3ad
exec { "ensure ${bcf::bond_lacp} in ${ifcfg_bond0}":
command => "echo '${bcf::bond_lacp}' >> ${ifcfg_bond0}",
unless => "grep -qe '${bcf::bond_lacp}' -- ${ifcfg_bond0}",
path => '/bin:/usr/bin',
require => Exec["update bond-mode in ${ifcfg_bond0}"],
}
exec { "update bond-mode in ${ifcfg_bond0}":
command => "sed -i 's/bond-mode.*/${bcf::bond_lacp}/' ${ifcfg_bond0}",
path => '/bin:/usr/bin'
}
$sys_desc = $bcf::sys_desc_lacp
}
else {
$sys_desc = $bcf::sys_desc_xor
}
# lldp
file { '/bin/send_lldp':
ensure => file,
mode => '0777',
}
file { '/etc/init/send_lldp.conf':
ensure => file,
content => "
description \"BCF LLDP\"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
script
exec /bin/send_lldp --system-desc ${sys_desc} --system-name $(uname -n) -i 10 --network_interface ${bcf::itfs}
end script
",
}
service { 'send_lldp':
ensure => running,
enable => true,
require => [File['/bin/send_lldp'], File['/etc/init/send_lldp.conf']],
}
}

View File

@ -17,57 +17,6 @@ class bcf::p_v::compute {
include bcf
include bcf::params
# all of the exec statements use this path
$binpath = '/usr/local/bin/:/bin/:/usr/bin:/usr/sbin:/usr/local/sbin:/sbin'
$ifcfg_bond0 = '/etc/network/interfaces.d/ifcfg-bond0'
$sys_desc_lacp = '5c:16:c7:00:00:04'
$sys_desc_xor = '5c:16:c7:00:00:00'
if $bcf::bond {
# ensure bond-mode is 802.3ad
exec { "ensure ${bcf::bond_lacp} in ${ifcfg_bond0}":
command => "echo '${bcf::bond_lacp}' >> ${ifcfg_bond0}",
unless => "grep -qe '${bcf::bond_lacp}' -- ${ifcfg_bond0}",
path => '/bin:/usr/bin',
require => Exec["update bond-mode in ${ifcfg_bond0}"],
}
exec { "update bond-mode in ${ifcfg_bond0}":
command => "sed -i 's/bond-mode.*/${bcf::bond_lacp}/' ${ifcfg_bond0}",
path => '/bin:/usr/bin'
}
$sys_desc = $bcf::sys_desc_lacp
}
else {
$sys_desc = $bcf::sys_desc_xor
}
# lldp
$a = file('/etc/fuel/plugins/fuel-plugin-bigswitch-1.0/python_scripts/send_lldp','/dev/null')
if($a != '') {
file { '/bin/send_lldp':
ensure => file,
content => $a,
mode => '0777',
}
}
file { '/etc/init/send_lldp.conf':
ensure => file,
content => "
description \"BCF LLDP\"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
script
exec /bin/send_lldp --system-desc ${sys_desc} --system-name $(uname -n) -i 10 --network_interface ${bcf::itfs}
end script
",
}
service { 'send_lldp':
ensure => running,
enable => true,
require => [File['/bin/send_lldp'], File['/etc/init/send_lldp.conf']],
}
# edit rc.local for cron job and default gw
file { '/etc/rc.local':
@ -97,6 +46,11 @@ end script
line => 'exit 0',
}
exec { 'set default gw':
command => "ip route del default; ip route add default via ${bcf::gw}",
path => '/usr/local/bin/:/usr/bin/:/bin:/sbin',
}
# config /etc/neutron/neutron.conf
ini_setting { 'neutron.conf report_interval':
ensure => present,
@ -104,7 +58,8 @@ end script
section => 'agent',
key_val_separator => '=',
setting => 'report_interval',
value => 60,
value => '60',
notify => Service['neutron-plugin-openvswitch-agent'],
}
ini_setting { 'neutron.conf agent_down_time':
ensure => present,
@ -113,6 +68,7 @@ end script
key_val_separator => '=',
setting => 'agent_down_time',
value => '150',
notify => Service['neutron-plugin-openvswitch-agent'],
}
ini_setting { 'neutron.conf service_plugins':
ensure => present,
@ -121,6 +77,7 @@ end script
key_val_separator => '=',
setting => 'service_plugins',
value => 'router',
notify => Service['neutron-plugin-openvswitch-agent'],
}
ini_setting { 'neutron.conf dhcp_agents_per_network':
ensure => present,
@ -129,6 +86,7 @@ end script
key_val_separator => '=',
setting => 'dhcp_agents_per_network',
value => '1',
notify => Service['neutron-plugin-openvswitch-agent'],
}
ini_setting { 'neutron.conf notification driver':
ensure => present,
@ -137,6 +95,7 @@ end script
key_val_separator => '=',
setting => 'notification_driver',
value => 'messaging',
notify => Service['neutron-plugin-openvswitch-agent'],
}
# set the correct properties in ml2_conf.ini on compute as well
@ -159,78 +118,6 @@ end script
value => 'vlan',
notify => Service['neutron-plugin-openvswitch-agent'],
}
ini_setting { 'ml2 mechanism drivers':
ensure => present,
path => '/etc/neutron/plugins/ml2/ml2_conf.ini',
section => 'ml2',
key_val_separator => '=',
setting => 'mechanism_drivers',
value => 'openvswitch,bsn_ml2',
notify => Service['neutron-plugin-openvswitch-agent'],
}
ini_setting { 'ml2 restproxy ssl cert directory':
ensure => present,
path => '/etc/neutron/plugins/ml2/ml2_conf.ini',
section => 'restproxy',
key_val_separator => '=',
setting => 'ssl_cert_directory',
value => '/etc/neutron/plugins/ml2',
notify => Service['neutron-plugin-openvswitch-agent'],
}
ini_setting { 'ml2 restproxy servers':
ensure => present,
path => '/etc/neutron/plugins/ml2/ml2_conf.ini',
section => 'restproxy',
key_val_separator => '=',
setting => 'servers',
value => "${bcf::params::openstack::bcf_controller_1},${bcf::params::openstack::bcf_controller_2}",
notify => Service['neutron-plugin-openvswitch-agent'],
}
ini_setting { 'ml2 restproxy server auth':
ensure => present,
path => '/etc/neutron/plugins/ml2/ml2_conf.ini',
section => 'restproxy',
key_val_separator => '=',
setting => 'server_auth',
value => "${bcf::params::openstack::bcf_username}:${bcf::params::openstack::bcf_password}",
notify => Service['neutron-plugin-openvswitch-agent'],
}
ini_setting { 'ml2 restproxy server ssl':
ensure => present,
path => '/etc/neutron/plugins/ml2/ml2_conf.ini',
section => 'restproxy',
key_val_separator => '=',
setting => 'server_ssl',
value => 'True',
notify => Service['neutron-plugin-openvswitch-agent'],
}
ini_setting { 'ml2 restproxy auto sync on failure':
ensure => present,
path => '/etc/neutron/plugins/ml2/ml2_conf.ini',
section => 'restproxy',
key_val_separator => '=',
setting => 'auto_sync_on_failure',
value => 'True',
notify => Service['neutron-plugin-openvswitch-agent'],
}
ini_setting { 'ml2 restproxy consistency interval':
ensure => present,
path => '/etc/neutron/plugins/ml2/ml2_conf.ini',
section => 'restproxy',
key_val_separator => '=',
setting => 'consistency_interval',
value => 60,
notify => Service['neutron-plugin-openvswitch-agent'],
}
ini_setting { 'ml2 restproxy neutron_id':
ensure => present,
path => '/etc/neutron/plugins/ml2/ml2_conf.ini',
section => 'restproxy',
key_val_separator => '=',
setting => 'neutron_id',
value => "${bcf::params::openstack::bcf_instance_id}",
notify => Service['neutron-plugin-openvswitch-agent'],
}
# change ml2 ownership
file { '/etc/neutron/plugins/ml2':
@ -259,45 +146,28 @@ end script
content => 'dhcp-option-force=26,1400',
}
# dhcp configuration
ini_setting { 'dhcp agent interface driver':
ensure => present,
path => '/etc/neutron/dhcp_agent.ini',
section => 'DEFAULT',
key_val_separator => '=',
setting => 'interface_driver',
value => 'neutron.agent.linux.interface.OVSInterfaceDriver',
service { 'nova-compute':
ensure => running,
enable => true,
}
ini_setting { 'dhcp agent dhcp driver':
ensure => present,
path => '/etc/neutron/dhcp_agent.ini',
section => 'DEFAULT',
key_val_separator => '=',
setting => 'dhcp_driver',
value => 'neutron.agent.linux.dhcp.Dnsmasq',
$public_ssl = hiera('public_ssl')
$horizon_ssl = $public_ssl['horizon']
if $horizon_ssl {
$novnc_protocol = 'https'
}
ini_setting { 'dhcp agent enable isolated metadata':
ensure => present,
path => '/etc/neutron/dhcp_agent.ini',
section => 'DEFAULT',
key_val_separator => '=',
setting => 'enable_isolated_metadata',
value => 'True',
else {
$novnc_protocol = 'http'
}
ini_setting { 'dhcp agent disable metadata network':
ensure => present,
path => '/etc/neutron/dhcp_agent.ini',
section => 'DEFAULT',
key_val_separator => '=',
setting => 'enable_metadata_network',
value => 'False',
}
ini_setting { 'dhcp agent disable dhcp_delete_namespaces':
ensure => present,
path => '/etc/neutron/dhcp_agent.ini',
section => 'DEFAULT',
key_val_separator => '=',
setting => 'dhcp_delete_namespaces',
value => 'False',
# update nova.conf for novncproxy_base_url
ini_setting { 'nova novncproxy_base_url':
ensure => present,
path => '/etc/nova/nova.conf',
section => 'DEFAULT',
key_val_separator => '=',
setting => 'novncproxy_base_url',
value => "${novnc_protocol}://${bcf::public_vip}:6080/vnc_auto.html",
notify => Service['nova-compute']
}
}

View File

@ -0,0 +1,58 @@
#
# Copyright 2015 BigSwitch Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
class bcf::p_v::network {
include bcf
include bcf::params
$binpath = '/usr/local/bin/:/bin/:/usr/bin:/usr/sbin:/usr/local/sbin:/sbin'
$sys_desc_lacp = '5c:16:c7:00:00:04'
# lldp
$a = file('/etc/fuel/plugins/fuel-plugin-bigswitch-1.0/python_scripts/send_lldp', '/dev/null')
if($a != '') {
file { '/bin/send_lldp':
ensure => file,
content => $a,
mode => '0777',
}
}
file { '/etc/init/send_lldp.conf':
ensure => file,
content => "
description \"BCF LLDP\"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
script
exec /bin/send_lldp --system-desc ${sys_desc_lacp} --system-name $(uname -n) -i 10 --network_interface ${bcf::itfs}
end script
",
}
service { 'send_lldp':
ensure => running,
enable => true,
require => [File['/bin/send_lldp'], File['/etc/init/send_lldp.conf']],
}
# load bonding module
file_line {'load bonding on boot':
path => '/etc/modules',
line => 'bonding',
match => '^bonding$',
}
}

View File

@ -13,30 +13,20 @@
# License for the specific language governing permissions and limitations
# under the License.
#
class bcf::p_v::controller {
class bcf::p_v::reconfigure_neutron {
include bcf
include bcf::params
include bcf::params::openstack
$binpath = '/usr/local/bin/:/bin/:/usr/bin:/usr/sbin:/usr/local/sbin:/sbin'
package { 'python-pip':
ensure => 'installed',
ensure => 'installed',
}
exec { 'bsnstacklib':
command => 'pip install "bsnstacklib<2015.2"',
path => '/usr/local/bin/:/usr/bin/:/bin',
require => Package['python-pip']
}
# uplink mtu
file_line { "ifconfig ${name} mtu ${bcf::params::openstack::mtu}":
path => '/etc/rc.local',
line => "ifconfig ${name} mtu ${bcf::params::openstack::mtu}",
match => "^ifconfig ${name} mtu ${bcf::params::openstack::mtu}",
}
# make sure known_hosts is cleaned up
file { '/root/.ssh/known_hosts':
ensure => absent,
command => 'pip install "bsnstacklib<2015.2"',
path => '/usr/local/bin/:/usr/bin/:/bin',
require => Package['python-pip']
}
# purge bcf controller public key
@ -54,6 +44,7 @@ class bcf::p_v::controller {
key_val_separator => '=',
setting => 'report_interval',
value => '60',
notify => Service['neutron-server'],
}
ini_setting { 'neutron.conf agent_down_time':
ensure => present,
@ -62,6 +53,7 @@ class bcf::p_v::controller {
key_val_separator => '=',
setting => 'agent_down_time',
value => '150',
notify => Service['neutron-server'],
}
ini_setting { 'neutron.conf service_plugins':
ensure => present,
@ -69,7 +61,7 @@ class bcf::p_v::controller {
section => 'DEFAULT',
key_val_separator => '=',
setting => 'service_plugins',
value => 'router',
value => 'bsn_l3',
notify => Service['neutron-server'],
}
ini_setting { 'neutron.conf dhcp_agents_per_network':
@ -81,6 +73,15 @@ class bcf::p_v::controller {
value => '1',
notify => Service['neutron-server'],
}
ini_setting { 'neutron.conf network_scheduler_driver':
ensure => present,
path => '/etc/neutron/neutron.conf',
section => 'DEFAULT',
key_val_separator => '=',
setting => 'network_scheduler_driver',
value => 'neutron.scheduler.dhcp_agent_scheduler.WeightScheduler',
notify => Service['neutron-server'],
}
ini_setting { 'neutron.conf notification driver':
ensure => present,
path => '/etc/neutron/neutron.conf',
@ -91,17 +92,6 @@ class bcf::p_v::controller {
notify => Service['neutron-server'],
}
# configure /etc/keystone/keystone.conf
ini_setting { 'keystone.conf notification driver':
ensure => present,
path => '/etc/keystone/keystone.conf',
section => 'DEFAULT',
key_val_separator => '=',
setting => 'notification_driver',
value => 'messaging',
notify => Service['keystone'],
}
# config /etc/neutron/plugin.ini
ini_setting { 'neutron plugin.ini firewall_driver':
ensure => present,
@ -135,13 +125,13 @@ class bcf::p_v::controller {
setting => 'enable_metadata_proxy',
value => 'False',
}
ini_setting { 'l3 agent external network bridge':
ini_setting { 'l3 agent handle_internal_only_routers':
ensure => present,
path => '/etc/neutron/l3_agent.ini',
section => 'DEFAULT',
key_val_separator => '=',
setting => 'external_network_bridge',
value => '',
setting => 'handle_internal_only_routers',
value => 'True',
}
# config /etc/neutron/plugins/ml2/ml2_conf.ini
@ -181,7 +171,7 @@ class bcf::p_v::controller {
value => '/etc/neutron/plugins/ml2',
notify => Service['neutron-server'],
}
if $bcf::params::openstack::bcf_controller_2 == ''{
if $bcf::params::openstack::bcf_controller_2 == ':8000' {
$server = $bcf::params::openstack::bcf_controller_1
}
else {
@ -287,25 +277,9 @@ class bcf::p_v::controller {
notify => Service['neutron-server'],
}
# heat-engine, neutron-server, neutron-dhcp-agent and neutron-metadata-agent
service { 'heat-engine':
ensure => running,
enable => true,
}
# neutron-server, keystone
service { 'neutron-server':
ensure => running,
enable => true,
}
service { 'keystone':
ensure => running,
enable => true,
}
service { 'neutron-dhcp-agent':
ensure => stopped,
enable => false,
}
service { 'neutron-metadata-agent':
ensure => stopped,
enable => false,
}
}

View File

@ -0,0 +1,47 @@
#
# Copyright 2015 BigSwitch Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
class bcf::p_v::restart_cluster_services {
include bcf
include bcf::params
$binpath = '/usr/local/bin/:/bin/:/usr/bin:/usr/sbin:/usr/local/sbin:/sbin'
$nodes_hash = hiera('nodes', {})
$roles = node_roles($nodes_hash, hiera('uid'))
if member($roles, 'primary-controller') {
exec { 'restart neutron-dhcp-agent':
command => 'crm resource restart p_neutron-dhcp-agent',
path => '/usr/local/bin/:/bin/:/usr/sbin',
} ->
exec { 'restart neutron-metadata-agent':
command => 'crm resource restart p_neutron-metadata-agent',
path => '/usr/local/bin/:/bin/:/usr/sbin',
} ->
exec { 'stop neutron-l3-agent':
command => 'crm resource stop p_neutron-l3-agent',
path => '/usr/local/bin/:/bin/:/usr/sbin',
} ->
exec { 'disable neutron-l3-agent':
command => 'crm resource disable p_neutron-l3-agent',
path => '/usr/local/bin/:/bin/:/usr/sbin',
} ->
exec { 'restart neutron-plugin-openvswitch-agent':
command => 'crm resource restart p_neutron-plugin-openvswitch-agent',
path => '/usr/local/bin/:/bin/:/usr/sbin',
}
}
}