RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 907779 - virsh net-update can add multiple dhcp sections to ipv4 in network
Summary: virsh net-update can add multiple dhcp sections to ipv4 in network
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 907769 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-05 09:18 UTC by hongming
Modified: 2015-11-19 05:42 UTC (History)
5 users (show)

Fixed In Version: libvirt-1.2.13-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:42:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description hongming 2013-02-05 09:18:46 UTC
Description of problem:
virsh net-update can add multiple dhcp sections to ipv4 in network. 

Version-Release number of selected component (if applicable):
libvirt-1.0.2-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
# virsh net-start mynetwork
Network mynetwork started

# virsh net-dumpxml mynetwork
<network>
  <name>mynetwork</name>
  <uuid>fe8ffe14-8478-060d-ece1-2c97f96e1c59</uuid>
  <forward mode='nat'/>
  <bridge name='virbr1' stp='on' delay='0' />
  <mac address='52:54:00:E5:B6:95'/>
  <ip address='192.168.121.1' netmask='255.255.255.0'>
  </ip>
  <ip address='192.168.10.1' netmask='255.255.255.0'>
  </ip>
</network>

# virsh net-update mynetwork add ip-dhcp-host "<host mac='00:11:22:33:44:57' ip='192.168.122.47'/>" --live --config --parent-index 0
Updated network mynetwork persistent config and live state

# virsh net-update mynetwork add ip-dhcp-host "<host mac='00:11:22:33:44:58' ip='192.168.122.48'/>" --live --config --parent-index 1
Updated network mynetwork persistent config and live state


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

# virsh net-dumpxml mynetwork<network>
  <name>mynetwork</name>
  <uuid>fe8ffe14-8478-060d-ece1-2c97f96e1c59</uuid>
  <forward mode='nat'/>
  <bridge name='virbr1' stp='on' delay='0' />
  <mac address='52:54:00:E5:B6:95'/>
  <ip address='192.168.121.1' netmask='255.255.255.0'>
    <dhcp>
      <host mac='00:11:22:33:44:57' ip='192.168.122.47' />
    </dhcp>
  </ip>
  <ip address='192.168.10.1' netmask='255.255.255.0'>
    <dhcp>
      <host mac='00:11:22:33:44:58' ip='192.168.122.48' />
    </dhcp>
  </ip>
</network>  

Actual results:
virsh net-update can add multiple dhcp sections to ipv4 in network.

Expected results:
Check for multiple DHCP sections in network 

Additional info:

Comment 2 hongming 2013-05-27 03:07:56 UTC
Clone of 
(rhel6) Bug 907769 - virsh net-update can add multiple dhcp sections to ipv4 in network

Comment 3 Jiri Denemark 2014-04-11 08:19:39 UTC
*** Bug 907769 has been marked as a duplicate of this bug. ***

Comment 5 Jiri Denemark 2014-12-09 12:42:19 UTC
Fixed upstream by v1.2.10-300-g5adc603:

commit 5adc6031fa60379719d4856001a7e32a6f0221aa
Author: Kyle DeFrancia <kdef.ibm.com>
Date:   Thu Dec 4 13:07:36 2014 -0800

    network: don't allow multiple dhcp sections
    
    This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=907779
    
    A <dhcp> element can exist in only one IPv4 address and one IPv6
    address per network.  This patch enforces that in virNetworkUpdate.

Comment 7 lcheng 2015-04-13 06:30:22 UTC
Reproduced this issue with libvirt-1.2.8-16.el7.x86_64.

[root@localhost ~]# cat net.xml 
<network>
  <name>net</name>
  <uuid>fe8ffe14-8478-060d-ece1-2c97f96e1c59</uuid>
  <forward mode='nat'/>
  <bridge name='virbr1' stp='on' delay='0' />
  <mac address='52:54:00:E5:B6:95'/>
  <ip address='192.168.121.1' netmask='255.255.255.0'>
  </ip>
  <ip address='192.168.10.1' netmask='255.255.255.0'>
  </ip>
</network>


[root@localhost ~]# virsh net-define net.xml 
Network net defined from net.xml

[root@localhost ~]# virsh net-start net
Network net started

[root@localhost ~]# virsh net-dumpxml net
<network>
  <name>net</name>
  <uuid>fe8ffe14-8478-060d-ece1-2c97f96e1c59</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr1' stp='on' delay='0'/>
  <mac address='52:54:00:e5:b6:95'/>
  <ip address='192.168.121.1' netmask='255.255.255.0'>
  </ip>
  <ip address='192.168.10.1' netmask='255.255.255.0'>
  </ip>
</network>

[root@localhost ~]# virsh net-update net add ip-dhcp-host "<host mac='00:11:22:33:44:57' ip='192.168.122.47'/>" --live --config --parent-index 0
Updated network net persistent config and live state

[root@localhost ~]# virsh net-update net add ip-dhcp-host "<host mac='00:11:22:33:44:58' ip='192.168.122.48'/>" --live --config --parent-index 1
Updated network net persistent config and live state

[root@localhost ~]# virsh net-list --all
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 default              active     yes           yes
 net                  active     no            yes

[root@localhost ~]# virsh net-dumpxml net
<network>
  <name>net</name>
  <uuid>fe8ffe14-8478-060d-ece1-2c97f96e1c59</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr1' stp='on' delay='0'/>
  <mac address='52:54:00:e5:b6:95'/>
  <ip address='192.168.121.1' netmask='255.255.255.0'>
    <dhcp>
      <host mac='00:11:22:33:44:57' ip='192.168.122.47'/>
    </dhcp>
  </ip>
  <ip address='192.168.10.1' netmask='255.255.255.0'>
    <dhcp>
      <host mac='00:11:22:33:44:58' ip='192.168.122.48'/>
    </dhcp>
  </ip>
</network>



Verify it as follows. The result is expected. Change the state to VERIFIED

[root@localhost ~]# rpm -q libvirt
libvirt-1.2.14-1.el7.x86_64

[root@localhost ~]# cat net.xml 
<network>
  <name>net</name>
  <uuid>fe8ffe14-8478-060d-ece1-2c97f96e1c59</uuid>
  <forward mode='nat'/>
  <bridge name='virbr1' stp='on' delay='0' />
  <mac address='52:54:00:E5:B6:95'/>
  <ip address='192.168.121.1' netmask='255.255.255.0'>
  </ip>
  <ip address='192.168.10.1' netmask='255.255.255.0'>
  </ip>
</network>


[root@localhost ~]# virsh net-define net.xml 
Network net defined from net.xml

[root@localhost ~]# virsh net-start net
Network net started

[root@localhost ~]# virsh net-dumpxml net
<network>
  <name>net</name>
  <uuid>fe8ffe14-8478-060d-ece1-2c97f96e1c59</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr1' stp='on' delay='0'/>
  <mac address='52:54:00:e5:b6:95'/>
  <ip address='192.168.121.1' netmask='255.255.255.0'>
  </ip>
  <ip address='192.168.10.1' netmask='255.255.255.0'>
  </ip>
</network>

[root@localhost ~]# virsh net-update net add ip-dhcp-host "<host mac='00:11:22:33:44:57' ip='192.168.122.47'/>" --live --config --parent-index 0
Updated network net persistent config and live state

[root@localhost ~]# virsh net-update net add ip-dhcp-host "<host mac='00:11:22:33:44:58' ip='192.168.122.48'/>" --live --config --parent-index 1
error: Failed to update network net
error: Requested operation is not valid: dhcp is supported only for a single IPv4 address on each network


[root@localhost ~]# virsh net-update net add ip-dhcp-range "<range start='192.168.200.130' end='192.168.200.140'/>" --live --config --parent-index 0
Updated network net persistent config and live state

[root@localhost ~]# virsh net-update net add ip-dhcp-range "<range start='192.168.200.130' end='192.168.200.140'/>" --live --config --parent-index 1
error: Failed to update network net
error: Requested operation is not valid: dhcp is supported only for a single IPv4 address on each network

[root@localhost ~]# virsh net-dumpxml net
<network>
  <name>net</name>
  <uuid>fe8ffe14-8478-060d-ece1-2c97f96e1c59</uuid>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='virbr1' stp='on' delay='0'/>
  <mac address='52:54:00:e5:b6:95'/>
  <ip address='192.168.121.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.200.130' end='192.168.200.140'/>
      <host mac='00:11:22:33:44:57' ip='192.168.122.47'/>
    </dhcp>
  </ip>
  <ip address='192.168.10.1' netmask='255.255.255.0'>
  </ip>
</network>

Comment 9 errata-xmlrpc 2015-11-19 05:42:06 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.

https://rhn.redhat.com/errata/RHBA-2015-2202.html


Note You need to log in before you can comment on or make changes to this bug.