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 file(self, value: ShellPath) -> DriveBuilder<SetFile<S>>where
S::File: IsUnset,
pub fn file(self, value: ShellPath) -> 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<ShellPath>) -> DriveBuilder<SetFile<S>>where
S::File: IsUnset,
pub fn maybe_file(self, value: Option<ShellPath>) -> 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: ShellString) -> DriveBuilder<SetIndex<S>>where
S::Index: IsUnset,
pub fn index(self, value: ShellString) -> DriveBuilder<SetIndex<S>>where
S::Index: IsUnset,
Sourcepub fn maybe_index(
self,
value: Option<ShellString>,
) -> DriveBuilder<SetIndex<S>>where
S::Index: IsUnset,
pub fn maybe_index(
self,
value: Option<ShellString>,
) -> 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 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 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: ShellString) -> DriveBuilder<SetFormat<S>>where
S::Format: IsUnset,
pub fn format(self, value: ShellString) -> DriveBuilder<SetFormat<S>>where
S::Format: IsUnset,
Sourcepub fn maybe_format(
self,
value: Option<ShellString>,
) -> DriveBuilder<SetFormat<S>>where
S::Format: IsUnset,
pub fn maybe_format(
self,
value: Option<ShellString>,
) -> DriveBuilder<SetFormat<S>>where
S::Format: IsUnset,
Sourcepub fn encrypt_format(
self,
value: ShellString,
) -> DriveBuilder<SetEncryptFormat<S>>where
S::EncryptFormat: IsUnset,
pub fn encrypt_format(
self,
value: ShellString,
) -> DriveBuilder<SetEncryptFormat<S>>where
S::EncryptFormat: IsUnset,
Sourcepub fn maybe_encrypt_format(
self,
value: Option<ShellString>,
) -> DriveBuilder<SetEncryptFormat<S>>where
S::EncryptFormat: IsUnset,
pub fn maybe_encrypt_format(
self,
value: Option<ShellString>,
) -> DriveBuilder<SetEncryptFormat<S>>where
S::EncryptFormat: IsUnset,
Sourcepub fn encrypt_key_secret(
self,
value: ShellString,
) -> DriveBuilder<SetEncryptKeySecret<S>>where
S::EncryptKeySecret: IsUnset,
pub fn encrypt_key_secret(
self,
value: ShellString,
) -> DriveBuilder<SetEncryptKeySecret<S>>where
S::EncryptKeySecret: IsUnset,
Sourcepub fn maybe_encrypt_key_secret(
self,
value: Option<ShellString>,
) -> DriveBuilder<SetEncryptKeySecret<S>>where
S::EncryptKeySecret: IsUnset,
pub fn maybe_encrypt_key_secret(
self,
value: Option<ShellString>,
) -> DriveBuilder<SetEncryptKeySecret<S>>where
S::EncryptKeySecret: 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.
Sourcepub fn werror(self, value: DriveErrorAction) -> DriveBuilder<SetWerror<S>>where
S::Werror: IsUnset,
pub fn werror(self, value: DriveErrorAction) -> DriveBuilder<SetWerror<S>>where
S::Werror: IsUnset,
Sourcepub fn maybe_werror(
self,
value: Option<DriveErrorAction>,
) -> DriveBuilder<SetWerror<S>>where
S::Werror: IsUnset,
pub fn maybe_werror(
self,
value: Option<DriveErrorAction>,
) -> DriveBuilder<SetWerror<S>>where
S::Werror: IsUnset,
Sourcepub fn id(self, value: ShellString) -> DriveBuilder<SetId<S>>where
S::Id: IsUnset,
pub fn id(self, value: ShellString) -> DriveBuilder<SetId<S>>where
S::Id: IsUnset,
Sourcepub fn maybe_id(self, value: Option<ShellString>) -> DriveBuilder<SetId<S>>where
S::Id: IsUnset,
pub fn maybe_id(self, value: Option<ShellString>) -> DriveBuilder<SetId<S>>where
S::Id: IsUnset,
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 readonly=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 readonly=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,
Sourcepub fn copy_on_read(self, value: OnOff) -> DriveBuilder<SetCopyOnRead<S>>where
S::CopyOnRead: IsUnset,
pub fn copy_on_read(self, value: OnOff) -> DriveBuilder<SetCopyOnRead<S>>where
S::CopyOnRead: IsUnset,
Sourcepub fn maybe_copy_on_read(
self,
value: Option<OnOff>,
) -> DriveBuilder<SetCopyOnRead<S>>where
S::CopyOnRead: IsUnset,
pub fn maybe_copy_on_read(
self,
value: Option<OnOff>,
) -> DriveBuilder<SetCopyOnRead<S>>where
S::CopyOnRead: IsUnset,
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 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.