Bug 1020204

Summary: netcf set BONDING_OPTS error, passing more single quote marks
Product: Red Hat Enterprise Linux 7 Reporter: Jincheng Miao <jmiao>
Component: netcfAssignee: Laine Stump <laine>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, berrange, dyuan, honzhang, jiahu, mzhan
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: netcf-0.2.3-6.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 12:19:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Jincheng Miao 2013-10-17 09:32:23 UTC
Description of problem:
While define a nic bonding, libvirt will passing two more single quote marks to BONDING_OPTS in /etc/sysconfig/network-scripts/ifcfg-bond0.
It will cause ifup cann't set mode and primary in /sys/class/net/bond0/bonding/, in other word, bonding mode will not be set correctly.

Version-Release number of selected component (if applicable):
libvirt-1.1.1-9.el7.x86_64
qemu-kvm-rhev-1.5.3-7.el7.x86_64
netcf-0.2.3-4.el7.x86_64

How reproducible:
100%

Steps to Reproduce:

1. prepare a bond xml
# cat bond0.xml
<interface type='bond' name='bond0'>
   <start mode='onboot'/>
   <protocol family='ipv4'>
    <dhcp/>
   </protocol>
  <bond mode='active-backup'>
    <interface type='ethernet' name='em1'>
     </interface>
    <interface type='ethernet' name='em2'>
    </interface>
   </bond>
</interface>

2. define this nic bond
# virsh iface-define bond0.xml
Interface bond0 defined from bond0.xml

3. check BONDING_OPTS 
# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=dhcp
BONDING_OPTS="'mode=active-backup primary=em1'" <=== look here

4. start bond
# virsh iface-start bond0
error: Failed to start interface bond0
error: internal error: failed to create (start) interface bond0: failed to execute external program - Running 'ifup bond0' failed with exit code 1: ./network-functions: line 460: /sys/class/net/bond0/bonding/'mode: No such file or directory
./network-functions: line 460: echo: write error: Invalid argument
./network-functions: line 460: /sys/class/net/bond0/bonding/'mode: No such file or directory
./network-functions: line 460: echo: write error: Invalid argument
./network-functions: line 460: /sys/class/net/bond0/bonding/'mode: No such file or directory
./network-functions: line 460: echo: write error: Invalid argument
./network-functions: line 460: /sys/class/net/bond0/bonding/'mode: No such file or directory
./network-functions: line 460: echo: write error: Invalid argument

Actual results:
ifup fails 

Expected results:
ifup successes

Comment 1 Laine Stump 2013-10-18 08:35:17 UTC
This bug had been reported against netcf for F19 and fixed upstream. Here is the upstream fix, which needs to be backported to the RHEL7 build of netcf:

commit 581ff3f252552cf5edc8e47c4a72667a39e133ba
Author: Satoru SATOH <ssato>
Date:   Wed Jul 3 13:17:27 2013 -0400

    remove extraneous quotes from BONDING_OPTS
    
    This fixes: https://bugzilla.redhat.com/show_bug.cgi?id=798851

Comment 5 Jincheng Miao 2014-01-24 08:22:32 UTC
# rpm -q netcf
netcf-0.2.3-6.el7.x86_64

# cat bond0.xml 
<interface type='bond' name='bond0'>
   <start mode='onboot'/>
   <protocol family='ipv4'>
    <dhcp/>
   </protocol>
  <bond mode='active-backup'>
    <interface type='ethernet' name='em4_1'>
     </interface>
    <interface type='ethernet' name='em4_2'>
    </interface>
   </bond>
</interface>

# ncftool define bond0.xml
Defined interface bond0

# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=dhcp
BONDING_OPTS="mode=active-backup primary=em4_1"

The single quote marks are gone, the bug is fixed, so I change the status to VERIFEID

Comment 6 Ludek Smid 2014-06-13 12:19:21 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.