diff --git a/deployment_scripts/puppet/modules/bcf/manifests/compute.pp b/deployment_scripts/puppet/modules/bcf/manifests/compute.pp index ab4e44a..1b11ad9 100644 --- a/deployment_scripts/puppet/modules/bcf/manifests/compute.pp +++ b/deployment_scripts/puppet/modules/bcf/manifests/compute.pp @@ -15,15 +15,43 @@ # class bcf::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" - - # lldp - file { "/bin/send_lldp": - ensure => file, - mode => 0777, + + $ifcfg_bond0 = "/etc/network/interfaces.d/ifcfg-bond0" + $bond_lacp = "bond-mode 4" + $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 $bond_lacp in $ifcfg_bond0": + command => "echo '$bond_lacp' >> $ifcfg_bond0", + unless => "grep -qe '$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.*/$bond_lacp/' $ifcfg_bond0", + path => "/bin:/usr/bin" + } + $sys_desc = $sys_desc_lacp } + else { + $sys_desc = $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": + content => $a, + ensure => file, + mode => 0777, + } + } + file { "/etc/init/send_lldp.conf": ensure => file, content => " @@ -32,7 +60,7 @@ start on runlevel [2345] stop on runlevel [!2345] respawn script - exec /bin/send_lldp --system-desc 5c:16:c7:00:00:04 --system-name $(uname -n) -i 10 --network_interface eth2,eth3 + exec /bin/send_lldp --system-desc $sys_desc --system-name $(uname -n) -i 10 --network_interface $bcf::itfs end script ", } @@ -47,7 +75,29 @@ end script ensure => file, mode => 0777, }-> - + file_line { "remove clear default gw": + path => '/etc/rc.local', + ensure => absent, + line => "ip route del default", + }-> + file_line { "remove ip route add default": + path => '/etc/rc.local', + ensure => absent, + line => "ip route add default via ${bcf::gw}", + }-> + file_line { "clear default gw": + path => '/etc/rc.local', + line => "ip route del default", + }-> + file_line { "add default gw": + path => '/etc/rc.local', + line => "ip route add default via ${bcf::gw}", + }-> + file_line { "add exit 0": + path => '/etc/rc.local', + line => "exit 0", + } + # config /etc/neutron/neutron.conf ini_setting { "neutron.conf report_interval": ensure => present, @@ -134,7 +184,7 @@ end script section => 'restproxy', key_val_separator => '=', setting => 'servers', - value => '${bcf::params::openstack::bcf_controller_1},${bcf::params::openstack::bcf_controller_2}', + 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": @@ -143,7 +193,7 @@ end script section => 'restproxy', key_val_separator => '=', setting => 'server_auth', - value => '${bcf::params::openstack::bcf_username}:${bcf::params::openstack::bcf_password}', + value => "${bcf::params::openstack::bcf_username}:${bcf::params::openstack::bcf_password}", notify => Service['neutron-plugin-openvswitch-agent'], } ini_setting { "ml2 restproxy server ssl": @@ -179,7 +229,7 @@ end script section => 'restproxy', key_val_separator => '=', setting => 'neutron_id', - value => '${bcf::params::openstack::bcf_instance_id}', + value => "${bcf::params::openstack::bcf_instance_id}", notify => Service['neutron-plugin-openvswitch-agent'], } @@ -191,12 +241,6 @@ end script notify => Service['neutron-plugin-openvswitch-agent'], } - # make sure neutron-bsn-agent is stopped - service {'neutron-bsn-agent': - ensure => stopped, - enable => false, - } - # ensure neutron-plugin-openvswitch-agent is running file { "/etc/init/neutron-plugin-openvswitch-agent.conf": ensure => file, diff --git a/deployment_scripts/puppet/modules/bcf/manifests/controller.pp b/deployment_scripts/puppet/modules/bcf/manifests/controller.pp index 6668d60..ac675f1 100644 --- a/deployment_scripts/puppet/modules/bcf/manifests/controller.pp +++ b/deployment_scripts/puppet/modules/bcf/manifests/controller.pp @@ -31,7 +31,7 @@ class bcf::controller { path => $binpath, notify => Service['neutron-server'], } - + # config /etc/neutron/neutron.conf ini_setting { "neutron.conf report_interval": ensure => present, @@ -173,7 +173,7 @@ class bcf::controller { section => 'restproxy', key_val_separator => '=', setting => 'servers', - value => '${bcf::params::openstack::bcf_controller_1},${bcf::params::openstack::bcf_controller_2}', + value => "${bcf::params::openstack::bcf_controller_1},${bcf::params::openstack::bcf_controller_2}", notify => Service['neutron-server'], } ini_setting { "ml2 restproxy server auth": @@ -182,7 +182,7 @@ class bcf::controller { section => 'restproxy', key_val_separator => '=', setting => 'server_auth', - value => '${bcf::params::openstack::bcf_username}:${bcf::params::openstack::bcf_password}', + value => "${bcf::params::openstack::bcf_username}:${bcf::params::openstack::bcf_password}", notify => Service['neutron-server'], } ini_setting { "ml2 restproxy server ssl": @@ -218,7 +218,43 @@ class bcf::controller { section => 'restproxy', key_val_separator => '=', setting => 'neutron_id', - value => '${bcf::params::openstack::bcf_instance_id}', + value => "${bcf::params::openstack::bcf_instance_id}", + notify => Service['neutron-server'], + } + ini_setting { "ml2 restproxy auth_url": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'auth_url', + value => "${bcf::params::openstack::keystone_vip}:35357", + notify => Service['neutron-server'], + } + ini_setting { "ml2 restproxy auth_user": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'auth_user', + value => "${bcf::params::openstack::auth_user}", + notify => Service['neutron-server'], + } + ini_setting { "ml2 restproxy auth_password": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'auth_password', + value => "${bcf::params::openstack::auth_password}", + notify => Service['neutron-server'], + } + ini_setting { "ml2 restproxy auth_tenant_name": + ensure => present, + path => '/etc/neutron/plugins/ml2/ml2_conf.ini', + section => 'restproxy', + key_val_separator => '=', + setting => 'auth_tenant', + value => "${bcf::params::openstack::auth_tenant_name}", notify => Service['neutron-server'], } diff --git a/deployment_scripts/puppet/modules/bcf/manifests/init.pp b/deployment_scripts/puppet/modules/bcf/manifests/init.pp index fe361ea..9654f4e 100644 --- a/deployment_scripts/puppet/modules/bcf/manifests/init.pp +++ b/deployment_scripts/puppet/modules/bcf/manifests/init.pp @@ -13,4 +13,28 @@ # License for the specific language governing permissions and limitations # under the License. # -class bcf {} +class bcf { +# Network configuration +$network_scheme = hiera_hash('network_scheme', {}) +prepare_network_config($network_scheme) +$gw = get_default_gateways() +#$phy_devs = get_network_role_property('neutron/private', 'phys_dev') +$phy_devs = "eth0" +$if_str = "$phy_devs" +if $if_str =~ /^bond.*/ { + $ifaces = join($phy_devs, ",") + $bond = true + $s = "${phy_devs[0]}," + $r = split("abc$ifaces", $s) + $itfs = $r[1] +} +else { + $bond = false + $itfs = $phy_devs +} + +notify { "ifaces: $ifaces": } +notify { "bond: $bond": } +notify { "gw: $gw": } +notify { "itfs: $itfs": } +} diff --git a/deployment_scripts/puppet/modules/bcf/manifests/params.pp b/deployment_scripts/puppet/modules/bcf/manifests/params.pp index 5de5729..e89e36a 100644 --- a/deployment_scripts/puppet/modules/bcf/manifests/params.pp +++ b/deployment_scripts/puppet/modules/bcf/manifests/params.pp @@ -17,10 +17,6 @@ class bcf::params { include bcf::params::openstack - $bcf_hash = hiera('bigswitch') - $network_metadata = hiera('network_metadata') - $ssl = hiera('public_ssl') - case $::operatingsystem { 'Ubuntu', 'Debian': { } @@ -29,8 +25,4 @@ class bcf::params { default: { } } - - #server parameters - $server_ip = $network_metadata['vips'][$vip_name]['ipaddr'] - $mgmt_vip = $network_metadata['vips']['management']['ipaddr'] } diff --git a/deployment_scripts/puppet/modules/bcf/manifests/params/openstack.pp b/deployment_scripts/puppet/modules/bcf/manifests/params/openstack.pp index b66b242..961eb70 100644 --- a/deployment_scripts/puppet/modules/bcf/manifests/params/openstack.pp +++ b/deployment_scripts/puppet/modules/bcf/manifests/params/openstack.pp @@ -18,14 +18,15 @@ class bcf::params::openstack { $virtual_cluster_name = 'OpenStackCluster' $ceph_virtual_cluster_name = 'CephCluster' + $quantum_settings = hiera('quantum_settings') $keystone_vip = hiera('management_vip') - $db_vip = hiera('management_vip') - $nova_vip = hiera('management_vip') - $glance_vip = hiera('management_vip') - $cinder_vip = hiera('management_vip') - $rabbit_vip = hiera('management_vip') - $bcf_hash = hiera('bigswitch') + $auth_user = 'neutron' + $auth_password = $quantum_settings['keystone']['admin_password'] + $auth_tenant_name = 'services' + $network_scheme = hiera('network_scheme') + $fuel_master = hiera('master_ip') + $bcf_hash = hiera('fuel-plugin-bigswitch') $access_hash = hiera('access') $keystone_hash = hiera('keystone') @@ -42,16 +43,4 @@ class bcf::params::openstack { $bcf_instance_id = $bcf_hash['openstack_instance_id'] $bcf_controller_mgmt = $bcf_hash['bcf_controller_os_mgmt'] $access_tenant = 'services' - $keystone_db_password = $keystone_hash['db_password'] - $nova_db_password = $nova_hash['db_password'] - $neutron_db_password = $neutron_hash['database']['passwd'] - $cinder_db_password = $cinder_hash['db_password'] - $rabbit_password = $rabbit_hash['password'] - $rabbitmq_service_name = 'rabbitmq-server' - - if !$rabbit_hash['user'] { - $rabbit_user = 'nova' - } else { - $rabbit_user = $rabbit_hash['user'] - } } diff --git a/deployment_tasks.yaml b/deployment_tasks.yaml index 3105d6f..3e642c5 100644 --- a/deployment_tasks.yaml +++ b/deployment_tasks.yaml @@ -1,6 +1,15 @@ # These tasks will be merged into deployment graph. Here you # can specify new tasks for any roles, even built-in ones. +- id: openstack-primary-controller-bigswitch + type: puppet + role: [primary-controller] + required_for: [post_deployment_end] + requires: [post_deployment_start] + parameters: + puppet_manifest: puppet/manifests/controller-config.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 720 - id: openstack-controller-bigswitch type: puppet role: [controller] diff --git a/metadata.yaml b/metadata.yaml index 1659218..ebf77d7 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -13,7 +13,7 @@ licenses: ['Apache License Version 2.0'] # Specify author or company name authors: ['Kanzhe Jiang'] # A link to the plugin's page -homepage: 'https://github.com/stackforge/fuel-plugins' +homepage: 'https://github.com/openstack/fuel-plugin-bigswitch' # Specify a group which your plugin implements, possible options: # network, storage, storage::cinder, storage::glance, hypervisor groups: ['network']