Bug 879055

Summary: Error due to extraneous quotes in BONDING_OPTS when creating a bonding interface
Product: Red Hat Enterprise Linux 6 Reporter: Raul Leite <rleite>
Component: netcfAssignee: Laine Stump <laine>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3CC: codong, cwei, dyuan, honzhang, jiahu, lcui, mjenner, mkletzan, mzhan, rbalakri, tlavigne, tzheng
Target Milestone: rc   
Target Release: 6.3   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: netcf-0.2.4-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 947317 (view as bug list) Environment:
Last Closed: 2014-10-14 06:43:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 947317    
Attachments:
Description Flags
log file with virt-manager --debug none

Description Raul Leite 2012-11-21 23:24:21 UTC
Description of problem:
Error on "virt-manager" when create bonding interfaces by interface(API)

Version-Release number of selected component (if applicable):

How reproducible:

When sysadmin tries to create a bond interface by API of (virt-manager), they put a wrongs single quotes inside of configuration file on "/etc/sysconfig/network-scripts/ifcfg-<bond_name>", and if you check /proc/net/bonding/<bond_name> status they don't show a correct mode selected by sysadmin, As show bellow :

Wrong
BONDING_OPTS="'mode=active-backup'" 

Should be
BONDING_OPTS="mode=active-backup" 

Wihout '' (single quotes).


Steps to Reproduce:
1. Setting up a bond interface by virt-manager API
2.
3.
  
Actual results:
Error on configuration /etc/sysconfig/network-scripts/ifcfg-<bond_name>


Expected results:


Additional info:

Comment 2 Raul Leite 2012-11-21 23:52:34 UTC
virt-manager version is "virt-manager-0.9.0-14.el6.x86_64" 
Red Hat Enterprise Linux Server release 6.3 (Santiago)

Comment 3 Raul Leite 2012-11-21 23:54:17 UTC
*** Bug 879054 has been marked as a duplicate of this bug. ***

Comment 4 Dave Allan 2012-11-26 14:16:26 UTC
1. Setting up a bond interface by virt-manager API

Can you provide some more details on what you're doing?

Comment 6 Raul Leite 2012-12-05 20:27:48 UTC
Hi, I meant, GUI not API, it was my mistake, sorry about that. 

I have used these steps : 
Open virt-manager >> Virtual Networks >> Add >> Bonding Interfaces 'option'

virt-manager-0.9.0-14.el6.x86_64

Comment 8 Martin Kletzander 2013-03-14 14:02:02 UTC
Can you reproduce that with 'virt-manager --debug' and attach the output?  This might go as down as netcf.

Comment 9 CongDong 2013-04-07 05:28:38 UTC
Created attachment 732264 [details]
log file with virt-manager --debug

I can reproduce this bug on RHEL6.4, and add the log file "virt-manager.log" with virt-manager --debug to attachment.

Comment 10 Martin Kletzander 2013-05-09 12:39:52 UTC
This looks like the same problem as bug #921621, So I'm reassigning to netcf.

Comment 13 tingting zheng 2014-05-08 09:17:15 UTC
I can still reproduce this issue with:
netcf-libs-0.1.9-4.el6_5.2.x86_64
virt-manager-0.9.0-21.el6.x86_64
libvirt-0.10.2-34.el6.x86_64

Steps to Reproduce:
 1. # service NetworkManager stop
 2. #virt-manager --debug -> Edit -> Connection details -> Network Interface -> "+"(Add) -> "Interface type"-> "Bond" -> Forward
 3. Configure the bond like this:
    Start mode: hotplug
    Active now:  check on
    IP setting: IPv4: DHCP
     Choose interfaces to bond:  eth0.
   Click "Finish"
 4. An error will popup like this:
 Error creating interface: 'Could not create interface: internal error failed to create (start) interface bond0: failed to execute external program -     Running 'ifup bond0' failed with exit code 1: ./network-functions: line 457: /sys/class/net/bond0/bonding/'mode: No such file or directory
 ./network-functions: line 457: /sys/class/net/bond0/bonding/'mode: No such file or directory
 ./network-functions: line 457: /sys/class/net/bond0/bonding/'mode: No such file or directory
 ./network-functions: line 457: /sys/class/net/bond0/bonding/'mode: No such file or directory

 Determining IP information for bond0... failed; no link present.  Check cable?
 ' : Error creating interface: 'Could not create interface: internal error failed to create (start) interface bond0: failed to execute external program - Running 'ifup bond0' failed with exit code 1:  ./network-functions: line 457: /sys/class/net/bond0/bonding/'mode: No such file or directory
 ./network-functions: line 457: /sys/class/net/bond0/bonding/'mode: No such file or directory
 ./network-functions: line 457: /sys/class/net/bond0/bonding/'mode: No such file or directory
 ./network-functions: line 457: /sys/class/net/bond0/bonding/'mode: No such file or directory

 Determining IP information for bond0... failed; no link present.  Check cable?
'

5.When I choose start mode "none" then I can create bond interface successfully,when I try to destroy the interface,error will show from virt-manager GUI:
XML error: bond interface misses the bond element

Comment 14 Laine Stump 2014-05-14 09:14:52 UTC
This is fixed upstream in the following commit:

commit 581ff3f252552cf5edc8e47c4a72667a39e133ba
Author: Satoru SATOH <ssato@redhat.com>
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
    
    For some unknown reason, the BONDING_OPTS setting in ifcfg files was
    being set with an extra set of single quotes. So, for example, instead of:
    
      BONDING_OPTS="mode=active-backup primary=eth1 miimon=100 updelay=10 use_carrier=0"
    
    we would get (e.g.):
    
      BONDING_OPTS="'mode=active-backup primary=eth1 miimon=100 updelay=10 use_carrier=0'"
    
    Even when there weren't any BONDING_OPTS to set, the ifcfg file would
    still get:
    
      BONDING_OPTS="''"
    
    Since the extra quotes are added in all cases, and are never needed,
    this patch just unconditionally removes them.

Comment 18 Hu Jianwei 2014-05-20 03:08:03 UTC
I can reproduce it on below version,detail steps as below.

Version:
netcf-0.1.9-4.el6.x86_64
libvirt-0.10.2-36.el6.x86_64
kernel-2.6.32-459.el6.x86_64

[root@intel-3323-24-1 ~]# cat bond1_none.xml 
<interface type='bond' name='bond1'>
<start mode='none'/>
<protocol family='ipv4'>
<dhcp/>
</protocol>
<bond>
<interface type='ethernet' name='eth0'>
</interface>
</bond>
</interface>
[root@intel-3323-24-1 ~]# virsh iface-define bond1_none.xml 
Interface bond1 defined from bond1_none.xml

[root@intel-3323-24-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond1 
DEVICE=bond1
ONBOOT=no
BOOTPROTO=dhcp
BONDING_OPTS="''"

[root@intel-3323-24-1 ~]# cat bond0.xml 
<interface type='bond' name='bond0'>
<start mode='none'/>
<protocol family='ipv4'>
<dhcp/>
</protocol>
<bond mode='active-backup'>
<miimon freq='100' updelay='10' carrier='ioctl'/>
<interface type='ethernet' name='eth0'>
</interface>
</bond>
</interface>
[root@intel-3323-24-1 ~]# virsh iface-define bond0.xml 
Interface bond0 defined from bond0.xml

[root@intel-3323-24-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=no
BOOTPROTO=dhcp
BONDING_OPTS="'mode=active-backup primary=eth0 miimon=100 updelay=10 use_carrier=0'"


But I can not reproduce it on the new version, verify the bug as below:

Version:
netcf-0.2.4-1.el6.x86_64
libvirt-0.10.2-36.el6.x86_64
kernel-2.6.32-459.el6.x86_64
virt-manager-0.9.0-21.el6.x86_64

1. Using virsh command
[root@intel-3323-24-1 ~]# cat bond1_none.xml 
<interface type='bond' name='bond1'>
<start mode='none'/>
<protocol family='ipv4'>
<dhcp/>
</protocol>
<bond>
<interface type='ethernet' name='eth0'>
</interface>
</bond>
</interface>
[root@intel-3323-24-1 ~]# virsh iface-define bond1_none.xml 
Interface bond1 defined from bond1_none.xml
          
[root@intel-3323-24-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond1 
DEVICE=bond1
ONBOOT=no
BOOTPROTO=dhcp
BONDING_OPTS=
	
[root@intel-3323-24-1 ~]# cat bond0.xml 
<interface type='bond' name='bond0'>
<start mode='none'/>
<protocol family='ipv4'>
<dhcp/>
</protocol>
<bond mode='active-backup'>
<miimon freq='100' updelay='10' carrier='ioctl'/>
<interface type='ethernet' name='eth0'>
</interface>
</bond>
</interface>
             
[root@intel-3323-24-1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=no
BOOTPROTO=dhcp
BONDING_OPTS="mode=active-backup primary=eth0 miimon=100 updelay=10 use_carrier=0"


2. Verify it using virt-manager, follow comment 13's reproducible steps.
2014-05-20 10:59:01,135 (connection:578): Connection managed save support: True
2014-05-20 10:59:01,188 (connection:160): Using libvirt API for netdev enumeration
2014-05-20 10:59:01,192 (connection:200): Using libvirt API for mediadev enumeration
2014-05-20 10:59:03,296 (engine:471): window counter incremented to 2
2014-05-20 10:59:07,177 (host:944): Launching 'Add Interface' wizard
2014-05-20 10:59:22,861 (Interface:237): Creating interface 'bond0' with xml:
<interface type='bond' name='bond0'>
  <start mode='hotplug'/>
  <protocol family='ipv4'>
    <dhcp/>
  </protocol>
  <bond mode='active-backup'>
    <interface name='eth5' type='ethernet'/>
  </bond>
</interface>

2014-05-20 10:59:24,289 (engine:426): Tick is slow, not running at requested rate.
2014-05-20 10:59:32,603 (createinterface:1147): Install completed
^C2014-05-20 10:59:46,885 (virt-manager:402): Received KeyboardInterrupt. Exiting application.

[root@sriov2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 
DEVICE=bond0
ONBOOT=no
HOTPLUG=yes
BOOTPROTO=dhcp
BONDING_OPTS="mode=active-backup primary=eth5"

So change to Verified.

Comment 19 errata-xmlrpc 2014-10-14 06:43:19 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1475.html