From 9c91afaf6c0f3fdb0b3d584104a7f3a458f650c5 Mon Sep 17 00:00:00 2001 From: Kanzhe Jiang Date: Mon, 7 Dec 2015 20:17:32 -0800 Subject: [PATCH] support ceph node Change-Id: I088bc4c59cbf16956e74bb12076012184e560741 --- .../puppet/modules/bcf/manifests/ceph.pp | 22 ++++++++++++++++++- .../puppet/modules/bcf/manifests/compute.pp | 13 +++++------ .../puppet/modules/bcf/manifests/init.pp | 8 +++++-- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/deployment_scripts/puppet/modules/bcf/manifests/ceph.pp b/deployment_scripts/puppet/modules/bcf/manifests/ceph.pp index 5b32a4b..75e0d5c 100644 --- a/deployment_scripts/puppet/modules/bcf/manifests/ceph.pp +++ b/deployment_scripts/puppet/modules/bcf/manifests/ceph.pp @@ -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 ", } diff --git a/deployment_scripts/puppet/modules/bcf/manifests/compute.pp b/deployment_scripts/puppet/modules/bcf/manifests/compute.pp index 1b11ad9..6fb9f83 100644 --- a/deployment_scripts/puppet/modules/bcf/manifests/compute.pp +++ b/deployment_scripts/puppet/modules/bcf/manifests/compute.pp @@ -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 diff --git a/deployment_scripts/puppet/modules/bcf/manifests/init.pp b/deployment_scripts/puppet/modules/bcf/manifests/init.pp index 9654f4e..3fa1b96 100644 --- a/deployment_scripts/puppet/modules/bcf/manifests/init.pp +++ b/deployment_scripts/puppet/modules/bcf/manifests/init.pp @@ -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, ",")