Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
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
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
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
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.
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.
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
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