pub struct BlockDevBuilder<S: State = Empty> { /* private fields */ }
Expand description
Use builder syntax to set the inputs and finish with build()
.
Implementations§
Source§impl<S: State> BlockDevBuilder<S>
impl<S: State> BlockDevBuilder<S>
Sourcepub fn build(self) -> BlockDevwhere
S: IsComplete,
pub fn build(self) -> BlockDevwhere
S: IsComplete,
Finish building and return the requested object
Sourcepub fn driver(self, value: String) -> BlockDevBuilder<SetDriver<S>>where
S::Driver: IsUnset,
pub fn driver(self, value: String) -> BlockDevBuilder<SetDriver<S>>where
S::Driver: IsUnset,
Required.
Specifies the block driver to use for the given node.
Sourcepub fn node_name(self, value: String) -> BlockDevBuilder<SetNodeName<S>>where
S::NodeName: IsUnset,
pub fn node_name(self, value: String) -> BlockDevBuilder<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>,
) -> BlockDevBuilder<SetNodeName<S>>where
S::NodeName: IsUnset,
pub fn maybe_node_name(
self,
value: Option<String>,
) -> BlockDevBuilder<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) -> BlockDevBuilder<SetDiscard<S>>where
S::Discard: IsUnset,
pub fn discard(self, value: IgnoreUnmap) -> BlockDevBuilder<SetDiscard<S>>where
S::Discard: IsUnset,
Sourcepub fn maybe_discard(
self,
value: Option<IgnoreUnmap>,
) -> BlockDevBuilder<SetDiscard<S>>where
S::Discard: IsUnset,
pub fn maybe_discard(
self,
value: Option<IgnoreUnmap>,
) -> BlockDevBuilder<SetDiscard<S>>where
S::Discard: IsUnset,
Sourcepub fn cache_direct(self, value: OnOff) -> BlockDevBuilder<SetCacheDirect<S>>where
S::CacheDirect: IsUnset,
pub fn cache_direct(self, value: OnOff) -> BlockDevBuilder<SetCacheDirect<S>>where
S::CacheDirect: IsUnset,
Sourcepub fn maybe_cache_direct(
self,
value: Option<OnOff>,
) -> BlockDevBuilder<SetCacheDirect<S>>where
S::CacheDirect: IsUnset,
pub fn maybe_cache_direct(
self,
value: Option<OnOff>,
) -> BlockDevBuilder<SetCacheDirect<S>>where
S::CacheDirect: IsUnset,
Sourcepub fn cache_no_flush(self, value: OnOff) -> BlockDevBuilder<SetCacheNoFlush<S>>where
S::CacheNoFlush: IsUnset,
pub fn cache_no_flush(self, value: OnOff) -> BlockDevBuilder<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>,
) -> BlockDevBuilder<SetCacheNoFlush<S>>where
S::CacheNoFlush: IsUnset,
pub fn maybe_cache_no_flush(
self,
value: Option<OnOff>,
) -> BlockDevBuilder<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) -> BlockDevBuilder<SetReadOnly<S>>where
S::ReadOnly: IsUnset,
pub fn read_only(self, value: OnOff) -> BlockDevBuilder<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>,
) -> BlockDevBuilder<SetReadOnly<S>>where
S::ReadOnly: IsUnset,
pub fn maybe_read_only(
self,
value: Option<OnOff>,
) -> BlockDevBuilder<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) -> BlockDevBuilder<SetAutoReadOnly<S>>where
S::AutoReadOnly: IsUnset,
pub fn auto_read_only(self, value: OnOff) -> BlockDevBuilder<SetAutoReadOnly<S>>where
S::AutoReadOnly: IsUnset,
Sourcepub fn maybe_auto_read_only(
self,
value: Option<OnOff>,
) -> BlockDevBuilder<SetAutoReadOnly<S>>where
S::AutoReadOnly: IsUnset,
pub fn maybe_auto_read_only(
self,
value: Option<OnOff>,
) -> BlockDevBuilder<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,
) -> BlockDevBuilder<SetDetectZeroes<S>>where
S::DetectZeroes: IsUnset,
pub fn detect_zeroes(
self,
value: OnOffUnmap,
) -> BlockDevBuilder<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>,
) -> BlockDevBuilder<SetDetectZeroes<S>>where
S::DetectZeroes: IsUnset,
pub fn maybe_detect_zeroes(
self,
value: Option<OnOffUnmap>,
) -> BlockDevBuilder<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.