Bug 798851 - 'BONDING_OPTS' in ifcfg-bondX generated w/ netcf, looks enclosed in extra single quotes
Summary: 'BONDING_OPTS' in ifcfg-bondX generated w/ netcf, looks enclosed in extra si...
Alias: None
Product: Fedora
Classification: Fedora
Component: netcf
Version: 19
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Laine Stump
QA Contact: Fedora Extras Quality Assurance
: 947317 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2012-03-01 05:03 UTC by Satoru SATOH
Modified: 2014-05-14 09:07 UTC (History)
4 users (show)

Clone Of:
Last Closed: 2014-05-14 09:07:01 UTC

Attachments (Terms of Use)

Description Satoru SATOH 2012-03-01 05:03:50 UTC
Description of problem:
The value of the shell variable 'BONDING_OPTS' in ifcfg-bondX 
enclosed in extra single quotes when that configuration was
generated w/ netcf (virsh's iface-define command actually).

Version-Release number of selected component (if applicable):
netcf: 0.1.9-1.fc16, 0.1.9-2.el6 and the latest version in

How reproducible: always

Steps to Reproduce:
1. prepare a XML defines bon0, e.g. iface-bond0.xml:

[root@fedora-17-alpha-0 ~]# cat iface-bond0.xml
<interface type="bond" name="bond0">
  <start mode="none"/>
  <bond mode="active-backup">
    <miimon freq="100" updelay="10" carrier="ioctl"/>
    <interface type="ethernet" name="eth1"/>
    <interface type="ethernet" name="eth2"/>
[root@fedora-17-alpha-0 ~]#

2. run "virsh iface-define iface-bond0.xml" to configure bond0
   (i tried ncftool but looks not like it so that tested w/
   virsh's iface-define command):

[root@fedora-17-alpha-0 ~]# virsh iface-define iface-bond0.xml
インターフェース bond0 が iface-bond0.xml から定義されました

[root@fedora-17-alpha-0 ~]# virsh iface-list --all
名前               状態     MAC アドレス
bond0                動作中  00:00:00:00:00:00
lo                   動作中  00:00:00:00:00:00

[root@fedora-17-alpha-0 ~]#

Actual results:

Here is a log:

[root@fedora-17-alpha-0 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
BONDING_OPTS="'mode=active-backup primary=eth1 miimon=100 updelay=10 use_carrier=0'"
[root@fedora-17-alpha-0 ~]#

The line starts with BONDING_OPTS= maybe wrong, I guess.

Expected results:

Maybe /etc/sysconfig/network-scripts/ifcfg-bond0 should be like:

BONDING_OPTS="mode=active-backup primary=eth1 miimon=100 updelay=10 use_carrier=0"

Additional info:

I'm not sure it's a bug or expected behavior of netcf but the bond0
configuration (ifcfg-bond0) generated w/ netcf (virsh iface-define)
causing the error of ifup in initscripts in RHEL-6:

[root@rhel-6-2-client-0 ~]# virsh iface-define /root/iface-bond0.xml 
Interface bond0 defined from /root/iface-bond0.xml

[root@rhel-6-2-client-0 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 
BONDING_OPTS="'mode=active-backup primary=eth1 miimon=100 updelay=10 use_carrier=0'"
[root@rhel-6-2-client-0 ~]# LANG=en_US.UTF-8 ifup bond0
/etc/sysconfig/network-scripts/ifup-eth: line 136: /sys/class/net/bond0/bonding/'mode: No such file or directory
[root@rhel-6-2-client-0 ~]#

and the above problem looks solved if tried the patch for netcf such as:

--- /usr/share/netcf/xml/util-get.xsl.org       2012-02-01 19:44:06.895277800 +0900
+++ /usr/share/netcf/xml/util-get.xsl   2012-02-01 20:25:21.537130053 +0900
@@ -3,7 +3,6 @@

   <xsl:template name="bonding-opts">
-    <xsl:text>'</xsl:text>
     <xsl:if test="bond/@mode">mode=<xsl:value-of select='bond/@mode'/></xsl:if>
     <xsl:if test="bond/@mode = 'active-backup'"> primary=<xsl:value-of select='bond/interface[1]/@name'/></xsl:if>
     <xsl:if test="bond/miimon">
@@ -21,7 +20,6 @@
       <xsl:text> arp_ip_target=</xsl:text><xsl:value-of select="bond/arpmon/@target"/>
       <xsl:if test="bond/arpmon/@validate"><xsl:text> arp_validate=</xsl:text><xsl:value-of select="bond/arpmon/@validate"/></xsl:if>
-    <xsl:text>'</xsl:text>


Comment 3 Cole Robinson 2013-07-02 17:11:23 UTC
Actually laine that patch seems right to me, and this still appears to be an issue with F19 at least. Even if no BONDING_OPTS are specified netcf still writes BONDING_OPTS="''" which doesn't seem right.

Comment 4 Laine Stump 2013-07-02 21:55:19 UTC
I just tried that patch, and it does seem to work okay when there are options, but when there are no options, it adds this:


I supposed that should be okay, since it's just explicitly setting to nothing something that was already nothing.

Can you think of any reason that would cause a problem? If not, I'll push the patch and it will be included the next time there's a netcf release.

Comment 5 Cole Robinson 2013-07-03 14:49:56 UTC
AFAIK that should be fine, I think anything that parses the ifcfg files should expect to handle an empty variable.

Comment 6 Cole Robinson 2014-02-01 18:47:24 UTC
*** Bug 947317 has been marked as a duplicate of this bug. ***

Comment 7 Laine Stump 2014-05-14 09:07:01 UTC
This is fixed in upstream netcf commit 581ff3f252552cf5edc8e47c4a72667a39e133ba, and will be in the next release, 0.2.4.

Note You need to log in before you can comment on or make changes to this bug.