Stop use deprecated method to fetch nodes info

Nodes hash become a deprecated structure, replace it with
network_metadata.

Change-Id: I051af35436c1ba2e86331a2223ccc78114ecbac2
This commit is contained in:
Michal Skalski 2016-03-01 10:44:02 +01:00
parent 0a2eac61af
commit a4f66177e1
13 changed files with 35 additions and 32 deletions

View File

@ -1,2 +1,3 @@
notice('MODULAR: hiera-override')
include opendaylight
class { '::opendaylight::hiera_override': }

View File

@ -3,9 +3,7 @@ notice('MODULAR: neutron-configuration.pp')
include opendaylight
$use_neutron = hiera('use_neutron', false)
$odl = hiera('opendaylight')
$nodes_hash = hiera('nodes', {})
$roles = node_roles($nodes_hash, hiera('uid'))
$management_vip = hiera('management_vip')
if $use_neutron {
@ -13,13 +11,13 @@ if $use_neutron {
ensure => installed,
}
$ovsdb_managers = odl_ovsdb_managers($opendaylight::odl_mgmt_ips)
exec { 'ovs-set-manager':
command => "ovs-vsctl set-manager tcp:${opendaylight::manager_ip_address}:6640",
command => "ovs-vsctl set-manager $ovsdb_managers",
path => '/usr/bin'
}
if $odl['enable_l3_odl'] or member($roles, 'primary-controller') or member($roles, 'controller') {
if $odl['enable_l3_odl'] or roles_include(['primary-controller', 'controller']) {
$patch_jacks_names = get_pair_of_jack_names(['br-ex', 'br-ex-lnx'])
$ext_interface = $patch_jacks_names[0]
}

View File

@ -1,3 +1,4 @@
notice('MODULAR: odl-install.pp')
include opendaylight
include firewall

View File

@ -1,7 +1,6 @@
notice('MODULAR: odl-netconfig.pp')
$nodes_hash = hiera('nodes', {})
$roles = node_roles($nodes_hash, hiera('uid'))
$roles = hiera('roles')
$network_scheme = odl_network_scheme($roles)

View File

@ -1,8 +1,7 @@
notice('MODULAR: configure_default_route.pp')
$nodes_hash = hiera('nodes', {})
$roles = node_roles($nodes_hash, hiera('uid'))
$roles = hiera('roles')
$network_scheme = odl_network_scheme($roles)
$management_vrouter_vip = hiera('management_vrouter_vip')
$management_role = 'management'

View File

@ -1 +1,2 @@
notice('MODULAR: odl-service.pp')
class { 'opendaylight::service':}

View File

@ -0,0 +1,12 @@
module Puppet::Parser::Functions
newfunction(:odl_ovsdb_managers, :type => :rvalue) do |args|
raise Puppet::ParseError, 'Only one argument with array of IP addresses should be provided!' if args.size != 1
raise Puppet::ParseError, 'Argument should be array of IP addresses' unless args[0].is_a? Array
ips = args[0]
managers = []
ips.each do |manager|
managers << "tcp:#{manager}:6640"
end
managers.join(' ')
end
end

View File

@ -17,18 +17,15 @@ class opendaylight::ha::haproxy {
$public_vip = hiera('public_vip')
$management_vip = hiera('management_vip')
$nodes_hash = hiera('nodes')
$odl = hiera('opendaylight')
$api_port = $odl['rest_api_port']
$primary_controller_nodes = filter_nodes($nodes_hash,'role','primary-controller')
$odl_controllers = filter_nodes($nodes_hash,'role','opendaylight')
# defaults for any haproxy_service within this class
Openstack::Ha::Haproxy_service {
internal_virtual_ip => $management_vip,
ipaddresses => filter_hash($odl_controllers, 'internal_address'),
ipaddresses => $opendaylight::odl_mgmt_ips,
public_virtual_ip => $public_vip,
server_names => filter_hash($odl_controllers, 'name'),
server_names => $opendaylight::odl_nodes_names,
public => true,
internal => true,
}

View File

@ -1,7 +1,6 @@
class opendaylight::hiera_override {
$override_file = '/etc/hiera/override/opendaylight.yaml'
$nodes_hash = hiera('nodes', {})
$roles = node_roles($nodes_hash, hiera('uid'))
$roles = hiera('roles')
odl_hiera_overrides($override_file, $roles)
file_line {'opendaylight_hiera_override':

View File

@ -1,11 +1,11 @@
class opendaylight {
$odl_settings = hiera('opendaylight')
$nodes_hash = hiera('nodes')
$odl_controller_hash = filter_nodes($nodes_hash,'role','opendaylight')
$node = filter_nodes($nodes_hash,'name',$::hostname)
$network_metadata = hiera_hash('network_metadata')
$node_uid = hiera('uid')
$rest_api_port = $odl_settings['rest_api_port']
$manager_ip_address = $odl_controller_hash[0]['internal_address']
$node_private_address = $node[0]['private_address']
$node_internal_address = $node[0]['internal_address']
$odl_nodes_hash = get_nodes_hash_by_roles($network_metadata, ['opendaylight'])
$odl_mgmt_ips_hash = get_node_to_ipaddr_map_by_network_role($odl_nodes_hash, 'management')
$odl_mgmt_ips = values($odl_mgmt_ips_hash)
$odl_nodes_names = keys($odl_mgmt_ips_hash)
$node_internal_address = $odl_mgmt_ips_hash["node-${node_uid}"]
}

View File

@ -3,8 +3,6 @@ class opendaylight::install (
$bind_address = undef,
) {
$nodes_hash = hiera('nodes', {})
$roles = node_roles($nodes_hash, hiera('uid'))
$management_vip = hiera('management_vip')
$odl = hiera('opendaylight')
$conf_dir = '/opt/opendaylight/etc'

View File

@ -1,13 +1,11 @@
class opendaylight::service {
$nodes_hash = hiera('nodes', {})
$roles = node_roles($nodes_hash, hiera('uid'))
include opendaylight
include opendaylight::ha::haproxy
$management_vip = hiera('management_vip')
$odl = hiera('opendaylight')
$rest_port = $odl['rest_api_port']
include opendaylight::ha::haproxy
if member($roles, 'primary-controller') {
if roles_include(['primary-controller']) {
exec { 'wait-until-odl-ready':
command => "curl -o /dev/null --fail --silent --head -u admin:admin http://${management_vip}:${rest_port}/restconf/operational/network-topology:network-topology/topology/netvirt:1",
path => '/bin:/usr/bin',

View File

@ -12,7 +12,7 @@
type: puppet
groups: [opendaylight]
requires: [deploy_start]
required_for: [openstack-network-start, odl_configure]
required_for: [openstack-network-start, odl_configure, cluster-haproxy]
requires: [hosts, firewall, globals]
parameters:
puppet_manifest: puppet/manifests/odl-install.pp