Bug 1115858

Summary: libvirt should prevent duplicate portgroup name in virtual network
Product: Red Hat Enterprise Linux 6 Reporter: Hu Jianwei <jiahu>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 6.6CC: dyuan, honzhang, jsuchane, laine, mzhan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.10.2-50.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 05:46:10 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 Hu Jianwei 2014-07-03 09:18:04 UTC
Description of problem:
Libvirt had better prevent duplicate portgroup name in virtual network

Version-Release number of selected component (if applicable):
libvirt-0.10.2-40.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
[root@rhel6 ~]# virsh net-dumpxml default
<network>
  <name>default</name>
  <uuid>2b524410-c188-4ace-a0ca-ce5e14dae2a0</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0' />
  <mac address='52:54:00:7F:FE:79'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254' />
    </dhcp>
  </ip>
  <ip family='ipv6' address='2001:db8:ca2:7::1' prefix='64'>
  </ip>
  <portgroup name='hjw'>
    <bandwidth>
      <inbound average='512' peak='1024' burst='2048'/>
      <outbound average='512' peak='1024' burst='2048'/>
    </bandwidth>
  </portgroup>
  <portgroup name='hjw'>
    <bandwidth>
      <inbound average='128' peak='256' burst='1024'/>
      <outbound average='128' peak='256' burst='1024'/>
    </bandwidth>
  </portgroup>
</network>

Actual results:
As shown above step, two "hjw" portgroups are in default virtual network.

Expected results:
libvirt need check duplicate name of portgroup before net-define and net-edit.

Comment 3 Laine Stump 2015-02-06 18:44:50 UTC
Fix pushed upstream:

commit 2aa7ce6334ff192eb092932aee76d933f45cc39b
Author: Laine Stump <laine>
Date:   Thu Feb 5 14:20:54 2015 -0500

    network: don't allow multiple portgroups with the same name in a network

Comment 6 hongming 2015-03-06 07:05:04 UTC
Verify it as follows.The result is expected. Move its status to VERIFIED.


[root@hongming images]# rpm -q libvirt
libvirt-0.10.2-50.el6.x86_64

[root@hongming images]# rpm -q libvirt
libvirt-0.10.2-50.el6.x86_64
[root@hongming images]# cat network.xml
<network>
<name>portgroup</name>
<forward mode='nat'/>
<bridge name='virbr2' stp='on' delay='0' />
<mac address='52:54:00:7F:FE:79'/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.254' />
</dhcp>
</ip>
<ip family='ipv6' address='2001:db8:ca2:7::1' prefix='64'>
</ip>
<portgroup name='redhat'>
<bandwidth>
<inbound average='512' peak='1024' burst='2048'/>
<outbound average='512' peak='1024' burst='2048'/>
</bandwidth>
</portgroup>
<portgroup name='redhat'>
<bandwidth>
<inbound average='128' peak='256' burst='1024'/>
<outbound average='128' peak='256' burst='1024'/>
</bandwidth>
</portgroup>
</network>

[root@hongming images]# virsh net-define network.xml
error: Failed to define network from network.xml
error: unsupported configuration: multiple <portgroup> elements with the same name (redhat) in network 'portgroup'

[root@hongming images]# virsh net-create network.xml
error: Failed to create network from network.xml
error: unsupported configuration: multiple <portgroup> elements with the same name (redhat) in network 'portgroup'

[root@hongming images]# virsh net-edit default
error: unsupported configuration: multiple <portgroup> elements with the same name (redhat) in network 'default'
Failed. Try again? [y,n,f,?]:

Comment 9 errata-xmlrpc 2015-07-22 05:46:10 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-1252.html