[WIP] Add support for MOS8 in fuel plumgrid plugin

- Changed parameters in environment config file
 - Changed values in metadata file
 - Changed director.pp manifest
    - Remove neutron-plugin package
    - Add support for deb based networking-plumgrid
      package
 - Changed core plugin value
 - Replace plugin name in guess function
 - Add iptables rule for metadata
 - Add support for solutions api (license, ips, zoneinfo)

Ticket: [SOL-1022] [SOL-975] [SOL-782]
Change-Id: I4fdf75de95d367c9ae197d384ebc2eb1e4df738a
Signed-off-by: Muhammad Shahzeb <mshahzeb@plumgrid.com>
(cherry picked from commit d28a0b75de)
This commit is contained in:
Muhammad Shahzeb 2016-06-09 03:37:41 -04:00 committed by Javeria Khan
parent 41f19ebf86
commit 2bfe4490a7
11 changed files with 120 additions and 77 deletions

View File

@ -1,36 +0,0 @@
#
# Copyright (c) 2016, PLUMgrid Inc, http://plumgrid.com
#
# 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.
#!/bin/bash
mkdir -p /var/log/plumgrid
exec > /var/log/plumgrid/pg_os_version.log
exec 2>&1
set -x
. /tmp/plumgrid_config
curl -Lks http://$pg_repo:81/files/lvm-installer.sh -o /tmp/lvm-installer.sh
curl -Lks http://$pg_repo:81/files/pg_os_version.yaml -o /tmp/pg_os_version.yaml
pg_version=$(cat /tmp/lvm-installer.sh | grep pg_ver= | awk 'NR==1 {print}'| cut -c9-| sed 's/-.*//')
os_version=$(cat /tmp/pg_os_version.yaml | grep $pg_version-k | cut -d ' ' -f2)
if [ -n "$os_version" ]; then
grep -q -F "networking_pg_version: $os_version" /etc/astute.yaml || echo "networking_pg_version: $os_version" >> /etc/astute.yaml
fi

View File

@ -48,13 +48,13 @@ if [[ ! -f "/root/post_director" ]];then
done
#Install License
install_status=$(curl -H "Accept: application/json" -H "Content-Type: application/json" \
https://$vip/0/tenant_manager/license_key/key1 -k -X PUT -d '{"license": '\"$license\"'}' \
-i -b /tmp/cookie -k| grep HTTP | awk '{print $2}')
install_status=$(curl -H "Accept: application/json" -H "Content-Type: application/json" -X PUT \
-d '{"user_name":"plumgrid","password":"plumgrid","license":"'$license'"}' \
http://$pg_repo:8099/v1/zones/$zone_name/pgLicense)
echo $install_status
if [[ $install_status -ne 200 ]]; then
if [[ $install_status -ne "{\"status\": \"success\",\"message\":\"Successfully installed PLUMgrid license\",\"data\":}" ]]; then
echo "Error installing license, exiting..."
exit 1
fi

View File

@ -27,7 +27,6 @@ $plumgrid_vip = pick($plumgrid_hash['plumgrid_virtual_ip'])
$plumgrid_zone = pick($plumgrid_hash['plumgrid_zone'])
$plumgrid_username = pick($plumgrid_hash['plumgrid_username'])
$plumgrid_password = pick($plumgrid_hash['plumgrid_password'])
$networking_pg_version = hiera('networking_pg_version', '2015.1.1.1')
# PLUMgrid Zone settings
$network_metadata = hiera_hash('network_metadata')
@ -101,7 +100,7 @@ file { '/etc/neutron/neutron.conf':
file_line { 'Enable PLUMgrid core plugin':
path => '/etc/neutron/neutron.conf',
line => 'core_plugin=neutron.plugins.plumgrid.plumgrid_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2',
line => 'core_plugin=networking_plumgrid.neutron.plugins.plugin.NeutronPluginPLUMgridV2',
match => '^core_plugin.*$',
require => File['/etc/neutron/neutron.conf'],
}
@ -132,6 +131,15 @@ file_line { 'Set libvirt cpu mode':
require => File['/etc/nova/nova.conf']
}
# MOS8 uses the outdated PLUMgrid plugin string in the plugin guess function
file_line { 'Replace plugin name in guess function':
path => '/usr/share/neutron-common/plugin_guess_func',
match => '"neutron.plugins.plumgrid.plumgrid_nos_plugin.plumgrid_plugin.NeutronPluginPLUMgridV2"',
line => "\t\"networking_plumgrid.neutron.plugins.plugin.NeutronPluginPLUMgridV2\")",
multiple => true
}
# Setting PLUMgrid Config Files
class { '::neutron::plugins::plumgrid':
@ -145,29 +153,12 @@ class { '::neutron::plugins::plumgrid':
nova_metadata_port => '8775',
metadata_proxy_shared_secret => $metadata_secret,
package_ensure => 'latest',
}->
package { 'networking-plumgrid':
ensure => $networking_pg_version,
provider => 'pip',
notify => Service["$::neutron::params::server_service"],
}
if ($networking_pg_version != '2015.1.1.1'){
exec { "plumgrid-db-manage upgrade heads":
command => "/usr/local/bin/plumgrid-db-manage upgrade heads",
notify => Service["$::neutron::params::server_service"],
require => Package['networking-plumgrid']
}
}
# Update PLUMgrid plugin file
file { 'plumgrid_plugin.py':
path => '/usr/lib/python2.7/dist-packages/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py',
ensure => present,
mode => '0644',
source => 'puppet:///modules/plumgrid/plumgrid_plugin.py',
notify => Service["$::neutron::params::server_service"]
exec { "neutron-db-manage upgrade heads":
command => "/usr/bin/neutron-db-manage upgrade heads",
notify => Service["$::neutron::params::server_service"],
require => Package['networking-plumgrid']
}
# Update PLUMgrid pgrc file
@ -177,3 +168,15 @@ file { 'pgrc':
path => '/etc/neutron/plugins/plumgrid/pgrc',
content => "export os_auth_url=http://$service_endpoint:35357/v2.0\nexport os_admin_user=$admin_username\nexport os_admin_tenant=$admin_tenant\nexport os_admin_password=$admin_password\nexport pg_virtual_ip=$plumgrid_vip\nexport pg_username=$plumgrid_username\nexport pg_password=$plumgrid_password",
}
exec { 'Add iptables rule for metadata':
command => '/sbin/iptables -A INPUT -p tcp -m multiport --ports 8775 -m comment --comment "000 metadata rule" -j ACCEPT'
}
exec { 'Add iptables rule for Solutions api':
command => '/sbin/iptables -I INPUT -p tcp --dport 8099 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT'
}
exec { 'Save iptables rule':
command => '/sbin/iptables-save >> /etc/iptables/rules.v4'
}

View File

@ -32,3 +32,15 @@ file_line { 'ensure no port conflict between apache-keystone':
ensure => 'absent',
require => File['/etc/apache2/ports.conf']
}
exec { "Get kernel version":
command => "/bin/sed -i '/kernel_version/d' /etc/astute.yaml && /bin/echo \"kernel_version: $(uname -r)\" >> /etc/astute.yaml",
}
exec { "Get plumgrid version":
command => "/bin/sed -i '/plumgrid_version/d' /etc/astute.yaml && /bin/echo \"plumgrid_version: $(dpkg -l | awk '\$2==\"plumgrid-lxc\" { print \$3 }' )\" >> /etc/astute.yaml",
}
exec { "Get cloudapex version":
command => "/bin/sed -i '/cloudapex_version/d' /etc/astute.yaml && /bin/echo \"cloudapex_version: $(cat /var/lib/libvirt/filesystems/plumgrid/opt/pg/web/cloudApex/modules/appCloudApex/appCloudApex.js | grep -i appVersion | awk '{print \$2; exit}' | cut -d ',' -f 1)\" >> /etc/astute.yaml",
}

View File

@ -156,3 +156,11 @@ file_line { 'unmount plumgrid.fuse pre-start':
after => '/opt/pg/scripts/systemd_pre_start.sh',
require => Package[$plumgrid::params::plumgrid_package]
}
exec { 'Add iptables rule for metadata':
command => '/sbin/iptables -A INPUT -p tcp -m multiport --ports 8775 -m comment --comment "000 metadata rule" -j ACCEPT'
}
exec { 'Save iptables rule':
command => '/sbin/iptables-save >> /etc/iptables/rules.v4'
}

View File

@ -63,6 +63,12 @@ exec { 'ovs_rmmod':
onlyif => 'lsmod | /bin/grep openvswitch'
}
exec { 'openvswitch-switch_forceremove':
command => 'dpkg -r --force-all openvswitch-switch',
path => '/usr/bin',
onlyif => 'dpkg -l | /bin/grep openvswitch-switch'
}
package { 'openvswitch-*':
ensure => absent
}

View File

@ -23,5 +23,13 @@ package { 'libvirt-bin' :
}
package { 'networking-plumgrid':
ensure => 'absent',
provider => 'pip',
}
# MOS8 was tagged with the older version of puppet neutron which contains outdated PLUMgrid plugin name
file_line { 'Replace outdated plugin package name in puppet neutron':
path => '/etc/puppet/modules/neutron/manifests/params.pp',
line => " \$plumgrid_plugin_package = \'networking-plumgrid\'",
match => "plumgrid_plugin_package",
multiple => true
}

View File

@ -0,0 +1,40 @@
# 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: plumgrid/solutions_api.pp')
# Node IPs
$network_metadata = hiera_hash('network_metadata')
$controller_nodes = get_nodes_hash_by_roles($network_metadata, ['primary-controller', 'controller'])
$controller_address_map = get_node_to_ipaddr_map_by_network_role($controller_nodes, 'mgmt/vip')
$controller_ipaddresses = join(hiera_array('controller_ipaddresses', values($controller_address_map)), ',')
$compute_nodes = get_nodes_hash_by_roles($network_metadata, ['compute'])
$compute_address_map = get_node_to_ipaddr_map_by_network_role($compute_nodes, 'mgmt/vip')
$compute_ipaddresses = join(hiera_array('compute_ipaddresses', values($compute_address_map)), ',')
$gateway_nodes = get_nodes_hash_by_roles($network_metadata, ['PLUMgrid-Gateway'])
$gateway_address_map = get_node_to_ipaddr_map_by_network_role($gateway_nodes, 'mgmt/vip')
$gateway_ipaddresses = join(hiera_array('gateway_ipaddresses', values($gateway_address_map)), ',')
$plumgrid_hash = hiera_hash('plumgrid', {})
$plumgrid_pkg_repo = pick($plumgrid_hash['plumgrid_package_repo'])
$md_ip = pick($plumgrid_hash['plumgrid_opsvm'])
$plumgrid_vip = pick($plumgrid_hash['plumgrid_virtual_ip'])
$plumgrid_zone = pick($plumgrid_hash['plumgrid_zone'])
$openstack_version = hiera('openstack_version')
$cobbler = hiera_hash('cobbler')
$hypervisor = pick($cobbler['profile'])
$kernel_version = hiera('kernel_version')
$plumgrid_version = hiera('plumgrid_version')
$cloudapex_version = hiera('cloudapex_version','disabled')
exec { 'Send all IPs to Solution API server':
command => "/usr/bin/curl -H \'Content-Type: application/json\' -X PUT -d \'{\"director_ips\":\"$controller_ipaddresses\",\"edge_ips\":\"$compute_ipaddresses\",\"gateway_ips\":\"$gateway_ipaddresses\",\"virtual_ip\":\"$plumgrid_vip\",\"opsvm_ip\":\"$md_ip\"}\' http://$plumgrid_pkg_repo:8099/v1/zones/$plumgrid_zone/ALLIPS" }
exec { 'Send Environment data to Solution API server':
command => "/usr/bin/curl -H \"Content-Type: application/json\" -X PUT -d \'{\"solution_name\":\"Mirantis\",\"solution_version\":\"$openstack_version\",\"pg_ons_version\":\"$plumgrid_version\",\"hypervisor\":\"$hypervisor\",\"hypervisor_version\":\"$hypervisor\", \"kernel_version\":\"$kernel_version\",\"pg_cloudapex_version\":\"cloudapex_version\"}\' http://$plumgrid_pkg_repo:8099/v1/zones/$plumgrid_zone/zoneInfo" }

View File

@ -31,22 +31,13 @@
- id: pg_common
role: ['controller', 'compute', 'PLUMgrid-Gateway', 'primary-controller']
required_for: [post_deployment_end, pg_fabric]
requires: [post_deployment_start, check-pgzone]
requires: [post_deployment_start, check-pgzone, configure_default_route]
type: puppet
parameters:
puppet_manifest: puppet/manifests/pg_common.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 3000
- id: pg_os_version
role: ['controller', 'primary-controller']
required_for: [post_deployment_end, setup-director]
requires: [post_deployment_start, pg_common]
type: shell
parameters:
cmd: bash pg_os_version.sh
timeout: 3000
- id: pg_fabric
role: ['controller', 'compute', 'PLUMgrid-Gateway', 'primary-controller']
required_for: [post_deployment_end, setup-director]
@ -59,7 +50,7 @@
- id: setup-director
role: ['controller', 'primary-controller']
required_for: [post_deployment_end, director-fixes]
requires: [post_deployment_start, pg_os_version, pg_fabric]
requires: [post_deployment_start, pg_fabric]
type: puppet
parameters:
puppet_manifest: puppet/manifests/director.pp
@ -85,6 +76,16 @@
cmd: bash post_pg_license.sh
timeout: 3000
- id: solution-api
role: ['primary-controller']
required_for: [post_deployment_end, setup-edge]
requires: [post_deployment_start, post_pg_license]
type: puppet
parameters:
puppet_manifest: puppet/manifests/solution_api.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 3000
- id: setup-edge
role: ['compute']
required_for: [post_deployment_end, setup-gateway]

View File

@ -3,6 +3,7 @@ attributes:
restrictions:
- condition: "not (cluster:net_provider == 'neutron' and networking_parameters:segmentation_type == 'vlan')"
message: "Please use Neutron with VLAN segmentation, the only network type supported with PLUMgrid plugin."
group: 'other'
plumgrid_username:
value: "plumgrid"
label: "Enter the username for PLUMgrid"

View File

@ -7,7 +7,7 @@ version: '1.1.0'
# Description
description: This plugin enables the usage of PLUMgrid ONS as the network backend.
# Required fuel version
fuel_version: ['7.0']
fuel_version: ['8.0']
# Specify license of your plugin
licenses: ['Apache License Version 2.0']
authors: ['javeriak@plumgrid.com', 'abdullah.khan@plumgrid.com']
@ -17,7 +17,7 @@ groups: ['network']
# The plugin is compatible with releases in the list
releases:
- os: ubuntu
version: 2015.1.0-7.0
version: liberty-8.0
mode: ['ha', 'multinode']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/ubuntu