Bug 1420668 - Hotplug of 'user' type interface is not supported any more unexpectedly
Summary: Hotplug of 'user' type interface is not supported any more unexpectedly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.4
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: yalzhang@redhat.com
URL:
Whiteboard:
Depends On:
Blocks: 1445231
TreeView+ depends on / blocked
 
Reported: 2017-02-09 09:21 UTC by Dan Zheng
Modified: 2017-08-02 00:01 UTC (History)
10 users (show)

Fixed In Version: libvirt-3.1.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1445231 (view as bug list)
Environment:
Last Closed: 2017-08-01 17:21:45 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:1846 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2017-08-01 18:02:50 UTC

Description Dan Zheng 2017-02-09 09:21:45 UTC
Description of problem:
hotplug of interface type of user is not implemented yet unexpectedly.
This is a regression from libvirt-2.0.0-10.el7_3.3.x86_64. Before that version, this feature is supported.

Version-Release number of selected component (if applicable):
libvirt-2.0.0-10.el7_3.3.x86_64
qemu-kvm-rhev-2.6.0-28.el7_3.3.x86_64
kernel-3.10.0-514.10.1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Start a guest and edit a XML for interface
# cat /tmp/user.xml
<interface type='user'/>

2. Attach the device
# virsh attach-device rhel7.3  /tmp/user.xml
error: Failed to attach device from /tmp/user.xml
error: Operation not supported: hotplug of interface type of user is not implemented yet

Actual results:
See step 2

Expected results:
The device attach with user type interface should be successfully.

Additional info:
In fact , this user type interface can be supported in guest and it works well. So this is too restrictive.

Comment 2 Peter Krempa 2017-02-28 09:04:45 UTC
The hotplug of the interface type was denied by commit:

commit c266b6044003ac2f10f4cd15e58164d629508ccb
Author: Michal Privoznik <mprivozn@redhat.com>
Date:   Mon Sep 26 11:53:58 2016 +0200

    qemuDomainAttachNetDevice: Explicitly list allowed types for hotplug
    
    Instead of blindly claim support for hot-plugging of every
    interface type out there we should copy approach we have for
    device types: white listing supported types and explicitly error
    out on unsupported ones.
    For instance, trying to hotplug vhostuser interface results in
    nothing usable from guest currently. vhostuser typed interfaces
    require additional work on our side.

Michal, is this expected behavior?

Comment 3 Michal Privoznik 2017-02-28 16:53:05 UTC
No, it is not. Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2017-February/msg01593.html

Comment 4 Michal Privoznik 2017-03-01 08:54:00 UTC
To POST:

commit 9d87f769726bd5714eb6a930379d8b4c53311196
Author:     Michal Privoznik <mprivozn@redhat.com>
AuthorDate: Tue Feb 28 17:49:49 2017 +0100
Commit:     Michal Privoznik <mprivozn@redhat.com>
CommitDate: Wed Mar 1 09:05:53 2017 +0100

    qemuDomainAttachNetDevice: Support attach of type="user"
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1420668
    
    This has worked in previous releases.
    My commit c266b60440 broke it.
    
    Signed-off-by: Michal Privoznik <mprivozn@redhat.com>

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 97fb272f6..0c0885695 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1104,6 +1104,9 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
         break;
 
     case VIR_DOMAIN_NET_TYPE_USER:
+        /* No preparation needed. */
+        break;
+
     case VIR_DOMAIN_NET_TYPE_SERVER:
     case VIR_DOMAIN_NET_TYPE_CLIENT:
     case VIR_DOMAIN_NET_TYPE_MCAST:

v3.1.0-rc2-2-g9d87f7697

Comment 6 yalzhang@redhat.com 2017-03-06 02:52:46 UTC
Test as below scenarios, the result is as expected, set this bug as verified.

1. unprivileged user

$ rpm -q libvirt
libvirt-3.1.0-1.el7.x86_64

$ virsh start rhel7.2
Domain rhel7.2 started

$ cat /tmp/user.xml
<interface type='user'/>

$ virsh attach-device rhel7.2 /tmp/user.xml
Device attached successfully

$ virsh dumpxml rhel7.2 | grep /interface -B5
    <interface type='user'>
      <mac address='52:54:00:81:eb:1e'/>
      <model type='rtl8139'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

log in the guest, and check the network function, it works well.

$ cat /tmp/user1.xml
 <interface type='user'>
      <mac address='52:54:00:81:eb:1e'/>
      <model type='rtl8139'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

$ virsh detach-device rhel7.2 /tmp/user1.xml
Device detached successfully


2. use root

# virsh attach-device rhel /tmp/user.xml 
Device attached successfully

# virsh dumpxml rhel | grep /interface -B6
...
    <interface type='user'>
      <mac address='52:54:00:30:02:5a'/>
      <model type='rtl8139'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </interface>

log in the guest, and check the network function, it works well.

# virsh detach-interface rhel user 52:54:00:30:02:5a
Interface detached successfully

Comment 7 yalzhang@redhat.com 2017-04-24 02:21:17 UTC
Hi Michal, will this patch be backport to rhel7.3 z stream?

Comment 14 errata-xmlrpc 2017-08-01 17:21:45 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://access.redhat.com/errata/RHEA-2017:1846

Comment 15 errata-xmlrpc 2017-08-02 00:01:15 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://access.redhat.com/errata/RHEA-2017:1846


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