Add vcenter manifests related to compute-vmware

Change-Id: Ia343c009cd494f8809be2161519ed6590d0dda6b
This commit is contained in:
Vitalii Kovalchuk 2016-09-01 10:49:00 +00:00
parent 384a8c6c48
commit e05b06eed8
10 changed files with 354 additions and 0 deletions

View File

@ -0,0 +1,19 @@
# 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.
notice('MODULAR: contrail/contrail-compute-pkg.pp')
include contrail
class { 'contrail::compute::vmware_pkg': }

View File

@ -0,0 +1,18 @@
# 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.
notice('MODULAR: contrail/contrail-compute-vmware-repo.pp')
include contrail
class { 'contrail::compute::vmware_repo': }

View File

@ -0,0 +1,19 @@
# 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.
notice('MODULAR: contrail/contrail-compute-vmware.pp')
include contrail
class { 'contrail::compute::vmware': }

View File

@ -0,0 +1,42 @@
<%-
contrail_data=scope.function_hiera(['contrail'])
-%>
[DEFAULT]
compute_driver=nova.virt.vmwareapi.contrailVCDriver
log_file=nova-compute-vmware-<%= @availability_zone_name %>-<%= @service_name %>.log
host=<%= @availability_zone_name %>-<%= @service_name %>
reserved_host_memory_mb = 0
force_config_drive=False
[vmware]
cache_prefix=$host
<% @vc_cluster.split(',').map(&:strip).each do |cluster_name| -%>
cluster_name=<%= cluster_name %>
<% end %>
vcenter_dvswitch=<%= contrail_data['dvs_internal'] %>
host_ip=<%= @vc_host %>
host_username=<%= @vc_user %>
host_password=<%= @vc_password %>
insecure=True
api_retry_count=<%= @api_retry_count %>
maximum_objects=<%= @maximum_objects %>
task_poll_interval=<%= @task_poll_interval %>
<% if @datastore_regex and !@datastore_regex.empty? -%>
datastore_regex=<%= @datastore_regex %>
<% end -%>
<% if @vlan_interface and !@vlan_interface.empty? -%>
vlan_interface=<%= @vlan_interface %>
<% end -%>
use_linked_clone=<%= @use_linked_clone %>
<% if @wsdl_location -%>
wsdl_location=<%= @wsdl_location %>
<% end -%>
[libvirt]
virt_type=vmwareapi

View File

@ -0,0 +1,58 @@
# 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.
class contrail::compute::vmware {
nova_config {
'DEFAULT/network_api_class': value => 'nova.network.neutronv2.api.API';
'DEFAULT/security_group_api': value => 'neutron';
'DEFAULT/firewall_driver': value => 'nova.virt.firewall.NoopFirewallDriver';
'DEFAULT/heal_instance_info_cache_interval': value => '0';
'neutron/url': value => "http://${contrail::mos_mgmt_vip}:9696";
'neutron/url_timeout': value => '300';
'neutron/admin_auth_url': value => "http://${contrail::mos_mgmt_vip}:35357/v2.0/";
'neutron/admin_tenant_name': value => 'services';
'neutron/admin_username': value => 'neutron';
'neutron/admin_password': value => $contrail::service_token;
}
# Config file
file { '/etc/contrail':
ensure => directory,
mode => '0750',
}->
file { '/var/log/contrail':
ensure => directory,
mode => '0750',
}->
# file {'/etc/contrail/ESXiToVRouterIp.map':
# content => template('contrail/ESXiToVRouterIp.map.erb')
# }->
file {'/etc/contrail/contrail-vcenter-plugin.conf':
ensure => present,
content => template('contrail/contrail-vcenter-plugin.conf.erb'),
}~>
# Enable and start service
service { 'contrail-vcenter-plugin':
ensure => running,
enable => true,
}
Nova_Config <||> ~>
service { 'nova-compute':
ensure => running,
enable => true,
}
}

View File

@ -0,0 +1,41 @@
# 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.
class contrail::compute::vmware_pkg {
Package {
ensure => installed,
}
#Create a pinning
$vcenter_compute_pkgs = [
'nova-compute', 'nova-compute-kvm',
'nova-common', 'nova-compute-libvirt',
'python-novaclient', 'python-bitstring',
'tzdata','openjdk-7-jre-headless']
exec { 'fix wrong tzdata':
command => 'apt-get install tzdata -y --force-yes',
path => '/bin:/sbin:/usr/bin:/usr/sbin',
} ->
package { $vcenter_compute_pkgs: }
# Install vCenter-specific contrail packages
package { ['libxml-commons-external-java', 'libxml-commons-resolver1.1-java', 'libxerces2-java',
'libslf4j-java', 'libnetty-java', 'libjline-java', 'libzookeeper-java']: } ->
package { 'contrail-install-vcenter-plugin': } ->
package { ['libcontrail-java-api','libcontrail-vijava','libcontrail-vrouter-java-api']: } ->
package { 'contrail-vcenter-plugin': }
}

View File

@ -0,0 +1,58 @@
# 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.
class contrail::compute::vmware_repo {
apt::pin { 'favor_contrail_packages':
priority => 1400,
label => 'contrail',
}
apt::pin { 'fixup_fox_libnl':
explanation => 'Fix for libnl from contrail repo',
packages => ['libnl-route-3-200', 'libnl-3-200'],
priority => '1500',
label => 'Ubuntu',
} ->
package {'libnl-3-200':
ensure => '3.2.21-1ubuntu3',
}
$overide_libvirt_type = add_data_to_yaml('/etc/hiera/plugins/contrail.yaml', 'libvirt_type', 'kvm')
# Temporary dirty hack. Fix execution of core manifests compute.pp and compute-vmware.pp.
# When contrail packages was installed, instead of libvirtd we will have libvirt-bin files [FIXME]
file { '/etc/default/libvirtd':
ensure => present,
content => '',
}
file { '/etc/init.d/libvirtd':
ensure => present,
mode => '0755',
content => '',
}
exec { 'patch_core_vmware_manifest':
path => '/usr/local/bin:/bin:/usr/bin/',
cwd => '/etc/puppet/modules/openstack_tasks/manifests/roles/',
command => 'sed -i -e \'s/$libvirt_type_kvm \+= \x27qemu-kvm\x27/$libvirt_type_kvm = \x27qemu-system-x86\x27/g\' compute.pp',
}
file { '/etc/puppet/modules/vmware/templates/nova-compute.conf.erb':
source => 'puppet:///modules/contrail/nova-compute.conf.erb_fixed',
}
}

View File

@ -197,4 +197,18 @@ class contrail {
$analytics_db_list_9160 = inline_template("<%= scope.lookupvar('contrail::analytics_db_ips').map{ |ip| \"#{ip}:9160\" }.join(' ') %>")
$kafka_broker_list = inline_template("<%= scope.lookupvar('contrail::analytics_db_ips').map{ |ip| \"#{ip}:9092\" }.join(' ') %>")
$zk_server_ip = inline_template("<%= scope.lookupvar('contrail::contrail_db_ips').map{ |ip| \"#{ip}:2181\" }.join(',') %>")
# vCenter settings
$vcenter_hash = hiera_hash('vcenter', false)
if $vcenter_hash {
$vcenter_server_ip = $vcenter_hash['computes'][0]['vc_host']
$vcenter_server_user = $vcenter_hash['computes'][0]['vc_user']
$vcenter_server_pass = $vcenter_hash['computes'][0]['vc_password']
$vcenter_server_cluster = $vcenter_hash['computes'][0]['vc_cluster']
$vcenter_server_name = $vcenter_hash['computes'][0]['availability_zone_name']
$contrail_vcenter_datacenter = pick($settings['contrail_vcenter_datacenter'], 'Datacenter')
$dvs_external = 'Contrail-DVS-Ext'
$dvs_internal = 'Contrail-DVS-Int'
}
}

View File

@ -0,0 +1,35 @@
#
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#
# Vcenter Plugin configuration options
#
[DEFAULT]
# Everything in this section is optional
# Vcenter plugin URL
vcenter.url=https://<%= scope.lookupvar('contrail::vcenter_server_ip') %>/sdk
#Vcenter credentials
vcenter.username=<%= scope.lookupvar('contrail::vcenter_server_user') %>
vcenter.password=<%= scope.lookupvar('contrail::vcenter_server_pass') %>
vcenter.datacenter=<%= scope.lookupvar('contrail::contrail_vcenter_datacenter') %>
vcenter.dvswitch=<%= scope.lookupvar('contrail::dvs_internal') %>
vcenter.ipfabricpg=<%= scope.lookupvar('contrail::dvs_external') %>-PG
mode=vcenter-as-compute
auth_url=http://<%= scope.lookupvar('contrail::mos_mgmt_vip') %>:35357/v2.0
admin_user=neutron
admin_password=<%= scope.lookupvar('contrail::service_token') %>
admin_tenant_name=services
# IP address and port to be used to connect to api server.
api.hostname=<%= scope.lookupvar('contrail::contrail_private_vip') %>
api.port=8082
zookeeper.serverlist=<%= scope.lookupvar('contrail::contrail_db_ips').map{ |ip| "#{ip}:2181" }.join(',') %>
# HTTP Introspect
introspect.port=8234

View File

@ -870,3 +870,53 @@
cmd: ruby /etc/puppet/modules/osnailyfacter/modular/sahara/sahara_pre.rb
test_post:
cmd: ruby /etc/puppet/modules/osnailyfacter/modular/sahara/sahara_post.rb
##############################################################
# Compute vmware tasks section
##############################################################
# Set proper apt pin for Contrail repository
- id: contrail-compute-vmware-repo
type: puppet
version: 2.0.0
groups: [compute-vmware]
required_for: [tools]
requires: [deploy_start, globals]
parameters:
puppet_manifest: puppet/manifests/contrail-compute-vmware-repo.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- id: contrail-compute-vmware-pkg
type: puppet
version: 2.0.0
groups: [compute-vmware]
required_for: [top-role-compute-vmware]
requires: [deploy_start, globals, contrail-compute-vmware-repo]
parameters:
puppet_manifest: puppet/manifests/contrail-compute-vmware-pkg.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
- id: contrail-compute-vmware-nova
type: puppet
version: 2.0.0
role: [compute-vmware]
required_for: [post_deployment_end]
requires: [post_deployment_start]
parameters:
puppet_manifest: puppet/manifests/contrail-compute-nova.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
# Deploy contrail vCenter plugin
- id: contrail-compute-vmware
type: puppet
version: 2.0.0
role: [compute-vmware]
required_for: [post_deployment_end]
requires: [post_deployment_start,contrail-compute-vmware-nova]
parameters:
puppet_manifest: puppet/manifests/contrail-compute-vmware.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720