L23network: protect some resource names by quotas

This commit is contained in:
Sergey Vasilenko 2013-03-27 16:29:10 +04:00
parent 37f21370de
commit 6f27d930f7
3 changed files with 24 additions and 23 deletions

View File

@ -26,14 +26,14 @@ define l23network::l2::bond (
$ensure = present, $ensure = present,
$skip_existing = false, $skip_existing = false,
) { ) {
if ! defined (L2_ovs_bond[$bond]) { if ! defined (L2_ovs_bond["$bond"]) {
l2_ovs_bond { $bond : l2_ovs_bond { "$bond" :
ports => $ports, ports => $ports,
ensure => $ensure, ensure => $ensure,
bridge => $bridge, bridge => $bridge,
options => $options, options => $options,
skip_existing => $skip_existing, skip_existing => $skip_existing,
} }
Service<| title == 'openvswitch-service' |> -> L2_ovs_bond[$bond] Service<| title == 'openvswitch-service' |> -> L2_ovs_bond["$bond"]
} }
} }

View File

@ -67,43 +67,44 @@ define l23network::l3::create_br_iface (
$gateway_ip_address_for_newly_created_interface = undef $gateway_ip_address_for_newly_created_interface = undef
} }
# Build ovs bridge # Build ovs bridge
l23network::l2::bridge {$bridge: l23network::l2::bridge {"$bridge":
skip_existing => $se, skip_existing => $se,
external_ids => $ext_ids, external_ids => $ext_ids,
} }
if is_array($interface) { if is_array($interface) {
# Build ovs bridge, contains ovs bond with givet interfaces # Build ovs bridge, contains ovs bond with givet interfaces
l23network::l2::bond {$ovs_bond_name: l23network::l2::bond {"$ovs_bond_name":
bridge => $bridge, bridge => $bridge,
ports => $interface, ports => $interface,
options => $ovs_bond_options, options => $ovs_bond_options,
skip_existing => $se, skip_existing => $se,
require => L23network::L2::Bridge[$bridge] require => L23network::L2::Bridge["$bridge"]
} -> } ->
l23network::l3::ifconfig {$interface: l23network::l3::ifconfig {$interface: # do not quotas here, $interface may be array!!!
ipaddr => 'none', ipaddr => 'none',
require => L23network::L2::Bond[$ovs_bond_name], ifname_order_prefix => '0',
before => L23network::L3::Ifconfig[$bridge] require => L23network::L2::Bond["$ovs_bond_name"],
before => L23network::L3::Ifconfig["$bridge"]
} }
} else { } else {
# Build ovs bridge, contains one interface # Build ovs bridge, contains one interface
l23network::l2::port {$interface: l23network::l2::port {$interface:
bridge => $bridge, bridge => $bridge,
skip_existing => $se, skip_existing => $se,
require => L23network::L2::Bridge[$bridge] require => L23network::L2::Bridge["$bridge"]
} -> } ->
l23network::l3::ifconfig {$interface: l23network::l3::ifconfig {"$interface": # USE quotas!!!!!
ipaddr => 'none', ipaddr => 'none',
vlandev => $lnx_interface_vlandev, vlandev => $lnx_interface_vlandev,
require => L23network::L2::Port[$interface],
bond_mode => $lnx_interface_bond_mode, bond_mode => $lnx_interface_bond_mode,
bond_miimon => $lnx_interface_bond_miimon, bond_miimon => $lnx_interface_bond_miimon,
bond_lacp_rate => $lnx_interface_bond_lacp_rate, bond_lacp_rate => $lnx_interface_bond_lacp_rate,
ifname_order_prefix => $interface_order_prefix, ifname_order_prefix => $interface_order_prefix,
before => L23network::L3::Ifconfig[$bridge] require => L23network::L2::Port["$interface"],
before => L23network::L3::Ifconfig["$bridge"]
} }
} }
l23network::l3::ifconfig {$bridge: l23network::l3::ifconfig {"$bridge":
ipaddr => $ipaddr, ipaddr => $ipaddr,
netmask => $netmask, netmask => $netmask,
gateway => $gateway_ip_address_for_newly_created_interface, gateway => $gateway_ip_address_for_newly_created_interface,

View File

@ -200,26 +200,26 @@ define l23network::l3::ifconfig (
} }
if $interfaces { if $interfaces {
if ! defined(File[$interfaces]) { if ! defined(File["$interfaces"]) {
file {$interfaces: file {"$interfaces":
ensure => present, ensure => present,
content => template('l23network/interfaces.erb'), content => template('l23network/interfaces.erb'),
} }
} }
File<| title == $interfaces |> -> File<| title == $if_files_dir |> File<| title == "$interfaces" |> -> File<| title == "$if_files_dir" |>
} }
if ! defined(File[$if_files_dir]) { if ! defined(File["$if_files_dir"]) {
file {$if_files_dir: file {"$if_files_dir":
ensure => directory, ensure => directory,
owner => 'root', owner => 'root',
mode => '0755', mode => '0755',
recurse => true, recurse => true,
} }
} }
File<| title == $if_files_dir |> -> File<| title == $interface_file |> File<| title == "$if_files_dir" |> -> File<| title == "$interface_file" |>
file {$interface_file: file {"$interface_file":
ensure => present, ensure => present,
owner => 'root', owner => 'root',
mode => '0644', mode => '0644',
@ -227,10 +227,10 @@ define l23network::l3::ifconfig (
} }
notify {"ifconfig_${interface}": message=>"Interface:${interface} IP:${ipaddr}/${netmask}", withpath=>false} -> notify {"ifconfig_${interface}": message=>"Interface:${interface} IP:${ipaddr}/${netmask}", withpath=>false} ->
l3_if_downup {$interface: l3_if_downup {"$interface":
check_by_ping => $check_by_ping, check_by_ping => $check_by_ping,
check_by_ping_timeout => $check_by_ping_timeout, check_by_ping_timeout => $check_by_ping_timeout,
subscribe => File[$interface_file], subscribe => File["$interface_file"],
refreshonly => true, refreshonly => true,
} }
} }