pub struct Drive {Show 41 fields
pub file: Option<ShellPath>,
pub interface: Option<DriveInterface>,
pub bus: Option<usize>,
pub unit: Option<usize>,
pub index: Option<ShellString>,
pub media: Option<DriveMedia>,
pub snapshot: Option<OnOff>,
pub cache: Option<DriveCacheType>,
pub cache_direct: Option<OnOff>,
pub aio: Option<DriveAIOType>,
pub format: Option<ShellString>,
pub encrypt_format: Option<ShellString>,
pub encrypt_key_secret: Option<ShellString>,
pub rerror: Option<DriveErrorAction>,
pub werror: Option<DriveErrorAction>,
pub id: Option<ShellString>,
pub read_only: Option<OnOff>,
pub auto_read_only: Option<OnOff>,
pub copy_on_read: Option<OnOff>,
pub discard: Option<IgnoreUnmap>,
pub detect_zeroes: Option<OnOffUnmap>,
pub bps: Option<usize>,
pub bps_rd: Option<usize>,
pub bps_wr: Option<usize>,
pub bps_max: Option<usize>,
pub bps_rd_max: Option<usize>,
pub bps_wr_max: Option<usize>,
pub iops: Option<usize>,
pub iops_rd: Option<usize>,
pub iops_wr: Option<usize>,
pub iops_max: Option<usize>,
pub iops_rd_max: Option<usize>,
pub iops_wr_max: Option<usize>,
pub iops_size: Option<usize>,
pub group: Option<ShellString>,
pub throttling_bps_total: Option<usize>,
pub throttling_bps_total_max: Option<usize>,
pub throttling_bps_total_max_length: Option<usize>,
pub throttling_iops_total: Option<usize>,
pub throttling_iops_total_max: Option<usize>,
pub throttling_iops_total_max_length: Option<usize>,
}Expand description
Define a new drive. This includes creating a block driver node (the
backend) as well as a guest device, and is mostly a shortcut for
defining the corresponding -blockdev and -device options.
-drive accepts all options that are accepted by -blockdev.
Fields§
§file: Option<ShellPath>This option defines which disk image (see the :ref:disk images
chapter in the System Emulation Users Guide) to use with this drive.
If the filename contains comma, you must double it (for instance,
“file=my,,file” to use file “my,file”).
Special files such as iSCSI devices can be specified using protocol specific URLs. See the section for “Device URL Syntax” for more information.
interface: Option<DriveInterface>This option defines on which type on interface the drive is connected. Available types are: ide, scsi, sd, mtd, floppy, pflash, virtio, none.
bus: Option<usize>These options define where is connected the drive by defining the bus number and the unit id.
unit: Option<usize>§index: Option<ShellString>This option defines where the drive is connected by using an index in the list of available connectors of a given interface type.
media: Option<DriveMedia>This option defines the type of the media: disk or cdrom.
snapshot: Option<OnOff>snapshot is “on” or “off” and controls snapshot mode for the
given drive (see -snapshot).
cache: Option<DriveCacheType>cache is “none”, “writeback”, “unsafe”, “directsync” or
“writethrough” and controls how the host cache is used to access
block data. This is a shortcut that sets the cache.direct
and cache.no-flush options (as in -blockdev), and
additionally cache.writeback, which provides a default for
the write-cache option of block guest devices (as in
-device). The modes correspond to the following settings:
============= =============== ============ ============== \ cache.writeback cache.direct cache.no-flush ============= =============== ============ ============== writeback on off off none on on off writethrough off off off directsync off on off unsafe on off on ============= =============== ============ ==============
The default mode is cache=writeback.
cache_direct: Option<OnOff>Avoid the host page cache when enabled.
aio: Option<DriveAIOType>aio is “threads”, “native”, or “io_uring” and selects between pthread based disk I/O, native Linux AIO, or Linux io_uring API.
format: Option<ShellString>Specify which disk format will be used rather than detecting the format. Can be used to specify format=raw to avoid interpreting an untrusted format header.
encrypt_format: Option<ShellString>Encryption format passed through to the block layer.
encrypt_key_secret: Option<ShellString>Secret object id used as the encryption key.
rerror: Option<DriveErrorAction>Specify which action to take on write and read errors. Valid
actions are: “ignore” (ignore the error and try to continue),
“stop” (pause QEMU), “report” (report the error to the guest),
“enospc” (pause QEMU only if the host disk is full; report the
error to the guest otherwise). The default setting is
werror=enospc and rerror=report.
werror: Option<DriveErrorAction>§id: Option<ShellString>§read_only: Option<OnOff>Open the node read-only. Guest write attempts will fail.
Note that some block drivers support only read-only access,
either generally or in certain configurations. In this case,
the default value readonly=off does not work and the
option must be specified explicitly.
auto_read_only: Option<OnOff>Allow QEMU to fall back to read-only usage when requested access fails.
copy_on_read: Option<OnOff>copy-on-read= is on or off and enables whether to copy read
backing file sectors into the image file.
discard: Option<IgnoreUnmap>discard is one of “ignore” (or “off”) or “unmap” (or “on”)
and controls whether discard (also known as trim or
unmap) requests are ignored or passed to the filesystem.
Some machine types may not support discard requests.
detect_zeroes: Option<OnOffUnmap>detect-zeroes is “off”, “on” or “unmap” and enables the
automatic conversion of plain zero writes by the OS to
driver specific optimized zero write commands. You may even
choose “unmap” if discard is set to “unmap” to allow a zero
write to be converted to an unmap operation.
bps: Option<usize>Specify bandwidth throttling limits in bytes per second, either for all request types or for reads or writes only. Small values can lead to timeouts or hangs inside the guest. A safe minimum for disks is 2 MB/s.
bps_rd: Option<usize>§bps_wr: Option<usize>§bps_max: Option<usize>Specify bursts in bytes per second, either for all request types or for reads or writes only. Bursts allow the guest I/O to spike above the limit temporarily.
bps_rd_max: Option<usize>§bps_wr_max: Option<usize>§iops: Option<usize>Specify request rate limits in requests per second, either for all request types or for reads or writes only.
iops_rd: Option<usize>§iops_wr: Option<usize>§iops_max: Option<usize>Specify bursts in requests per second, either for all request types or for reads or writes only. Bursts allow the guest I/O to spike above the limit temporarily.
iops_rd_max: Option<usize>§iops_wr_max: Option<usize>§iops_size: Option<usize>Let every is bytes of a request count as a new request for iops throttling purposes. Use this option to prevent guests from circumventing iops limits by sending fewer but larger requests.
group: Option<ShellString>Join a throttling quota group with given name g. All drives that are members of the same group are accounted for together. Use this option to prevent guests from circumventing throttling limits by using many small disks instead of a single larger disk.
throttling_bps_total: Option<usize>§throttling_bps_total_max: Option<usize>§throttling_bps_total_max_length: Option<usize>§throttling_iops_total: Option<usize>§throttling_iops_total_max: Option<usize>§throttling_iops_total_max_length: Option<usize>Implementations§
Trait Implementations§
Source§impl Arbitrary for Drive
impl Arbitrary for Drive
Source§type Parameters = (<Option<ShellPath> as Arbitrary>::Parameters, <Option<DriveInterface> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<ShellString> as Arbitrary>::Parameters, <Option<DriveMedia> as Arbitrary>::Parameters, <Option<OnOff> as Arbitrary>::Parameters, <Option<DriveCacheType> as Arbitrary>::Parameters, <Option<OnOff> as Arbitrary>::Parameters, (<Option<DriveAIOType> as Arbitrary>::Parameters, <Option<ShellString> as Arbitrary>::Parameters, <Option<ShellString> as Arbitrary>::Parameters, <Option<ShellString> as Arbitrary>::Parameters, <Option<DriveErrorAction> as Arbitrary>::Parameters, <Option<DriveErrorAction> as Arbitrary>::Parameters, <Option<ShellString> as Arbitrary>::Parameters, <Option<OnOff> as Arbitrary>::Parameters, <Option<OnOff> as Arbitrary>::Parameters, (<Option<OnOff> as Arbitrary>::Parameters, <Option<IgnoreUnmap> as Arbitrary>::Parameters, <Option<OnOffUnmap> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, (<Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<ShellString> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, (<Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters)))))
type Parameters = (<Option<ShellPath> as Arbitrary>::Parameters, <Option<DriveInterface> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<ShellString> as Arbitrary>::Parameters, <Option<DriveMedia> as Arbitrary>::Parameters, <Option<OnOff> as Arbitrary>::Parameters, <Option<DriveCacheType> as Arbitrary>::Parameters, <Option<OnOff> as Arbitrary>::Parameters, (<Option<DriveAIOType> as Arbitrary>::Parameters, <Option<ShellString> as Arbitrary>::Parameters, <Option<ShellString> as Arbitrary>::Parameters, <Option<ShellString> as Arbitrary>::Parameters, <Option<DriveErrorAction> as Arbitrary>::Parameters, <Option<DriveErrorAction> as Arbitrary>::Parameters, <Option<ShellString> as Arbitrary>::Parameters, <Option<OnOff> as Arbitrary>::Parameters, <Option<OnOff> as Arbitrary>::Parameters, (<Option<OnOff> as Arbitrary>::Parameters, <Option<IgnoreUnmap> as Arbitrary>::Parameters, <Option<OnOffUnmap> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, (<Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<ShellString> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, (<Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters, <Option<usize> as Arbitrary>::Parameters)))))
arbitrary_with accepts for configuration
of the generated Strategy. Parameters must implement Default.Source§type Strategy = Map<(<Option<ShellPath> as Arbitrary>::Strategy, <Option<DriveInterface> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<ShellString> as Arbitrary>::Strategy, <Option<DriveMedia> as Arbitrary>::Strategy, <Option<OnOff> as Arbitrary>::Strategy, <Option<DriveCacheType> as Arbitrary>::Strategy, <Option<OnOff> as Arbitrary>::Strategy, (<Option<DriveAIOType> as Arbitrary>::Strategy, <Option<ShellString> as Arbitrary>::Strategy, <Option<ShellString> as Arbitrary>::Strategy, <Option<ShellString> as Arbitrary>::Strategy, <Option<DriveErrorAction> as Arbitrary>::Strategy, <Option<DriveErrorAction> as Arbitrary>::Strategy, <Option<ShellString> as Arbitrary>::Strategy, <Option<OnOff> as Arbitrary>::Strategy, <Option<OnOff> as Arbitrary>::Strategy, (<Option<OnOff> as Arbitrary>::Strategy, <Option<IgnoreUnmap> as Arbitrary>::Strategy, <Option<OnOffUnmap> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, (<Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<ShellString> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, (<Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy))))), fn((Option<ShellPath>, Option<DriveInterface>, Option<usize>, Option<usize>, Option<ShellString>, Option<DriveMedia>, Option<OnOff>, Option<DriveCacheType>, Option<OnOff>, (Option<DriveAIOType>, Option<ShellString>, Option<ShellString>, Option<ShellString>, Option<DriveErrorAction>, Option<DriveErrorAction>, Option<ShellString>, Option<OnOff>, Option<OnOff>, (Option<OnOff>, Option<IgnoreUnmap>, Option<OnOffUnmap>, Option<usize>, Option<usize>, Option<usize>, Option<usize>, Option<usize>, Option<usize>, (Option<usize>, Option<usize>, Option<usize>, Option<usize>, Option<usize>, Option<usize>, Option<usize>, Option<ShellString>, Option<usize>, (Option<usize>, Option<usize>, Option<usize>, Option<usize>, Option<usize>)))))) -> Drive>
type Strategy = Map<(<Option<ShellPath> as Arbitrary>::Strategy, <Option<DriveInterface> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<ShellString> as Arbitrary>::Strategy, <Option<DriveMedia> as Arbitrary>::Strategy, <Option<OnOff> as Arbitrary>::Strategy, <Option<DriveCacheType> as Arbitrary>::Strategy, <Option<OnOff> as Arbitrary>::Strategy, (<Option<DriveAIOType> as Arbitrary>::Strategy, <Option<ShellString> as Arbitrary>::Strategy, <Option<ShellString> as Arbitrary>::Strategy, <Option<ShellString> as Arbitrary>::Strategy, <Option<DriveErrorAction> as Arbitrary>::Strategy, <Option<DriveErrorAction> as Arbitrary>::Strategy, <Option<ShellString> as Arbitrary>::Strategy, <Option<OnOff> as Arbitrary>::Strategy, <Option<OnOff> as Arbitrary>::Strategy, (<Option<OnOff> as Arbitrary>::Strategy, <Option<IgnoreUnmap> as Arbitrary>::Strategy, <Option<OnOffUnmap> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, (<Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<ShellString> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, (<Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy, <Option<usize> as Arbitrary>::Strategy))))), fn((Option<ShellPath>, Option<DriveInterface>, Option<usize>, Option<usize>, Option<ShellString>, Option<DriveMedia>, Option<OnOff>, Option<DriveCacheType>, Option<OnOff>, (Option<DriveAIOType>, Option<ShellString>, Option<ShellString>, Option<ShellString>, Option<DriveErrorAction>, Option<DriveErrorAction>, Option<ShellString>, Option<OnOff>, Option<OnOff>, (Option<OnOff>, Option<IgnoreUnmap>, Option<OnOffUnmap>, Option<usize>, Option<usize>, Option<usize>, Option<usize>, Option<usize>, Option<usize>, (Option<usize>, Option<usize>, Option<usize>, Option<usize>, Option<usize>, Option<usize>, Option<usize>, Option<ShellString>, Option<usize>, (Option<usize>, Option<usize>, Option<usize>, Option<usize>, Option<usize>)))))) -> Drive>
Strategy used to generate values of type Self.Source§fn arbitrary_with(_top: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_top: Self::Parameters) -> Self::Strategy
Source§impl Ord for Drive
impl Ord for Drive
Source§impl PartialOrd for Drive
impl PartialOrd for Drive
Source§impl ToCommand for Drive
impl ToCommand for Drive
Source§fn command(&self) -> String
fn command(&self) -> String
std::process::Command::new()fn has_args(&self) -> bool
Source§fn to_args(&self) -> Vec<String>
fn to_args(&self) -> Vec<String>
std::process::Command::args()Source§fn to_command(&self) -> Vec<String>
fn to_command(&self) -> Vec<String>
Source§fn to_single_command(&self) -> String
fn to_single_command(&self) -> String
StringSource§fn to_single_arg(&self) -> String
fn to_single_arg(&self) -> String
String