Bug 922495

Summary: Support setting the 'removable' flag for USB disks
Product: [Community] Virtualization Tools Reporter: Tails developers <tails>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: acathrow, cfergeau, pkrempa
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-02 13:44:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tails developers 2013-03-17 13:32:42 UTC
We need an attribute named 'removable' to the target element for
disks, which controls the disk's removable flag.

The intended result is to append 'removable=on' to the '-device' parameter passed to qemu when adding a USB disk via '-disk'. For instance, on a Linux guest it controls the value of /sys/block/$dev/removable.

Beware, this feature should always remains 'off' when running versions of qemu that only support '-usbdevice disk:' for adding USB disks.

This feature probably only makes sense for qemu USB disks.

Comment 1 Peter Krempa 2013-09-02 13:44:51 UTC
This feature was added upstream with:

commit feba2febce4719a2f15b8d4823c2093c2d066314
Author: Fred A. Kemp <anonym>
Date:   Fri Aug 23 12:38:11 2013 +0200

    qemu: Support setting the 'removable' flag for USB disks
    
    Add an attribute named 'removable' to the 'target' element of disks,
    which controls the removable flag. For instance, on a Linux guest it
    controls the value of /sys/block/$dev/removable. This option is only
    valid for USB disks (i.e. bus='usb'), and its default value is 'off',
    which is the same behaviour as before.
    
    To achieve this, 'removable=on' (or 'off') is appended to the '-device
    usb-storage' parameter sent to qemu when adding a USB disk via
    '-disk'. A capability flag QEMU_CAPS_USB_STORAGE_REMOVABLE was added
    to keep track if this option is supported by the qemu version used.
    
    Bug: https://bugzilla.redhat.com/show_bug.cgi?id=922495
    Signed-off-by: Peter Krempa <pkrempa>

commit 071249771b7a5b04c391865afb189ccbfe37d917
Author: Fred A. Kemp <anonym>
Date:   Fri Aug 23 12:38:10 2013 +0200

    qemu: Add capability flag for usb-storage
    
    Allow use of the usb-storage device only if the new capability flag
    QEMU_CAPS_DEVICE_USB_STORAGE is set, which it is for qemu(-kvm)
    versions >= 0.12.1.2-rhel62-beta.
    
    Signed-off-by: Peter Krempa <pkrempa>