Bug 616721

Summary: RFE: Introduce API for XML normalization
Product: Red Hat Enterprise Linux 7 Reporter: xhu
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 7.0CC: ajia, berrange, cwei, dyuan, eblake, gkong, jdenemar, mshao, mzhan, tools-bugs, xen-maint, yoyzhang
Target Milestone: rcKeywords: FutureFeature
Target Release: 7.1   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.9-1.el6 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-07 12:13:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 813191    

Description xhu 2010-07-21 09:34:37 UTC
Description of problem:
Errors as follows occurs when dettach device from xml file without mac field:
error: Failed to detach device from interface.xml
error: operation failed: network device 52:54:00:4f:58:1a not found 
Note:
it seems that that "52:54:00:4f:58:1a" is a random sequence num and it will change every time you executed it.

Version-Release number of selected component (if applicable):
libvirt-0.8.1-15.el6.x86_64
kernel-2.6.32-44.1.el6.x86_64
qemu-img-0.12.1.2-2.96.el6.x86_64
qemu-kvm-0.12.1.2-2.96.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1.Start a kvm guest
2.Prepare a interface xml as following:
# more interface.xml
   <interface type='network'>
      <source network='default'/>
      <model type='virtio'/>
    </interface>
3. Issue below command :
   # virsh attach-device <guest name> interface.xml
4. Issue below command:
  # virsh dumpxml rhel5u4_x86_64_xenpv
5. Log into guest, make sure the newly added interface works fine.
6. Issue below command in gnome-terminal:
   # virsh detach-device <guest name> interface.xml
  
Actual results:
Step 6: Errors as follows occurs when dettach device from xml file without mac feild:
error: Failed to detach device from interface.xml
error: operation failed: network device 52:54:00:4f:58:1a not found 
if I mofify interface,xml as follows, the device can be detached successfully:
<interface type='network'>
<mac address='52:54:00:5b:c1:59'/>
      <source network='default'/>
      <model type='virtio'/>
</interface>


Expected results:
Step 6: If there must be mac feild in xml file when dettaching device, the errors should be "You must specify mac address in xml file" not "error: Failed to detach device from interface.xml
error: operation failed: network device 52:54:00:4f:58:1a not found "
Note:
it seems that that "52:54:00:4f:58:1a" is a random sequence num and it will change every time you executed it.


Additional info:

Comment 4 Michal Privoznik 2011-04-18 12:36:55 UTC
Patches sent upstream. Waiting for review:

https://www.redhat.com/archives/libvir-list/2011-March/msg01188.html

Comment 7 Michal Privoznik 2011-11-22 10:29:38 UTC
Another try:

https://www.redhat.com/archives/libvir-list/2011-November/msg01172.html

Comment 8 Michal Privoznik 2011-11-23 09:58:24 UTC
Moving to POST:

commit ea7182c29f185e7c1527b10fbe16dc4ba1f45a88
Author:     Michal Prívozník <mprivozn>
AuthorDate: Mon Jun 6 12:20:11 2011 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Wed Nov 23 10:24:43 2011 +0100

    virsh: Increase device-detach intelligence
    
    Up to now users have to give a full XML description on input when
    device-detaching. If they omitted something it lead to unclear
    error messages (like generated MAC wasn't found, etc.).
    With this patch users can specify only those information which
    specify one device sufficiently precise. Remaining information is
    completed from domain.

v0.9.7-130-gea7182c

Comment 10 xhu 2012-01-10 08:21:11 UTC
Verify it with libvirt-0.9.9-1.el6 and it passed.

Comment 11 Dave Allan 2012-01-10 15:33:05 UTC
We are reverting this patch because it causes a regression BZ 768268

Comment 17 Michal Privoznik 2013-09-17 14:50:11 UTC
Patches proposed upstream:

https://www.redhat.com/archives/libvir-list/2013-September/msg00982.html

Comment 18 Michal Privoznik 2013-10-16 08:48:59 UTC
*** Bug 840344 has been marked as a duplicate of this bug. ***

Comment 19 Jiri Denemark 2014-08-07 12:13:12 UTC
The discussion initiated by the patch from comment 17 had the following outcome:

- there's no real use case for this API
- part of the reasons may be covered by RNG validation (bug 888748)

Let's close this RFE.