<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 05/28/2015 04:36 PM, Laine Stump
wrote:<br>
</div>
<blockquote
cite="mid:1432845402-24683-2-git-send-email-laine@laine.org"
type="cite">
<pre wrap="">From: Lubomir Rintel <a class="moz-txt-link-rfc2396E" href="mailto:lkundrak@v3.sk"><lkundrak@v3.sk></a>
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.</pre>
</blockquote>
<br>
(The above description was added by me. Please correct if it's
wrong)<br>
<pre wrap="">As a complete novice with xslt, this is what I understand from that code
(someone else wrote all of the xslt in netcf, and it has sat mostly
dormant for several years).</pre>
<br>
<blockquote
cite="mid:1432845402-24683-2-git-send-email-laine@laine.org"
type="cite">
<pre wrap="">
$ 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"/>
</pre>
</blockquote>
<br>
<pre wrap="">I <b class="moz-txt-star"><span class="moz-txt-tag">*</span>think<span class="moz-txt-tag">*</span></b> ACK, but I have a couple of questions before I push this:
1) Is a BONDING_OPTS attribute required in an ifcfg file for a bond? If
it is, this change is okay, but if not we will need to find some other
way to identify bond devices.
2) what does the "[count(node[@label = 'BRIDGE']) = 0]" do? does that
exclude from the match any ifcfg that has an attribute named "BRIDGE"?
If so, that doesn't seem correct, because it's acceptable for a bond
device to be attached to a bridge. (yes, I know that part was in the
expression before, but as I said this code was written by someone else
and has been mostly untouched for 4 years or so).</pre>
</body>
</html>