This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours

Bug 657486

Summary: Libvirt hot unplug the 1st guest nic silently when not specifying --mac
Product: [Fedora] Fedora Reporter: zhanghaiyan <yoyzhang>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: aquini, berrange, clalance, crobinso, dyuan, eblake, itamar, jforbes, jyang, llim, mprivozn, veillard, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.8.8-3.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-02 08:07:28 EST Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description zhanghaiyan 2010-11-26 04:11:58 EST
Description of problem:
Hot unplug network type nic from guest without option --mac, libvirt detach the 1st nic silently, while multi nic are network type.

Version-Release number of selected component (if applicable):
- kernel-2.6.35.6-45.fc14.x86_64
- libvirt-0.8.4-3.fc15.x86_64
- qemu-img-0.13.0-1.fc14.x86_64
- qemu-kvm-0.13.0-1.fc14.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Get a running guest named f14
2. # virsh attach-interface f14 --type network --source default --target vnet1
Interface attached successfully
3. # virsh attach-interface f14 --type network --source default --target vnet2
Interface attached successfully
4. # virsh dumpxml f14
    <interface type='network'>
      <mac address='52:54:00:55:1a:5d'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </interface>
    <interface type='network'>
      <mac address='52:54:00:b4:84:8f'/>
      <source network='default'/>
      <target dev='vnet1'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='network'>
      <mac address='52:54:00:aa:d4:08'/>
      <source network='default'/>
      <target dev='vnet2'/>
      <alias name='net2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </interface>
5. # virsh detach-interface f14 --type network 
Interface detached successfully
6. # virsh dumpxml f14
    <interface type='network'>
      <mac address='52:54:00:b4:84:8f'/>
      <source network='default'/>
      <target dev='vnet1'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='network'>
      <mac address='52:54:00:aa:d4:08'/>
      <source network='default'/>
      <target dev='vnet2'/>
      <alias name='net2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </interface>
7. # virsh detach-interface f14 --type network 
Interface detached successfully
8. # virsh dumpxml f14
    <interface type='network'>
      <mac address='52:54:00:aa:d4:08'/>
      <source network='default'/>
      <target dev='vnet2'/>
      <alias name='net2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </interface>

Actual results:
As execute detach-interface without --mac and multi nic is network type, libvirt detached one nic each time

Expected results:
If there are mutli same type nic and user doesn't specify single nic with --mac, libvirt should give a reminder asking user to sepcify with --mac, instead of hot unplug the 1st nic silently

Additional info:
Comment 3 Fedora Admin XMLRPC Client 2011-09-22 13:50:47 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 4 Fedora Admin XMLRPC Client 2011-09-22 13:53:24 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 5 Fedora Admin XMLRPC Client 2011-09-22 13:58:57 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 6 Fedora Admin XMLRPC Client 2011-11-30 14:31:33 EST
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 7 Fedora Admin XMLRPC Client 2011-11-30 14:34:58 EST
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 8 Fedora Admin XMLRPC Client 2011-11-30 14:41:49 EST
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 9 Fedora Admin XMLRPC Client 2011-11-30 14:53:08 EST
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 10 Eric Blake 2011-12-01 17:01:22 EST
I think this commit should help with things - hot-unplugging a NIC is a case of device-detach, so hopefully we are now warning if insufficient data was provided to determine an unambiguous NIC to unplug.

Then again, this patch looks like it just touched the generic 'detach-device', not the specific 'detach-interface', so we may need a follow-on patch.  Michal?

commit ea7182c29f185e7c1527b10fbe16dc4ba1f45a88
Author: Michal Prívozník <mprivozn@redhat.com>
Date:   Mon Jun 6 12:20:11 2011 +0200

    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.
Comment 11 Michal Privoznik 2011-12-02 02:05:18 EST
Well, detach-device and {detach-interface, detach-disk} works differently; All these three obtain a full device description from a domain. But since detach-interface & detach-disk can use simple XPath to select proper devices (e.g. /domain/devices/interface[@type='%s']), detach-device can't as it takes XML as input. However, my patch you mention above is trying to complete missing parts in given XML from domain.

Anyway, this bug is already fixed by this commit:

commit cee47aace104346ef975cb1fb3f7126a88c03244
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: Tue Jan 25 18:31:00 2011 +0100
Commit:     Eric Blake <eblake@redhat.com>
CommitDate: Tue Jan 25 10:47:28 2011 -0700

    virsh: require --mac to avoid detach-interface ambiguity
    
    bugfix for https://bugzilla.redhat.com/show_bug.cgi?id=671050
    
    virsh simply refutes to detach-interface in case when multiple
    interfaces are attached and --mac is not specified.

As you can see, it is very old commit (v0.8.7-114-gcee47aa), already included in libvirt-0.8.8-3.fc16, therefore moving directly to MODIFIED.
Comment 12 Eric Blake 2011-12-02 08:07:28 EST
Since this bug is against RAWHIDE, and rawhide is newer than 0.8.8, we can move straight to CLOSED.