Bug 1341998 - libvirt returns an error when detaching floppy volume from a running qemu vm
Summary: libvirt returns an error when detaching floppy volume from a running qemu vm
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-02 09:07 UTC by Andrew Cook
Modified: 2016-06-26 20:55 UTC (History)
9 users (show)

Fixed In Version: libvirt-1.3.3.1-4.fc24
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-26 20:55:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Andrew Cook 2016-06-02 09:07:23 UTC
Description of problem:
libvirt returns an error when detaching floppy volume from a running qemu vm

Version-Release number of selected component (if applicable):
Version     : 1.3.3.1
Release     : 2.fc24

How reproducible:
Always

Steps to Reproduce:
From either virsh or virt-manager
1. Add floppy drive to domain with a backing volume
2. Start domain
3. detach the volume from the floppy drive

Actual results:
Fails with "Error: An error occurred, but the cause is unknown

Expected results:
Volume is detached

Additional info:
The volume actually detaches in qemu (confirmed via qemu-monitor-command) but libvirt seems to be waiting for an event from the floppy device, which isn't sent by qemu.

Successful detach of a cdrom (captured via strace):
write(25, "{"execute":"eject","arguments":{"device":"drive-ide0-0-1","force":false},"id":"libvirt-672"}\r\n", 94)
read(25, "{"timestamp": {"seconds": 1464848422, "microseconds": 600129}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "drive-ide0-0-1", "tray-open": true}}\r\n", 1023)
read(25, "{"return": {}, "id": "libvirt-672"}\r\n", 1023)

Unsuccessful detach of a floppy:
write(25, "{"execute":"eject","arguments":{"device":"drive-fdc0-0-0","force":false},"id":"libvirt-791"}\r\n", 94)
read(25, "{"return": {}, "id": "libvirt-791"}\r\n", 1023)

Comment 1 Andrew Cook 2016-06-02 09:08:35 UTC
qemu version:
Name        : qemu-system-x86
Version     : 2.6.0
Release     : 3.fc24

Comment 2 Peter Krempa 2016-06-02 10:14:12 UTC
This was already fixed in upstream libvirt:

$ git desc 72a7ff6b507bcf389cc493ac0ba07d32de266d6e
v1.3.4-465-g72a7ff6

It will be included in the upcomming 1.3.5 release.

commit 72a7ff6b507bcf389cc493ac0ba07d32de266d6e
Author: Peter Krempa <pkrempa>
Date:   Thu May 19 15:30:12 2016 +0200

    qemu: hotplug: wait for the tray to eject only for drives with a tray
    
    Use the detected tray presence flag to trigger the tray waiting code
    only if the given storage device in qemu reports to have a tray.
    
    This is necessary as the floppy device lost it's tray as of qemu commit:
    
    commit abb3e55b5b718d6392441f56ba0729a62105ac56
    Author: Max Reitz <mreitz>
    Date:   Fri Jan 29 20:49:12 2016 +0100
    
        Revert "hw/block/fdc: Implement tray status"

commit 2e75da42e41af0cd48ca6f75d0606b40a366cc54
Author: Peter Krempa <pkrempa>
Date:   Mon May 23 16:32:06 2016 +0200

    qemu: hotplug: Fix error reported when cdrom tray is locked
    
    Commit 1fad65d49aae364576bd91352a001249510f8d4e used a really big hammer
    and overwrote the error message that might be reported by qemu if the
    tray is locked. Fix it by reporting the error only if no error is
    currently set.
    
    Error after commit mentioned above:
    error: internal error: timed out waiting for disk tray status update
    
    New error:
    error: internal error: unable to execute QEMU command 'eject': Tray of
    device 'drive-ide0-0-0' is not open

commit 0aa19f35e0f3c1712f2569986d4d0a93b488c35c
Author: Peter Krempa <pkrempa>
Date:   Mon May 23 14:50:17 2016 +0200

    qemu: hotplug: Extract code for waiting for tray eject
    
    The code grew rather convoluted. Extract it to a separate function.

commit 894dc85fd1ebcd63d8c897b355c550e68a5f432d
Author: Peter Krempa <pkrempa>
Date:   Thu May 19 15:29:02 2016 +0200

    qemu: process: Fix and improve disk data extraction
    
    Extract information for all disks and update tray state and source only
    for removable drives. Additionally store whether a drive is removable
    and whether it has a tray.

commit d9bee413ade28e1e43ef222c7aaaa3c6d6fda0f1
Author: Peter Krempa <pkrempa>
Date:   Mon May 23 14:00:35 2016 +0200

    qemu: Move and rename qemuDomainCheckEjectableMedia to qemuProcessRefreshDisks
    
    Move it to a more sane place since it's refreshing data about disks.

commit f1690dc3d7934bf70f4fbc84d55bf210276c6f27
Author: Peter Krempa <pkrempa>
Date:   Thu May 19 14:57:41 2016 +0200

    qemu: Extract more information about qemu drives
    
    Extract whether a given drive has a tray and whether there is no image
    inserted.
    
    Negative logic for the image insertion is chosen so that the flag is set
    only if we are certain of the fact.

commit 5f963d89b1220460fadb1bf6fc347d26b311c1b2
Author: Peter Krempa <pkrempa>
Date:   Fri May 20 07:21:04 2016 +0200

    qemu: Move struct qemuDomainDiskInfo to qemu_domain.h

Patches above depend on:
commit 833ae6b4356934e7b779c4be01bd2bf051930dde
Author: Peter Krempa <pkrempa>
Date:   Fri Apr 29 13:49:13 2016 +0200

    qemu: hotplug: Skip waiting for tray opening if qemu doesn't notify us
    
    If qemu doesn't support DEVICE_TRAY_MOVED event the code that attempts
    to change media would attempt to re-eject the tray even if it wouldn't
    be notified when the tray opened. Add a capability bit and skip retrying
    for old qemus.

commit a34faf33011c5c0d7b47ee0849bf1e11635e17c5
Author: Peter Krempa <pkrempa>
Date:   Fri Apr 29 13:38:51 2016 +0200

    qemu: process: Refresh ejectable media tray state on VM start
    
    Empty floppy drives start with tray in "open" state and libvirt did not
    refresh it after startup. The code that inserts media into the tray then
    waited until the tray was open before inserting the media and thus
    floppies could not be inserted.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1326660

Comment 3 Fedora Update System 2016-06-23 22:32:00 UTC
libvirt-1.3.3.1-4.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-b2f402a414

Comment 4 Fedora Update System 2016-06-25 00:32:03 UTC
libvirt-1.3.3.1-4.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-b2f402a414

Comment 5 Fedora Update System 2016-06-26 20:54:54 UTC
libvirt-1.3.3.1-4.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.


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