Bug 869913

Summary: libvirt doesn't verify the network XML files when creating transient networks and the dnsmasq persistent host file is not created
Product: Red Hat Enterprise Linux 6 Reporter: zhenfeng wang <zhwang>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: acathrow, ajia, cwei, dallan, dyuan, gsun, mzhan, shyu
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-04 21:00:23 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:
Embargoed:

Description zhenfeng wang 2012-10-25 06:41:03 UTC
Description of problem:
The network xml with mutiple dhcp sections can be created successfully although the guest can't get the address from the different sections

Version-Release number of selected component (if applicable):
kernel-2.6.32-330.el6.x86_64
kernel-2.6.32-323.el6.x86_64
libvirt-0.10.2-5.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1# 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.2' />
    </dhcp>
  </ip>
  <ip address='192.168.202.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.202.2' end='192.168.202.2' />
    </dhcp>
  </ip>
  <ip family='ipv6' address='2003b8:ac10:fe01::1' prefix='64'>
  </ip>
</network>

2 # virsh net-create multi-dhcp.xml
Network multi-dhcp created from multi-dhcp.xml
# virsh net-list
Name                 State      Autostart     Persistent
--------------------------------------------------
default              active     yes           yes
multi-dhcp           active     no            no

3 prepare two guests,and the guest should have the network interface like this
    <interface type='network'>
      <mac address='52:54:00:e5:4e3'/>
      <source network='multi-dhcp'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

4 start the guests,then login the guests ,and found that the guest can only got the address from the first section,
can't got ip address from another one,so one of the guests can't get the ip address

5 The libvirtd didn't support define the multiple dhcp sections ,refer to bug 735950
# virsh net-define muti-dhcp.xml
error: Failed to define network from muti-dhcp.xml
error: unsupported configuration: Multiple dhcp sections found. dhcp is supported only for a single IPv4 address on each network

Actual results:
we can create the network successfully,but it can't allocat mutiple dhcp sections' address

Expected results:
From step 5 ,wo knew that the libvirtd didn't support multiple dhcp sections with "virsh net-define" command ,so I think we shouldn't create the netork with the "virsh net-create"command too. And it should report an error as the "virsh net-define" command

Additional info
the log in host
Oct 25 13:34:00 intel-8400-8-1 dnsmasq-dhcp[27175]: DHCPDISCOVER(virbr11) 192.168.122.252 52:54:00:56:22:67 no address available
Oct 25 13:34:04 intel-8400-8-1 dnsmasq-dhcp[27175]: DHCPDISCOVER(virbr11) 192.168.122.252 52:54:00:56:22:67 no address available
Oct 25 13:34:12 intel-8400-8-1 dnsmasq-dhcp[27175]: DHCPDISCOVER(virbr11) 192.168.122.252 52:54:00:56:22:67 no address available
Oct 25 13:34:21 intel-8400-8-1 dnsmasq-dhcp[27175]: DHCPDISCOVER(virbr11) 192.168.122.252 52:54:00:56:22:67 no address available

Comment 3 Peter Krempa 2012-10-25 15:18:36 UTC
Fix sent for review upstream:

http://www.redhat.com/archives/libvir-list/2012-October/msg01492.html

Comment 4 Peter Krempa 2012-10-26 11:58:11 UTC
I changed the summary to reflect the issue:

When creating transient networks in libvirt the code doesn't check if the definition contains multiple DHCP sections that are not supported by design and also fails to create the dnsmasq host file that stores configuration of persistently configured guest leases.

Comment 5 Peter Krempa 2012-11-02 12:49:08 UTC
This bug was fixed upstream by

commit b6dbbae128ec542965e4477632d2be96cf6f51f8
Author: Peter Krempa <pkrempa>
Date:   Thu Oct 25 16:27:07 2012 +0200

    net: Re-use checks when creating transient networks
    
    When a transient network was created some of the checks weren't run on
    the definition allowing to start invalid networks.
    
    This patch splits out code to the network validation function and
    re-uses that code when creating transient networks.

that is a part of a series fixing various issues with transient networks.

Moving to POST as it should be picked up automatically.

Comment 10 RHEL Program Management 2014-04-04 21:00:23 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.