[netcf-devel] [PATCH 1/2] redhat-put: fix identification of bonds with no slaves

Laine Stump laine at laine.org
Thu May 28 20:36:41 UTC 2015


From: Lubomir Rintel <lkundrak at v3.sk>

bond devices with no slaves were being misidentified as plain ethernet
devices. This patch checks for BONDING_OPTS in the bond's own ifcfg
file rather than looking for other ifcfg files that list this one as
MASTER.

  $ cat /etc/sysconfig/network-scripts/ifcfg-bond
  DEVICE=nm-bond
  TYPE=Bond
  BONDING_MASTER=yes
  BOOTPROTO=none
  DEFROUTE=yes
  IPV4_FAILURE_FATAL=no
  IPV6INIT=yes
  IPV6_AUTOCONF=yes
  IPV6_DEFROUTE=yes
  IPV6_FAILURE_FATAL=no
  NAME=bond
  UUID=66a3c5c4-1106-4a86-aa33-18ac5c7c20f2
  ONBOOT=yes
  BONDING_OPTS=mode=balance-rr
  IPADDR=1.2.3.4
  PREFIX=8
  IPV6_PEERDNS=yes
  IPV6_PEERROUTES=yes

  $ ncftool dumpxml nm-bond
  <?xml version="1.0"?>
  <interface type="ethernet" name="nm-bond">
    <start mode="onboot"/>
    <protocol family="ipv4">
      <ip address="1.2.3.4" prefix="8"/>
    </protocol>
    <protocol family="ipv6">
      <autoconf/>
    </protocol>
  </interface>
---
 data/xml/redhat-put.xsl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/data/xml/redhat-put.xsl b/data/xml/redhat-put.xsl
index ed56c66..21bd4ce 100644
--- a/data/xml/redhat-put.xsl
+++ b/data/xml/redhat-put.xsl
@@ -135,7 +135,7 @@
   </xsl:template>
 
   <xsl:template name="bond-interface"
-                match="tree[node[@label = 'DEVICE'][@value = //tree/node[@label = 'MASTER']/@value]][count(node[@label = 'BRIDGE']) = 0]">
+                match="tree[count(node[@label = 'BONDING_OPTS']) > 0][count(node[@label = 'BRIDGE']) = 0]">
     <interface type="bond">
       <xsl:call-template name="name-attr"/>
       <xsl:call-template name="startmode"/>
-- 
2.1.0



More information about the netcf-devel mailing list