Bug 681082

Summary: Could define an interface while the same name interface already exists
Product: Red Hat Enterprise Linux 6 Reporter: zhanghaiyan <yoyzhang>
Component: netcfAssignee: Laine Stump <laine>
Status: CLOSED NOTABUG QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: dyuan, llim
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-03 06:57:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description zhanghaiyan 2011-03-01 03:26:12 UTC
Description of problem:
Could define an interface while the same name interface already exists, and then, it causes confusion

Version-Release number of selected component (if applicable):
- kernel-2.6.32-117.el6.x86_64
- netcf-0.1.7-1.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. Prepare eth0-modified.xml which has different mac address with eth0
# cat eth0-modified.xml 
<interface type="ethernet" name="eth0">
  <start mode="onboot"/>
  <mac address="00:25:64:A7:1F:4F"/>
  <protocol family="ipv4">
    <dhcp/>
  </protocol>
</interface>

2. # ncftool 
ncftool> list
eth0
lo
ncftool> dumpxml eth0
<?xml version="1.0"?>
<interface type="ethernet" name="eth0">
  <start mode="onboot"/>
  <mac address="00:25:64:A7:1F:4D"/>
  <protocol family="ipv4">
    <dhcp/>
  </protocol>
</interface>

ncftool> define eth0-modified.xml 
Defined interface eth0
ncftool> dumpxml eth0
<?xml version="1.0"?>
<interface type="ethernet" name="eth0">
  <start mode="onboot"/>
  <mac address="00:25:64:A7:1F:4F"/>
  <protocol family="ipv4">
    <dhcp/>
  </protocol>
</interface>

ncftool> 

  
Actual results:
the 2nd eth0 still can defined successfully while eth0 already exists and active.
after 2 eth0 exist, the dumpxml command displays the 2nd interface's xml info and it certainly causes confusion.

Expected results:
Do pre-check before defining interface and only one same name interface is allowed to be defined.


Additional info:

Comment 2 Laine Stump 2011-03-01 09:10:44 UTC
This is expected behavior - when you define an interface with the same name as an existing interface, the new definition will replace the old definition. Is that what you see?

Comment 3 zhanghaiyan 2011-03-01 09:24:39 UTC
from ncftool > dumpxml eth0, the new definition replaces old definition
but from # ifconfig eth0 and /etc/sysconfig/network-scripts/ifcfg-eth0 it is still old definition, is that expected ?
I think it is a little confusing users

Comment 4 Laine Stump 2011-03-01 13:05:41 UTC
The output of "ifconfig eth0" (ie the "live" status of the interface) doesn't change until you do an ifdown / ifup of the interface. This is similar to the way that changing the config of a virtual guest doesn't take effect until you stop and restart the guest.

Are you sure about the contents of ifcfg-eth0? The output of "dumpxml eth0" is directly derived from ifcfg-eth0 every time it is called, so it seems unlikely that they wouldn't match. Please re-check this part.

Comment 5 zhanghaiyan 2011-03-02 02:25:47 UTC
Sorry, I rechecked the result, and found that both ncftool>dumpxml eth0 and ifcfg-eth0 is replaced as new definition. 'ifconfig eth0' is still old definition.
Seems that is expected result.