Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1056902 - virsh attach-interface/detach-interface mishandles inactive configuration on device hot(un)plug commands
virsh attach-interface/detach-interface mishandles inactive configuration on ...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.0
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Peter Krempa
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-01-23 01:49 EST by zhengqin
Modified: 2015-03-05 02:29 EST (History)
8 users (show)

See Also:
Fixed In Version: libvirt-1.2.7-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-03-05 02:29:35 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0323 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2015-03-05 07:10:54 EST

  None (edit)
Description zhengqin 2014-01-23 01:49:22 EST
Description of problem:
virsh attach-interface/detach-interface with option "--config" could not success for running domain vm.

Version-Release number of selected component (if applicable):
libvirt-1.1.1-19.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
Attach/detach with --config
steps:
1. attach-interface with --config when domain is running
# virsh list
 Id    Name                           State
----------------------------------------------------
 5     rhel6_x86_64                   running


# virsh attach-interface rhel6_x86_64  --type network --source default --target vnet1 --mac 52:54:00:f9:11:11 --config
Interface attached successfully


# virsh domiflist rhel6_x86_64 --inactive
Interface  Type       Source     Model       MAC
-------------------------------------------------------
-          network    default    e1000       52:54:00:62:30:ff
-          network    default    rtl8139     52:54:00:f9:11:11



2. detach-interface with --config

# virsh detach-interface rhel6_x86_64 network --mac 52:54:00:f9:11:11 --config
error: No interface with MAC address 52:54:00:f9:11:11 was found



Expected Result:
Interface could be detached successfully with –config.

Additional Info:
This issue does not occurs on RHEL6 with libvirt-0.10.2-29.el6.x86_64
Comment 2 CongDong 2014-02-21 04:30:18 EST
Can reproduce with:
libvirt-1.1.1-23.el7.x86_64

Steps:
1. 
[root@mig2 Downloads]# rpm -qa libvirt
libvirt-1.1.1-23.el7.x86_64
[root@mig2 Downloads]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 3     rhel6                          running
 -     kiosk-test                     shut off
 -     new                            shut off
 -     rhel6u5                        shut off

[root@mig2 Downloads]# virsh attach-interface rhel6 --type network --source default --target vnet1 --mac 52:54:00:f9:11:11 --config
Interface attached successfully

[root@mig2 Downloads]# virsh domiflist rhel6 --inactive
Interface  Type       Source     Model       MAC
-------------------------------------------------------
-          network    default    virtio      52:54:00:56:b3:84
-          network    default    rtl8139     52:54:00:f9:11:11

2.
[root@mig2 Downloads]# virsh detach-interface rhel6 network --mac 52:54:00:f9:11:11 --config
error: Failed to detach interface
error: operation failed: no matching network device was found
Comment 3 Peter Krempa 2014-07-07 07:08:00 EDT
commit 87388228f47a15308aee4b6416e31596242bab41
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Fri Jul 4 15:03:07 2014 +0200

    virsh: domain: Use inactive XML when unplugging interface with --config
    
    Similary to cmdDetachDisk fetch the inactive definition when --config
    is specified as the active may not contain the network interface
    if it was plugged with --config.

$ git desc
v1.2.6-56-g8738822
Comment 6 vivian zhang 2014-12-02 01:37:23 EST
I can produce this bug on build libvirt-1.1.1-29.el7.x86_64

verify it on build
libvirt-1.2.8-9.el7.x86_64
qemu-kvm-rhev-2.1.2-14.el7.x86_64
3.10.0-208.el7.x86_64

1. prepare a guest in running and domiflist
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 96    rhel7new                       running
# virsh domiflist rhel7new --inactive
Interface  Type       Source     Model       MAC
-------------------------------------------------------
-          network    default    rtl8139     52:54:00:c2:c6:e4

2. hot plug a interface to guest with --config

# virsh attach-interface rhel7new --type network --source default --target vnet1 --mac 52:54:00:f9:11:11 --config
Interface attached successfully

# virsh domiflist rhel7new --inactive
Interface  Type       Source     Model       MAC
-------------------------------------------------------
-          network    default    rtl8139     52:54:00:c2:c6:e4
-          network    default    rtl8139     52:54:00:f9:11:11

3. detach it with --config success
# virsh detach-interface rhel7new network --mac 52:54:00:f9:11:11 --config
Interface detached successfully

# virsh domiflist rhel7new --inactive
Interface  Type       Source     Model       MAC
-------------------------------------------------------
-          network    default    rtl8139     52:54:00:c2:c6:e4

4. check guest still in running, works well

repeat steps 1-4 on qemu-kvm build, got the same result

build for qemu-kvm
qemu-kvm-1.5.3-83.el7.x86_64
libvirt-1.2.8-9.el7.x86_64
3.10.0-208.el7.x86_64

the similar steps for command attach-device

    virsh attach-device rhel7new --file /tmp/network.xml --config
    Device attached successfully

[root@server ~]# virsh domiflist rhel7new --inactive
Interface Type Source Model MAC
-------------------------------------------------------
- network default rtl8139 52:54:00:c2:c6:e4
- network default rtl8139 52:54:00:f9:11:11

    virsh detach-device rhel7new --file /tmp/network.xml --config
    Device detached successfully

[root@server ~]# virsh domiflist rhel7new --inactive
Interface Type Source Model MAC
-------------------------------------------------------
- network default rtl8139 52:54:00:c2:c6:e4

    virsh attach-device rhel7new --file /tmp/network.xml --config
    Device attached successfully

[root@server ~]# virsh detach-device rhel7new --file /tmp/network.xml
error: Failed to detach device from /tmp/network.xml
error: operation failed: no device matching mac address 52:54:00:f9:11:11 found on 0000:00:08.0

    virsh detach-device rhel7new --file /tmp/network.xml --live
    error: Failed to detach device from /tmp/network.xml
    error: operation failed: no device matching mac address 52:54:00:f9:11:11 found on 0000:00:08.0


move to verified
Comment 8 errata-xmlrpc 2015-03-05 02:29:35 EST
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://rhn.redhat.com/errata/RHSA-2015-0323.html

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