RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1461301 - unknown error occurred when attach a disk with a pci address already occupied in guest while virtlockd is enabled
Summary: unknown error occurred when attach a disk with a pci address already occupied...
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
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Han Han
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-06-14 07:25 UTC by yafu
Modified: 2018-04-10 10:50 UTC (History)
8 users (show)

Fixed In Version: libvirt-3.8.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 10:48:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0704 0 None None None 2018-04-10 10:50:02 UTC

Description yafu 2017-06-14 07:25:07 UTC
Description of problem:
unknown error occurred when attach a disk with a pci address already occupied in guest while virtlockd is enabled

Version-Release number of selected component (if applicable):
libvirt-3.2.0-9.virtcov.el7.x86_64
qemu-kvm-rhev-2.9.0-10.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Set lock_manageer as 'lockd' and restart libvirtd service:
#cat /etc/libvirt/qemu.conf
lock_manager = 'lockd'
#systemctl restart libvirtd

2.Start a guest:
#virsh start full-73

3.Prepare a disk with pci address aleardy occupied in guest:
#cat disk.xml
  <disk type='file' device='disk'>
       <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/test.qcow2'/>
      <target dev='vdb' bus='virtio'/>
      ****<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>***
    </disk>

4.Hotplug the disk to the guest:
#virsh attach-device full-73 disk.xml
error: Failed to attach device from disk.xml
error: An error occurred, but the cause is unknown

Actual results:
unknown error occurred when attach a disk with a pci address already occupied in guest while virtlockd is enabled

Expected results:
Should report clear error as follows:
# virsh attach-device full-73 disk.xml
error: Failed to attach device from disk.xml
error: XML error: Attempted double use of PCI Address 0000:00:0a.0

Comment 2 Han Han 2017-06-14 08:01:58 UTC
Confirmed regression:
It works on libvirt-2.0.0-10.el7_3.9.x86_64 of RHEL7.3.z

1. Set lock_manager = "lockd" in /etc/libvirt/qemu.conf
2. Restart virtlockd and libvirtd
3. Start a VM:
# virsh list 
 Id    Name                           State
----------------------------------------------------
 1     avocado-vt-vm1                 running

4. Attach a disk with pci address then detach it:
# virsh attach-disk avocado-vt-vm1 /tmp/raw vdb  --address pci:0000.00.a.0
Disk attached successfully

# virsh detach-disk avocado-vt-vm1 vdb                                    
Disk detached successfully

Comment 3 Han Han 2017-06-14 08:39:57 UTC
Sorry for the mistake in comment2. Actually it is not a regression, in other words, it can be reproduced on libvirt-2.0.0-10.el7_3.9.x86_64

One more scenario:
It can be reproduce when attach to an unreachable pci address:
# virsh attach-disk avocado-vt-vm1 /tmp/raw vdb  --address pci:000a.00.6.0
error: Failed to attach disk
error: An error occurred, but the cause is unknown

Comment 4 Peter Krempa 2017-09-15 03:40:19 UTC
Fixed upstream:

commit a823d0a62e858a62a585a78599b6d859c5b4dcac 
Author: Peter Krempa <pkrempa>
Date:   Mon Sep 11 15:28:15 2017 +0200

    qemu: Restore errors when rolling back disk image state
    
    Some operations done to rollback disk image labelling and locking might
    overwrite (or clear) the actual error. Remember the original error when
    tearing down disk access so that it's not obscured.

Comment 6 Han Han 2017-11-07 02:38:53 UTC
Verified on libvirt-3.9.0-1.el7.x86_64:
1. Setup virtlockd env:
In qemu.conf:
lock_manager = "lockd"

# systemctl restart virtlockd
# systemctl restart libvirtd

2. Start an VM. Attach two disks to the same pci address
# virsh attach-disk V /tmp/a vdb --address pci:0000.00.a.0
Disk attached successfully

# virsh attach-disk V /tmp/b vdc --address pci:0000.00.a.0
error: Failed to attach disk
error: XML error: Attempted double use of PCI Address 0000:00:0a.0

Libvirt gives clear error message when attaching to duplicate pci address.
Bug fixed.

Comment 10 errata-xmlrpc 2018-04-10 10:48:37 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-2018:0704


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