Discussion:
[netcf-devel] [PATCH] Properly classify bond devices with no slaves
Laine Stump
2015-10-13 18:57:01 UTC
Permalink
Although initscripts only considers an interface to be a bond if it
has slaves, there are times when setting up a bond, or testing, when a
bond may not have any slaves (yet) but does have a BONDING_OPTS
attribute. Previously in those situations netcf would identify the
interface as a plain ethernet. This patch makes the check more
inclusive - now any interface with slaves *or* with a BONDING_OPTS
attribute is considered to be a bond.

This patch was inspired by an earlier patch sent by Lubomir Rintel
which looked for BONDING_OPTS *instead of* looking for slaves.
---

After asking a couple questions about Lubomir's original patch last
May, I forgot about this until today; I took the time to figure out
how to combine the old and new expressions, and it seems to work well
with example bond definitions having all combinations of with/without
BONDING_OPTS/slaves.

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..89145e5 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']) or (node[@label = 'DEVICE'][@value = //tree/node[@label = 'MASTER']/@value])][count(node[@label = 'BRIDGE']) = 0]">
<interface type="bond">
<xsl:call-template name="name-attr"/>
<xsl:call-template name="startmode"/>
--
2.4.3
Eric Blake
2015-10-13 20:29:53 UTC
Permalink
Post by Laine Stump
Although initscripts only considers an interface to be a bond if it
has slaves, there are times when setting up a bond, or testing, when a
bond may not have any slaves (yet) but does have a BONDING_OPTS
attribute. Previously in those situations netcf would identify the
interface as a plain ethernet. This patch makes the check more
inclusive - now any interface with slaves *or* with a BONDING_OPTS
attribute is considered to be a bond.
This patch was inspired by an earlier patch sent by Lubomir Rintel
which looked for BONDING_OPTS *instead of* looking for slaves.
---
After asking a couple questions about Lubomir's original patch last
<xsl:template name="bond-interface"
Not sure if you can break up long lines in xsl.

ACK.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Laine Stump
2015-10-14 01:40:39 UTC
Permalink
Post by Eric Blake
Post by Laine Stump
Although initscripts only considers an interface to be a bond if it
has slaves, there are times when setting up a bond, or testing, when a
bond may not have any slaves (yet) but does have a BONDING_OPTS
attribute. Previously in those situations netcf would identify the
interface as a plain ethernet. This patch makes the check more
inclusive - now any interface with slaves *or* with a BONDING_OPTS
attribute is considered to be a bond.
This patch was inspired by an earlier patch sent by Lubomir Rintel
which looked for BONDING_OPTS *instead of* looking for slaves.
---
After asking a couple questions about Lubomir's original patch last
<xsl:template name="bond-interface"
Not sure if you can break up long lines in xsl.
Heh. Me too. Since the other long strings in the file were on a single
line, I just stuck with that.

/me haz 0 xsl sk1llz.
Post by Eric Blake
ACK.
Thanks!

Loading...