pub struct Qcow2CreateBuilder<S: Storage + 'static, F: WrappedFormat<S> + 'static = FormatAccess<S>> {
base: FormatCreateBuilderBase<S>,
backing: Option<(String, String)>,
data_file: Option<(String, S)>,
cluster_size: usize,
refcount_width: usize,
_wrapped_format: PhantomData<F>,
}
Expand description
Options builder for creating (formatting) a qcow2 image.
Allows setting various options for a new qcow2 image.
Fields§
§base: FormatCreateBuilderBase<S>
Basic options.
backing: Option<(String, String)>
Backing image filename and format
data_file: Option<(String, S)>
External data file name and the file itself
cluster_size: usize
Cluster size
refcount_width: usize
Refcount bit width
_wrapped_format: PhantomData<F>
Needed for the correct create_open()
return type
Implementations§
Source§impl<S: Storage + 'static, F: WrappedFormat<S> + 'static> Qcow2CreateBuilder<S, F>
impl<S: Storage + 'static, F: WrappedFormat<S> + 'static> Qcow2CreateBuilder<S, F>
Sourcepub fn backing(self, backing_filename: String, backing_format: String) -> Self
pub fn backing(self, backing_filename: String, backing_format: String) -> Self
Set a backing image.
Set the path to the backing image to be written into the image header; this path will be interpreted relative to the qcow2 image file.
The backing format should be one of “qcow2” or “raw”.
Neither of filename or format are checked for validity.
Sourcepub fn data_file(self, filename: String, file: S) -> Self
pub fn data_file(self, filename: String, file: S) -> Self
Set an external data file.
Set the path for an external data file. This path will be interpreted relative to the
qcow2 image file. This path is not checked for whether it matches file
or even points to
anything at all.
file
is the data file itself; it is necessary to pass this storage object into the
builder for preallocation purposes.
Sourcepub fn cluster_size(self, size: usize) -> Self
pub fn cluster_size(self, size: usize) -> Self
Set the cluster size (in bytes).
A cluster is the unit of allocation for qcow2 images. Smaller clusters can lead to better COW performance, but worse performance for fully allocated images, and have increased metadata size overhead.
Must be a power of two between 512 and 2 MiB (inclusive).
The default is 64 KiB.
Sourcepub fn refcount_width(self, bits: usize) -> Self
pub fn refcount_width(self, bits: usize) -> Self
Set the refcount width in bits.
Reference counting is used to determine empty areas in the image file, though this only needs refcounts of 0 and 1, i.e. a reference bit width of 1.
Larger refcount bit widths are only needed when using internal snapshots, in which case multiple snapshots can share clusters.
Must be a power of two between 1 and 64 (inclusive).
The default is 16 bits.