Bug 735950

Summary: The network xml with mutiple dhcp sections can be defined and started successfully although there is prompt error
Product: Red Hat Enterprise Linux 6 Reporter: xhu
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: dallan, dyuan, mshao, mzhan, rwu, whuang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.9-1.el6 Doc Type: Bug Fix
Doc Text:
No Documentation needed
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 06:31:05 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 xhu 2011-09-06 09:10:38 UTC
Description of problem:
The network xml with mutiple dhcp sections can be defined successfully although there is prompt error

Version-Release number of selected component (if applicable):
libvirt-0.9.4-7.el6.x86_64
qemu-kvm-0.12.1.2-2.185.el6.x86_64
kernel-2.6.32-193.el6.x86_64

How reproducible:
everytimes

Steps to Reproduce:
1. prepare the following network xml with multiple dhcp sections:
# cat multi-dhcp.xml 
<network>
  <name>multi-dhcp</name>
  <forward mode='nat'/>
  <bridge name='virbr10' stp='on' delay='0' />
  <ip address='192.168.201.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.201.2' end='192.168.201.254' />
    </dhcp>
  </ip>
  <ip address='192.168.202.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.202.2' end='192.168.202.254' />
    </dhcp>
  </ip>
  <ip family='ipv6' address='2003:db8:ac10:fe01::1' prefix='64'>
  </ip>
</network>

2. define and start the multi-dhcp network
# virsh net-define multi-dhcp.xml
error: Failed to define network from multi-dhcp.xml
error: unsupported configuration: Multiple dhcp sections found. dhcp is supported only for a single IPv4 address on each network

# echo $?
1

# virsh net-list --all
Name                 State      Autostart
-----------------------------------------    
multi-dhcp           inactive   no

# virsh net-start multi-dhcp
Network multi-dhcp started

Actual results:
The network xml with mutiple dhcp sections can succeed be defined and started although there is prompt error

Expected results:
The network xml with mutiple dhcp sections can not be defined and started successfully

Additional info:

Comment 2 Peter Krempa 2011-12-01 08:55:59 UTC
Fixed with upstream commit:
commit 0763a26dfef240e301e19b9c563c10462e72f255
Author: Peter Krempa <pkrempa>
Date:   Wed Nov 30 15:26:25 2011 +0100

    bridge_driver: Don't define network if XML contains more IPv4 adreses.
    
    Only one IPv4 DHCP definition is supported. Originally the code checked
    for a multiple definition and returned an error, but the new domain
    definition was already added to networks. This patch moves the check
    before the newly defined network is added to active networks.
    
     *src/network/bridge_driver.c: networkDefine(): - move multiple IPv4
                                                      addresses check before
                                                      definition is used.


Tested with XML provided in report:

virsh # net-define network.xml 
error: Failed to define network from network.xml
error: unsupported configuration: Multiple dhcp sections found. dhcp is supported only for a single IPv4 address on each network

virsh # net-list --all
Name                 State      Autostart
-----------------------------------------
default              active     yes       

virsh #

Comment 4 xhu 2012-01-10 08:23:08 UTC
Verify it with libvirt-0.9.9-1.el6 and it passed.

Comment 6 Peter Krempa 2012-05-02 09:55:26 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No Documentation needed

Comment 8 errata-xmlrpc 2012-06-20 06:31:05 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/RHSA-2012-0748.html