pub struct DriveBuilder<S: State = Empty> { /* private fields */ }
Expand description
Use builder syntax to set the inputs and finish with build()
.
Implementations§
Source§impl<S: State> DriveBuilder<S>
impl<S: State> DriveBuilder<S>
Sourcepub fn build(self) -> Drivewhere
S: IsComplete,
pub fn build(self) -> Drivewhere
S: IsComplete,
Finish building and return the requested object
Sourcepub fn node_name(self, value: String) -> DriveBuilder<SetNodeName<S>>where
S::NodeName: IsUnset,
pub fn node_name(self, value: String) -> DriveBuilder<SetNodeName<S>>where
S::NodeName: IsUnset,
Optional (Some / Option setters).
This defines the name of the block driver node by which it
will be referenced later. The name must be unique, i.e. it
must not match the name of a different block driver node, or
(if you use -drive
as well) the ID of a drive.
If no node name is specified, it is automatically generated. The generated node name is not intended to be predictable and changes between QEMU invocations. For the top level, an explicit node name must be specified.
Sourcepub fn maybe_node_name(
self,
value: Option<String>,
) -> DriveBuilder<SetNodeName<S>>where
S::NodeName: IsUnset,
pub fn maybe_node_name(
self,
value: Option<String>,
) -> DriveBuilder<SetNodeName<S>>where
S::NodeName: IsUnset,
Optional (Some / Option setters).
This defines the name of the block driver node by which it
will be referenced later. The name must be unique, i.e. it
must not match the name of a different block driver node, or
(if you use -drive
as well) the ID of a drive.
If no node name is specified, it is automatically generated. The generated node name is not intended to be predictable and changes between QEMU invocations. For the top level, an explicit node name must be specified.
Sourcepub fn discard(self, value: IgnoreUnmap) -> DriveBuilder<SetDiscard<S>>where
S::Discard: IsUnset,
pub fn discard(self, value: IgnoreUnmap) -> DriveBuilder<SetDiscard<S>>where
S::Discard: IsUnset,
Sourcepub fn maybe_discard(
self,
value: Option<IgnoreUnmap>,
) -> DriveBuilder<SetDiscard<S>>where
S::Discard: IsUnset,
pub fn maybe_discard(
self,
value: Option<IgnoreUnmap>,
) -> DriveBuilder<SetDiscard<S>>where
S::Discard: IsUnset,
Sourcepub fn cache_direct(self, value: OnOff) -> DriveBuilder<SetCacheDirect<S>>where
S::CacheDirect: IsUnset,
pub fn cache_direct(self, value: OnOff) -> DriveBuilder<SetCacheDirect<S>>where
S::CacheDirect: IsUnset,
Sourcepub fn maybe_cache_direct(
self,
value: Option<OnOff>,
) -> DriveBuilder<SetCacheDirect<S>>where
S::CacheDirect: IsUnset,
pub fn maybe_cache_direct(
self,
value: Option<OnOff>,
) -> DriveBuilder<SetCacheDirect<S>>where
S::CacheDirect: IsUnset,
Sourcepub fn cache_no_flush(self, value: OnOff) -> DriveBuilder<SetCacheNoFlush<S>>where
S::CacheNoFlush: IsUnset,
pub fn cache_no_flush(self, value: OnOff) -> DriveBuilder<SetCacheNoFlush<S>>where
S::CacheNoFlush: IsUnset,
Optional (Some / Option setters).
In case you don’t care about data integrity over host
failures, you can use cache.no-flush=on
. This option
tells QEMU that it never needs to write any data to the disk
but can instead keep things in cache. If anything goes
wrong, like your host losing power, the disk storage getting
disconnected accidentally, etc. your image will most
probably be rendered unusable.
Sourcepub fn maybe_cache_no_flush(
self,
value: Option<OnOff>,
) -> DriveBuilder<SetCacheNoFlush<S>>where
S::CacheNoFlush: IsUnset,
pub fn maybe_cache_no_flush(
self,
value: Option<OnOff>,
) -> DriveBuilder<SetCacheNoFlush<S>>where
S::CacheNoFlush: IsUnset,
Optional (Some / Option setters).
In case you don’t care about data integrity over host
failures, you can use cache.no-flush=on
. This option
tells QEMU that it never needs to write any data to the disk
but can instead keep things in cache. If anything goes
wrong, like your host losing power, the disk storage getting
disconnected accidentally, etc. your image will most
probably be rendered unusable.
Sourcepub fn read_only(self, value: OnOff) -> DriveBuilder<SetReadOnly<S>>where
S::ReadOnly: IsUnset,
pub fn read_only(self, value: OnOff) -> DriveBuilder<SetReadOnly<S>>where
S::ReadOnly: IsUnset,
Optional (Some / Option setters).
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 read-only=off
does not work and the
option must be specified explicitly.
Sourcepub fn maybe_read_only(
self,
value: Option<OnOff>,
) -> DriveBuilder<SetReadOnly<S>>where
S::ReadOnly: IsUnset,
pub fn maybe_read_only(
self,
value: Option<OnOff>,
) -> DriveBuilder<SetReadOnly<S>>where
S::ReadOnly: IsUnset,
Optional (Some / Option setters).
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 read-only=off
does not work and the
option must be specified explicitly.
Sourcepub fn auto_read_only(self, value: OnOff) -> DriveBuilder<SetAutoReadOnly<S>>where
S::AutoReadOnly: IsUnset,
pub fn auto_read_only(self, value: OnOff) -> DriveBuilder<SetAutoReadOnly<S>>where
S::AutoReadOnly: IsUnset,
Sourcepub fn maybe_auto_read_only(
self,
value: Option<OnOff>,
) -> DriveBuilder<SetAutoReadOnly<S>>where
S::AutoReadOnly: IsUnset,
pub fn maybe_auto_read_only(
self,
value: Option<OnOff>,
) -> DriveBuilder<SetAutoReadOnly<S>>where
S::AutoReadOnly: IsUnset,
Optional (Some / Option setters).
Override the image locking system of QEMU by forcing the node to utilize weaker shared access for permissions where it would normally request exclusive access. When there is the potential for multiple instances to have the same file open (whether this invocation of QEMU is the first or the second instance), both instances must permit shared access for the second instance to succeed at opening the file.
Enabling force-share=on
requires read-only=on
.
Optional (Some / Option setters).
Override the image locking system of QEMU by forcing the node to utilize weaker shared access for permissions where it would normally request exclusive access. When there is the potential for multiple instances to have the same file open (whether this invocation of QEMU is the first or the second instance), both instances must permit shared access for the second instance to succeed at opening the file.
Enabling force-share=on
requires read-only=on
.
Sourcepub fn detect_zeroes(
self,
value: OnOffUnmap,
) -> DriveBuilder<SetDetectZeroes<S>>where
S::DetectZeroes: IsUnset,
pub fn detect_zeroes(
self,
value: OnOffUnmap,
) -> DriveBuilder<SetDetectZeroes<S>>where
S::DetectZeroes: IsUnset,
Optional (Some / Option setters).
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.
Sourcepub fn maybe_detect_zeroes(
self,
value: Option<OnOffUnmap>,
) -> DriveBuilder<SetDetectZeroes<S>>where
S::DetectZeroes: IsUnset,
pub fn maybe_detect_zeroes(
self,
value: Option<OnOffUnmap>,
) -> DriveBuilder<SetDetectZeroes<S>>where
S::DetectZeroes: IsUnset,
Optional (Some / Option setters).
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.
Sourcepub fn file(self, value: PathBuf) -> DriveBuilder<SetFile<S>>where
S::File: IsUnset,
pub fn file(self, value: PathBuf) -> DriveBuilder<SetFile<S>>where
S::File: IsUnset,
Optional (Some / Option setters).
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.
Sourcepub fn maybe_file(self, value: Option<PathBuf>) -> DriveBuilder<SetFile<S>>where
S::File: IsUnset,
pub fn maybe_file(self, value: Option<PathBuf>) -> DriveBuilder<SetFile<S>>where
S::File: IsUnset,
Optional (Some / Option setters).
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.
Sourcepub fn interface(self, value: DriveInterface) -> DriveBuilder<SetInterface<S>>where
S::Interface: IsUnset,
pub fn interface(self, value: DriveInterface) -> DriveBuilder<SetInterface<S>>where
S::Interface: IsUnset,
Sourcepub fn maybe_interface(
self,
value: Option<DriveInterface>,
) -> DriveBuilder<SetInterface<S>>where
S::Interface: IsUnset,
pub fn maybe_interface(
self,
value: Option<DriveInterface>,
) -> DriveBuilder<SetInterface<S>>where
S::Interface: IsUnset,
Sourcepub fn bus(self, value: usize) -> DriveBuilder<SetBus<S>>where
S::Bus: IsUnset,
pub fn bus(self, value: usize) -> DriveBuilder<SetBus<S>>where
S::Bus: IsUnset,
Sourcepub fn maybe_bus(self, value: Option<usize>) -> DriveBuilder<SetBus<S>>where
S::Bus: IsUnset,
pub fn maybe_bus(self, value: Option<usize>) -> DriveBuilder<SetBus<S>>where
S::Bus: IsUnset,
Sourcepub fn unit(self, value: usize) -> DriveBuilder<SetUnit<S>>where
S::Unit: IsUnset,
pub fn unit(self, value: usize) -> DriveBuilder<SetUnit<S>>where
S::Unit: IsUnset,
Sourcepub fn maybe_unit(self, value: Option<usize>) -> DriveBuilder<SetUnit<S>>where
S::Unit: IsUnset,
pub fn maybe_unit(self, value: Option<usize>) -> DriveBuilder<SetUnit<S>>where
S::Unit: IsUnset,
Sourcepub fn index(self, value: String) -> DriveBuilder<SetIndex<S>>where
S::Index: IsUnset,
pub fn index(self, value: String) -> DriveBuilder<SetIndex<S>>where
S::Index: IsUnset,
Sourcepub fn maybe_index(self, value: Option<String>) -> DriveBuilder<SetIndex<S>>where
S::Index: IsUnset,
pub fn maybe_index(self, value: Option<String>) -> DriveBuilder<SetIndex<S>>where
S::Index: IsUnset,
Sourcepub fn media(self, value: DriveMedia) -> DriveBuilder<SetMedia<S>>where
S::Media: IsUnset,
pub fn media(self, value: DriveMedia) -> DriveBuilder<SetMedia<S>>where
S::Media: IsUnset,
Sourcepub fn maybe_media(self, value: Option<DriveMedia>) -> DriveBuilder<SetMedia<S>>where
S::Media: IsUnset,
pub fn maybe_media(self, value: Option<DriveMedia>) -> DriveBuilder<SetMedia<S>>where
S::Media: IsUnset,
Sourcepub fn snapshot(self, value: OnOff) -> DriveBuilder<SetSnapshot<S>>where
S::Snapshot: IsUnset,
pub fn snapshot(self, value: OnOff) -> DriveBuilder<SetSnapshot<S>>where
S::Snapshot: IsUnset,
Sourcepub fn maybe_snapshot(
self,
value: Option<OnOff>,
) -> DriveBuilder<SetSnapshot<S>>where
S::Snapshot: IsUnset,
pub fn maybe_snapshot(
self,
value: Option<OnOff>,
) -> DriveBuilder<SetSnapshot<S>>where
S::Snapshot: IsUnset,
Sourcepub fn cache(self, value: DriveCacheType) -> DriveBuilder<SetCache<S>>where
S::Cache: IsUnset,
pub fn cache(self, value: DriveCacheType) -> DriveBuilder<SetCache<S>>where
S::Cache: IsUnset,
Optional (Some / Option setters).
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
.
Sourcepub fn maybe_cache(
self,
value: Option<DriveCacheType>,
) -> DriveBuilder<SetCache<S>>where
S::Cache: IsUnset,
pub fn maybe_cache(
self,
value: Option<DriveCacheType>,
) -> DriveBuilder<SetCache<S>>where
S::Cache: IsUnset,
Optional (Some / Option setters).
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
.
Sourcepub fn id(self, value: String) -> DriveBuilder<SetId<S>>where
S::Id: IsUnset,
pub fn id(self, value: String) -> DriveBuilder<SetId<S>>where
S::Id: IsUnset,
Sourcepub fn maybe_id(self, value: Option<String>) -> DriveBuilder<SetId<S>>where
S::Id: IsUnset,
pub fn maybe_id(self, value: Option<String>) -> DriveBuilder<SetId<S>>where
S::Id: IsUnset,
Sourcepub fn aio(self, value: DriveAIOType) -> DriveBuilder<SetAio<S>>where
S::Aio: IsUnset,
pub fn aio(self, value: DriveAIOType) -> DriveBuilder<SetAio<S>>where
S::Aio: IsUnset,
Sourcepub fn maybe_aio(self, value: Option<DriveAIOType>) -> DriveBuilder<SetAio<S>>where
S::Aio: IsUnset,
pub fn maybe_aio(self, value: Option<DriveAIOType>) -> DriveBuilder<SetAio<S>>where
S::Aio: IsUnset,
Sourcepub fn format(self, value: String) -> DriveBuilder<SetFormat<S>>where
S::Format: IsUnset,
pub fn format(self, value: String) -> DriveBuilder<SetFormat<S>>where
S::Format: IsUnset,
Sourcepub fn maybe_format(self, value: Option<String>) -> DriveBuilder<SetFormat<S>>where
S::Format: IsUnset,
pub fn maybe_format(self, value: Option<String>) -> DriveBuilder<SetFormat<S>>where
S::Format: IsUnset,
Sourcepub fn rerror(self, value: DriveErrorAction) -> DriveBuilder<SetRerror<S>>where
S::Rerror: IsUnset,
pub fn rerror(self, value: DriveErrorAction) -> DriveBuilder<SetRerror<S>>where
S::Rerror: IsUnset,
Optional (Some / Option setters).
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
.
Sourcepub fn maybe_rerror(
self,
value: Option<DriveErrorAction>,
) -> DriveBuilder<SetRerror<S>>where
S::Rerror: IsUnset,
pub fn maybe_rerror(
self,
value: Option<DriveErrorAction>,
) -> DriveBuilder<SetRerror<S>>where
S::Rerror: IsUnset,
Optional (Some / Option setters).
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
.