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

@@ -1792,9 +1792,13 @@
removable disks (i.e. CDROM or Floppy disk), the value can be either
"open" or "closed", defaults to "closed". NB, the value of
<code>tray</code> could be updated while the domain is running.
<span class="since">Since 0.0.3; <code>bus</code> attribute since 0.4.3;
The optional attribute <code>removable</code> sets the
removable flag for USB disks, and its value can be either "on"
or "off", defaulting to "off". <span class="since">Since
0.0.3; <code>bus</code> attribute since 0.4.3;
<code>tray</code> attribute since 0.9.11; "usb" attribute value since
after 0.4.4; "sata" attribute value since 0.9.7</span>
after 0.4.4; "sata" attribute value since 0.9.7; "removable" attribute
value since 1.1.3</span>
</dd>
<dt><code>iotune</code></dt>
<dd>The optional <code>iotune</code> element provides the

View File

@@ -1287,6 +1287,14 @@
</choice>
</attribute>
</optional>
<optional>
<attribute name="removable">
<choice>
<value>on</value>
<value>off</value>
</choice>
</attribute>
</optional>
</element>
</define>
<define name="geometry">