Deploy and provision contrail-vmware
Change-Id: I5e8b8ef75cdd9962603375c1e4be33dfdf535b34
This commit is contained in:
parent
255e893f9b
commit
f941bae964
|
@ -15,4 +15,4 @@
|
|||
notice('MODULAR: contrail/contrail-vmware.pp')
|
||||
|
||||
include contrail
|
||||
#class { 'contrail::contrail_vmware': }
|
||||
class { 'contrail::contrail_vmware': }
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
# Copyright 2016 Mirantis, 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.
|
||||
|
||||
module Puppet::Parser::Functions
|
||||
newfunction(:get_vmware_devices, :type => :rvalue, :doc => <<-EOS
|
||||
Returns device name for internal vmware traffic
|
||||
example:
|
||||
get_vmware_devices()
|
||||
EOS
|
||||
) do |args|
|
||||
|
||||
bridge_interfaces = Array.new()
|
||||
bond_interfaces = Array.new()
|
||||
|
||||
network_scheme = function_hiera_hash(['network_scheme', {}])
|
||||
network_scheme['transformations'].each do |entry|
|
||||
if entry.has_key?('bridge') and entry['action'] == "add-port"
|
||||
bridge_interfaces.push(entry['name'])
|
||||
end
|
||||
if entry.has_key?('bond_properties') and entry['action'] == "add-bond"
|
||||
bond_interfaces.push(*entry['interfaces'])
|
||||
end
|
||||
end
|
||||
|
||||
Dir.foreach('/sys/class/net') do |network_interface|
|
||||
next if network_interface == '.' or network_interface == '..'
|
||||
network_interface_path = "/sys/class/net/" + network_interface
|
||||
if (not bridge_interfaces.include?(network_interface) and
|
||||
not bond_interfaces.include?(network_interface))
|
||||
int_driver = network_interface_path + '/device/driver/module'
|
||||
if File.exist?(int_driver)
|
||||
path = File.readlink(network_interface_path + '/device/driver/module')
|
||||
driver_name = path.split('/')[-1]
|
||||
return network_interface
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -14,109 +14,33 @@
|
|||
|
||||
class contrail::contrail_vmware {
|
||||
|
||||
if $contrail::use_vcenter {
|
||||
|
||||
$self_ip = $contrail::address
|
||||
$cfgm_ip = $contrail::contrail_private_vip
|
||||
|
||||
$ncontrols = size($contrail::contrail_control_ips)
|
||||
$amqp_server_ip = $contrail::contrail_private_vip
|
||||
$service_token = $contrail::admin_token
|
||||
$orchestrator = $contrail::orchestrator
|
||||
$hypervisor = $contrail::hypervisor
|
||||
$keystone_ip = $contrail::mos_mgmt_vip
|
||||
$keystone_admin_user = $contrail::neutron_user
|
||||
$keystone_admin_password = $contrail::service_token
|
||||
$service_tenant_name = $contrail::service_tenant
|
||||
$internal_vip = $contrail::mos_mgmt_vip
|
||||
$external_vip = $contrail::mos_public_vip
|
||||
$contrail_internal_vip = $contrail::contrail_private_vip
|
||||
$mgmt_self_ip = $::ipaddress_br_mgmt
|
||||
|
||||
# Fetching the esxi data from hash
|
||||
$esxi_data = fetch_esxi_data("root@${self_ip}")
|
||||
$vmware = $esxi_data['ip']
|
||||
$vmware_username = $esxi_data['username']
|
||||
$vmware_passwd = $esxi_data['password']
|
||||
$vmware_iface_name = $esxi_data['contrail_vm']['vmware_iface_name']
|
||||
$vmware_vmpg_vswitch = $esxi_data['fabric_vswitch']
|
||||
$vmware_vmpg_vswitch_mtu = '9000'
|
||||
$mode = $contrail::mode
|
||||
$contrailvm_ntp = $contrail::contrailvm_ntp
|
||||
|
||||
$phys_dev_facter = regsubst($::contrail::phys_dev, '\.' , '_')
|
||||
$dev_mac = getvar("::macaddress_${phys_dev_facter}")
|
||||
|
||||
$delete_packages = ['openvswitch-common', 'openvswitch-datapath-dkms',
|
||||
'openvswitch-datapath-lts-saucy-dkms', 'openvswitch-switch', 'nova-network',
|
||||
'nova-api']
|
||||
$install_packages = ['contrail-install-packages', 'contrail-fabric-utils',
|
||||
'contrail-setup', 'contrail-vrouter-dkms', 'contrail-vrouter-common',
|
||||
'contrail-nova-vif', 'open-vm-tools', 'iproute2']
|
||||
|
||||
l23network::l3::ifconfig { $vmware_iface_name: ipaddr => 'none' }
|
||||
$install_packages = ['contrail-utils', 'contrail-vrouter-dkms', 'contrail-vrouter-common',
|
||||
'contrail-nova-vif', 'iproute2']
|
||||
|
||||
$sysctl_settings = {
|
||||
'net.nf_conntrack_max' => { value => '1048576'},
|
||||
'kernel.panic' => { value => '60'},
|
||||
'net.ipv4.conf.default.arp_accept' => { value => '1'},
|
||||
'net.core.netdev_max_backlog' => { value => '261144'},
|
||||
'net.ipv4.tcp_keepalive_intvl' => { value => '3'},
|
||||
'net.ipv4.tcp_keepalive_time' => { value => '30'},
|
||||
'net.ipv4.tcp_keepalive_probes' => { value => '8'},
|
||||
'net.ipv4.conf.all.arp_accept' => { value => '1'},
|
||||
'net.ipv4.tcp_retries2' => { value => '5'},
|
||||
'net.ipv4.conf.all.rp_filter' => { value => '2'},
|
||||
'net.ipv4.conf.default.rp_filter' => { value => '2'},
|
||||
'kernel.core_pattern' => { value => '/var/crashes/core.%e.%p.%h.%t'},
|
||||
}
|
||||
|
||||
$sysctl_defaults = {
|
||||
require => File['/var/crashes'],
|
||||
}
|
||||
|
||||
create_resources(sysctl::value, $sysctl_settings, $sysctl_defaults)
|
||||
|
||||
file_line { 'kexec-tools':
|
||||
path => '/etc/default/kdump-tools',
|
||||
match => 'crashkernel=.*\([ | \"]\)',
|
||||
line => 'crashkernel=384M-2G:64M,2G-16G:128M,16G-:256M\1',
|
||||
}
|
||||
l23network::l3::ifconfig { $contrail::vmware_iface_name: ipaddr => 'none' }
|
||||
|
||||
if !is_pkg_installed('contrail-openstack-vrouter') {
|
||||
file { 'create_supervisor_vrouter_override':
|
||||
ensure => present,
|
||||
path => '/etc/init/supervisor-vrouter.override',
|
||||
content => 'manual',
|
||||
before => Class['contrail::package'],
|
||||
require => Package[$install_packages],
|
||||
}
|
||||
}
|
||||
|
||||
class { 'contrail::package':
|
||||
install => [$install_packages],
|
||||
remove => [$delete_packages],
|
||||
} ->
|
||||
|
||||
file {'/var/crashes':
|
||||
ensure => directory,
|
||||
mode => '1777',
|
||||
} ->
|
||||
|
||||
file_line { 'use_kdump':
|
||||
path => '/etc/default/kdump-tools',
|
||||
match => 'USE_KDUMP=.*',
|
||||
line => 'USE_KDUMP=1',
|
||||
} ->
|
||||
|
||||
exec { 'remove-ovs-modules':
|
||||
command => '/sbin/modprobe -r openvswitch',
|
||||
onlyif => '/sbin/lsmod | grep -q ^openvswitch',
|
||||
package { $install_packages:
|
||||
ensure => present,
|
||||
tag => ['install'],
|
||||
} ->
|
||||
|
||||
file {'/etc/contrail/agent_param':
|
||||
ensure => present,
|
||||
content => template('contrail/agent_param.erb'),
|
||||
require => Class[Contrail::Package],
|
||||
require => Package[$install_packages],
|
||||
} ->
|
||||
contrail_vrouter_agent_config {
|
||||
'DEFAULT/platform' : value => 'default';
|
||||
|
@ -130,10 +54,10 @@ class contrail::contrail_vmware {
|
|||
'DEFAULT/syslog_facility' : value => 'LOG_LOCAL0';
|
||||
'DEFAULT/headless_mode' : value => true;
|
||||
'DISCOVERY/server' : value => $contrail::contrail_private_vip;
|
||||
'DISCOVERY/max_control_nodes' : value => '2';
|
||||
'DISCOVERY/max_control_nodes' : value => '2'; # TODO check this param
|
||||
'HYPERVISOR/type' : value => 'vmware';
|
||||
'HYPERVISOR/vmware_mode' : value => 'vcenter';
|
||||
'HYPERVISOR/vmware_physical_interface' : value => $vmware_iface_name;
|
||||
'HYPERVISOR/vmware_physical_interface' : value => $contrail::vmware_iface_name;
|
||||
'METADATA/metadata_proxy_secret' : value => $contrail::metadata_secret;
|
||||
'NETWORKS/control_network_ip' : value => $contrail::address;
|
||||
'VIRTUAL-HOST-INTERFACE/name' : value => 'vhost0';
|
||||
|
@ -150,32 +74,26 @@ class contrail::contrail_vmware {
|
|||
exec { 'remove_supervisor_override':
|
||||
command => '/bin/rm /etc/init/supervisor-vrouter.override',
|
||||
onlyif => '/usr/bin/test -f /etc/init/supervisor-vrouter.override',
|
||||
require => Class['Contrail::Package'],
|
||||
require => Package[$install_packages],
|
||||
}
|
||||
|
||||
service {'supervisor-vrouter':
|
||||
ensure => running,
|
||||
enable => true,
|
||||
subscribe => [Class[Contrail::Package],
|
||||
Exec['remove-ovs-modules'],
|
||||
File['/etc/contrail/agent_param']],
|
||||
} ->
|
||||
exec { 'register_contrailvm_vrouter':
|
||||
path => '/usr/local/bin:/bin:/usr/bin/',
|
||||
cwd => '/opt/contrail/utils',
|
||||
command => "python provision_vrouter.py --host_name ${::fqdn} --host_ip ${self_ip} \
|
||||
--api_server_ip ${contrail_internal_vip} --api_server_port ${contrail::api_server_port} \
|
||||
--oper add --admin_user ${keystone_admin_user} --admin_password ${keystone_admin_password} \
|
||||
--admin_tenant_name ${service_tenant_name} --openstack_ip ${internal_vip} \
|
||||
&& touch /opt/contrail/register_contrailvm_vrouter-DONE",
|
||||
creates => '/opt/contrail/register_contrailvm_vrouter-DONE',
|
||||
}
|
||||
exec {'command when file not exists':
|
||||
command => 'touch /tmp/contrail-reboot-require && touch /opt/contrail/reboot-DONE',
|
||||
onlyif => 'test ! -f /opt/contrail/reboot-DONE',
|
||||
path => ['/usr/bin','/usr/sbin','/bin','/sbin'],
|
||||
ensure => running,
|
||||
enable => true,
|
||||
hasrestart => false,
|
||||
restart => 'service supervisor-vrouter stop && \
|
||||
modprobe -r vrouter && \
|
||||
sync && \
|
||||
echo 3 > /proc/sys/vm/drop_caches && \
|
||||
echo 1 > /proc/sys/vm/compact_memory && \
|
||||
service supervisor-vrouter start',
|
||||
subscribe => [Package[$install_packages],
|
||||
File['/etc/contrail/agent_param']
|
||||
],
|
||||
}
|
||||
|
||||
Contrail_vrouter_nodemgr_config <||> ~> Service['supervisor-vrouter']
|
||||
Contrail_vrouter_agent_config <||> ~> Service['supervisor-vrouter']
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -212,6 +212,7 @@ class contrail {
|
|||
$contrail_esxi_info = hiera_array('contrail_esxi_info', [])
|
||||
$dvs_external = 'Contrail-DVS-Ext'
|
||||
$dvs_internal = 'Contrail-DVS-Int'
|
||||
$vmware_iface_name = get_vmware_devices()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -975,3 +975,18 @@
|
|||
cross-depends:
|
||||
- name: contrail-db-provision-all
|
||||
|
||||
- id: contrail-vmware-provision
|
||||
type: puppet
|
||||
version: 2.0.0
|
||||
groups: [contrail-vmware]
|
||||
required_for: [deploy_end]
|
||||
requires: [contrail-vmware-task]
|
||||
parameters:
|
||||
puppet_manifest: puppet/manifests/contrail-compute-provision.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
timeout: 720
|
||||
cross-depends:
|
||||
- name: openstack-controller-provision
|
||||
role: primary-controller
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue