Bug 670431 - iface-dumpxml displays old information after iface-edit operation
Summary: iface-dumpxml displays old information after iface-edit operation
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.1
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Laine Stump
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-18 09:39 UTC by zhanghaiyan
Modified: 2011-01-21 22:49 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-01-21 22:49:13 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description zhanghaiyan 2011-01-18 09:39:04 UTC
Description of problem:
Use 'virsh iface-edit eth0' command to modify eth0 mac address successfully, but 'virsh iface-dumpxml eth0' still display the old mac address while /etc/sysconfig/network-scripts/ifcfg-eth0, augtool, ncftool all display new mac address

Version-Release number of selected component (if applicable):
- netcf-0.1.7-1.el6.x86_64
- netcf-libs-0.1.7-1.el6.x86_64
- libvirt-0.8.7-2.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. # virsh iface-dumpxml eth0
<interface type='ethernet' name='eth0'>
  <mac address='00:21:9b:7d:f9:71'/>
  <protocol family='ipv4'>
    <ip address='10.66.93.146' prefix='23'/>
  </protocol>
  <protocol family='ipv6'>
    <ip address='fe80::221:9bff:fe7d:f971' prefix='64'/>
  </protocol>
</interface>
2. Change eth0 mac address 
# virsh iface-edit eth0
<interface type='ethernet' name='eth0'>
  <start mode='none'/>
  <mac address='00:25:64:a7:1f:4d'/>
  <protocol family='ipv4'>
    <dhcp/>
  </protocol>
</interface>
3. # virsh iface-dumpxml eth0
<interface type='ethernet' name='eth0'>
  <mac address='00:21:9b:7d:f9:71'/>
  <protocol family='ipv4'>
    <ip address='10.66.93.146' prefix='23'/>
  </protocol>
  <protocol family='ipv6'>
    <ip address='fe80::221:9bff:fe7d:f971' prefix='64'/>
  </protocol>
</interface>
4. Double check the modify is really updated by # virsh iface-edit eth0 
5. # cat /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE=eth0
HWADDR=00:25:64:a7:1f:4d
ONBOOT=no
BOOTPROTO=dhcp
6. # augtool 
augtool> print /files/etc/sysconfig/network-scripts/ifcfg-eth0/
/files/etc/sysconfig/network-scripts/ifcfg-eth0
/files/etc/sysconfig/network-scripts/ifcfg-eth0/DEVICE = "eth0"
/files/etc/sysconfig/network-scripts/ifcfg-eth0/HWADDR = "00:25:64:a7:1f:4d"
/files/etc/sysconfig/network-scripts/ifcfg-eth0/ONBOOT = "no"
/files/etc/sysconfig/network-scripts/ifcfg-eth0/BOOTPROTO = "dhcp"
augtool> 
7. # ncftool 
ncftool> dumpxml eth0
<?xml version="1.0"?>
<interface type="ethernet" name="eth0">
  <start mode="none"/>
  <mac address="00:25:64:a7:1f:4d"/>
  <protocol family="ipv4">
    <dhcp/>
  </protocol>
</interface>

ncftool> 
8. # service network restart
Shutting down interface eth0:  Device eth0 has MAC address 00:21:9b:7d:f9:71, instead of configured address 00:25:64:a7:1f:4d. Ignoring.
                                                           [FAILED]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Device eth0 has different MAC address than expected, ignoring.
                                                           [FAILED]

Actual results:
step3, virsh iface-dumpxml eth0 still display the old mac address

Expected results:
step3, virsh iface-dumpxml eth0 should display the new mac address
step8, in fact, I think it better forbidden modify eth0 mac address. 

Additional info:
So IMHO
1) if it allows to modify eth0 mac address, then virsh iface-dumpxml eth0 should display the new address 
2) or it should not allow to modify eth0 mac address. when it detects the mac address is modified, then fail the edit operation.

Comment 2 Laine Stump 2011-01-21 22:49:13 UTC
The command "virsh iface-dumpxml eth0" displays an XML encoding of the current running state of eth0. When you update an interface's config with iface-edit, you are modifying the config files; the actual running state of the interface will not change until you do an iface-down command followed by iface-up for that interface.

If you want to see the current contents of the interface's config files, the proper command is:

   virsh iface-dumpxml --inactive


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