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 1174096 - some issue when we try to cold-unplug, hot-plug... a lease device
Summary: some issue when we try to cold-unplug, hot-plug... a lease device
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-15 06:42 UTC by Luyao Huang
Modified: 2015-11-19 05:58 UTC (History)
5 users (show)

Fixed In Version: libvirt-1.2.13-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:58:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Luyao Huang 2014-12-15 06:42:05 UTC
description of problem:
some issue when we try to cold-unplug, hot-plug... a lease device

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

How reproducible:
100%

Steps to Reproduce:

1.prepare a guest without lease device settings and then use attach-device to coldplug a lease:

# cat deviceleases.xml
    <lease>
      <lockspace>somearea</lockspace>
      <key>somekey</key>
      <target path='/some/lease/path' offset='1024'/>
    </lease>

# virsh attach-device test4  deviceleases.xml --config
Device attached successfully

2.check the xml:

# virsh dumpxml test4 --inactive
    <lease>
      <lockspace>somearea</lockspace>
      <key>somekey</key>
      <target path='/some/lease/path' offset='1024'/>
    </lease>

3.# virsh detach-device test4  deviceleases.xml --config
error: Failed to detach device from deviceleases.xml
error: invalid argument: Lease somekey in lockspace somearea does not exist

Actual results:
cannot cold-unplug a lease device but can cold-plug it

Expected results:
can cold-unplug a lease device

The main cause of this issue is because:

when we set lockspace in XML, virDomainLeaseIndex will always return -1 although
the two lease are the same.

This will also cause can attach a lot of same lease with no error.

Comment 1 Michal Privoznik 2014-12-15 13:28:54 UTC
So I've just pushed the patch upstream:

commit 046d82d72fa7a2daf2bcb39af3d1a5c3d22e23bd
Author:     Luyao Huang <lhuang>
AuthorDate: Mon Dec 15 14:46:28 2014 +0800
Commit:     Michal Privoznik <mprivozn>
CommitDate: Mon Dec 15 14:19:38 2014 +0100

    conf: fix virDomainLeaseIndex logic
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1174096
    
    When both parameter have lockspaces present, virDomainLeaseIndex
    always returns -1 even there is a lease the same with the one we
    check. This is due to broken logic in 'if-else' statement.
    
    Signed-off-by: Luyao Huang <lhuang>
    Signed-off-by: Michal Privoznik <mprivozn>

v1.2.11-13-g046d82d

Comment 3 Yang Yang 2015-06-16 08:52:47 UTC
Verified on libvirt-1.2.16-1.el7.x86_64

Steps
1. configure lock manager as sanlock
# tail -5 /etc/libvirt/qemu-sanlock.conf 
user = "sanlock"
group = "sanlock"
host_id = 1
auto_disk_leases = 0
disk_lease_dir = "/var/lib/libvirt/sanlock"
require_lease_for_disks = 1

 #tail -1 /etc/libvirt/qemu.conf 
lock_manager = "sanlock"

# getsebool -a | grep sanlock
sanlock_use_nfs --> on
virt_use_sanlock --> on

#service sanlock start
#service libvirtd start

2. create a lease manually

3. prepare an inactive domain, then do attach-device, detach-device with flag config, current, persistent

# virsh attach-device simple lease.xml --config
Device attached successfully

# virsh dumpxml simple | grep lease -a6
<lease>
      <lockspace>TEST_LS</lockspace>
      <key>test-disk-resource-lock</key>
      <target path='/var/lib/libvirt/sanlock/test-disk-resource-lock'/>
    </lease>
# virsh detach-device simple lease.xml --config
Device detached successfully
# virsh dumpxml simple | grep lease -a6


# virsh attach-device simple lease.xml --current
Device attached successfully
# virsh dumpxml simple | grep lease -a6
<lease>
      <lockspace>TEST_LS</lockspace>
      <key>test-disk-resource-lock</key>
      <target path='/var/lib/libvirt/sanlock/test-disk-resource-lock'/>
    </lease>
# virsh detach-device simple lease.xml --current
Device detached successfully
# virsh dumpxml simple | grep lease -a6

# virsh attach-device simple lease.xml --persistent
Device attached successfully
# virsh dumpxml simple | grep lease -a6
<lease>
      <lockspace>TEST_LS</lockspace>
      <key>test-disk-resource-lock</key>
      <target path='/var/lib/libvirt/sanlock/test-disk-resource-lock'/>
    </lease>
# virsh detach-device simple lease.xml --persistent
Device detached successfully
# virsh dumpxml simple | grep lease -a6

Also check attach-device, detach-device on active domain, all work well.

Comment 5 errata-xmlrpc 2015-11-19 05:58:22 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://rhn.redhat.com/errata/RHBA-2015-2202.html


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