Bug 798851

Summary: 'BONDING_OPTS' in ifcfg-bondX generated w/ netcf, looks enclosed in extra single quotes
Product: [Fedora] Fedora Reporter: Satoru SATOH <ssato>
Component: netcfAssignee: Laine Stump <laine>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: codong, crobinso, hbrock, laine
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-05-14 09:07:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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
fedora-17-alpha.


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"/>
  </bond>
</interface>
[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
DEVICE=bond0
ONBOOT=no
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:

DEVICE=bond0
ONBOOT=no
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 
DEVICE=bond0
ONBOOT=no
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 @@
                 version="1.0">

   <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:if>
-    <xsl:text>'</xsl:text>
   </xsl:template>

 </xsl:stylesheet>

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:

  BONDING_OPTS=

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.