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@redhat.com>
This commit is contained in:
Fred A. Kemp
2013-08-23 12:38:11 +02:00
committed by Peter Krempa
parent 071249771b
commit feba2febce
13 changed files with 133 additions and 7 deletions

View File

@@ -213,3 +213,14 @@ scsi-generic.bootindex=int32
scsi-generic.channel=uint32
scsi-generic.scsi-id=uint32
scsi-generic.lun=uint32
usb-storage.drive=drive
usb-storage.logical_block_size=blocksize
usb-storage.physical_block_size=blocksize
usb-storage.min_io_size=uint16
usb-storage.opt_io_size=uint32
usb-storage.bootindex=int32
usb-storage.discard_granularity=uint32
usb-storage.serial=string
usb-storage.removable=on/off
usb-storage.port=string
usb-storage.full-path=on/off

View File

@@ -225,3 +225,14 @@ scsi-generic.bootindex=int32
scsi-generic.channel=uint32
scsi-generic.scsi-id=uint32
scsi-generic.lun=uint32
usb-storage.drive=drive
usb-storage.logical_block_size=blocksize
usb-storage.physical_block_size=blocksize
usb-storage.min_io_size=uint16
usb-storage.opt_io_size=uint32
usb-storage.bootindex=int32
usb-storage.discard_granularity=uint32
usb-storage.serial=string
usb-storage.removable=on/off
usb-storage.port=string
usb-storage.full-path=on/off