support ceph node

Change-Id: I088bc4c59cbf16956e74bb12076012184e560741
This commit is contained in:
Kanzhe Jiang 2015-12-07 20:17:32 -08:00
parent acb28c48d1
commit 9c91afaf6c
3 changed files with 33 additions and 10 deletions

View File

@ -15,10 +15,30 @@
#
class bcf::ceph {
include bcf
include bcf::params
# all of the exec statements use this path
$binpath = "/usr/local/bin/:/bin/:/usr/bin:/usr/sbin:/usr/local/sbin:/sbin"
$ifcfg_bond0 = "/etc/network/interfaces.d/ifcfg-bond0"
if $bcf::bond {
# ensure bond-mode is 802.3ad
exec { "ensure ${bcf::bond_lacp} in $ifcfg_bond0":
command => "echo '${bcf::bond_lacp}' >> $ifcfg_bond0",
unless => "grep -qe '${bcf::bond_lacp}' -- $ifcfg_bond0",
path => "/bin:/usr/bin",
require => Exec["update bond-mode in $ifcfg_bond0"],
}
exec { "update bond-mode in $ifcfg_bond0":
command => "sed -i 's/bond-mode.*/${bcf::bond_lacp}/' $ifcfg_bond0",
path => "/bin:/usr/bin"
}
$sys_desc = $bcf::sys_desc_lacp
}
else {
$sys_desc = $bcf::sys_desc_xor
}
# lldp
file { "/bin/send_lldp":
ensure => file,
@ -32,7 +52,7 @@ start on runlevel [2345]
stop on runlevel [!2345]
respawn
script
exec /bin/send_lldp --system-desc 5c:16:c7:00:00:04 --system-name $(uname -n) -i 10 --network_interface %(uplinks)s
exec /bin/send_lldp --system-desc $sys_desc --system-name $(uname -n) -i 10 --network_interface $bcf::itfs
end script
",
}

View File

@ -21,25 +21,24 @@ class bcf::compute {
$binpath = "/usr/local/bin/:/bin/:/usr/bin:/usr/sbin:/usr/local/sbin:/sbin"
$ifcfg_bond0 = "/etc/network/interfaces.d/ifcfg-bond0"
$bond_lacp = "bond-mode 4"
$sys_desc_lacp = "5c:16:c7:00:00:04"
$sys_desc_xor = "5c:16:c7:00:00:00"
if $bcf::bond {
# ensure bond-mode is 802.3ad
exec { "ensure $bond_lacp in $ifcfg_bond0":
command => "echo '$bond_lacp' >> $ifcfg_bond0",
unless => "grep -qe '$bond_lacp' -- $ifcfg_bond0",
exec { "ensure ${bcf::bond_lacp} in $ifcfg_bond0":
command => "echo '${bcf::bond_lacp}' >> $ifcfg_bond0",
unless => "grep -qe '${bcf::bond_lacp}' -- $ifcfg_bond0",
path => "/bin:/usr/bin",
require => Exec["update bond-mode in $ifcfg_bond0"],
}
exec { "update bond-mode in $ifcfg_bond0":
command => "sed -i 's/bond-mode.*/$bond_lacp/' $ifcfg_bond0",
command => "sed -i 's/bond-mode.*/${bcf::bond_lacp}/' $ifcfg_bond0",
path => "/bin:/usr/bin"
}
$sys_desc = $sys_desc_lacp
$sys_desc = $bcf::sys_desc_lacp
}
else {
$sys_desc = $sys_desc_xor
$sys_desc = $bcf::sys_desc_xor
}
# lldp

View File

@ -14,12 +14,16 @@
# under the License.
#
class bcf {
$bond_lacp = "bond-mode 4"
$sys_desc_lacp = "5c:16:c7:00:00:04"
$sys_desc_xor = "5c:16:c7:00:00:00"
# Network configuration
$network_scheme = hiera_hash('network_scheme', {})
prepare_network_config($network_scheme)
$gw = get_default_gateways()
#$phy_devs = get_network_role_property('neutron/private', 'phys_dev')
$phy_devs = "eth0"
$phy_devs = get_network_role_property('neutron/private', 'phys_dev')
$if_str = "$phy_devs"
if $if_str =~ /^bond.*/ {
$ifaces = join($phy_devs, ",")