mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: block: Introduce helper for deciding when a 'format' layer is needed
The 'format' layer is not required in certain cases. As the logic for this will be a bit more involved create a helper function to do the decision. For now we'll keep to always format the 'format' -blockdev layer. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
aaf828d3d4
commit
7f19a55a9e
@ -3291,6 +3291,25 @@ qemuBlockStorageSourceNeedsStorageSliceLayer(const virStorageSource *src)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuBlockStorageSourceNeedsFormatLayer:
|
||||
* @src: storage source
|
||||
*
|
||||
* Returns true if configuration of @src requires a 'format' layer -blockdev.
|
||||
*
|
||||
* Important: This helper must be used only for decisions when setting up a
|
||||
* '-blockdev' backend in which case the format layer node name will be populated.
|
||||
* Any cases when the backend can be already in use must decide based on the
|
||||
* existence of the format layer nodename.
|
||||
*/
|
||||
bool
|
||||
qemuBlockStorageSourceNeedsFormatLayer(const virStorageSource *src G_GNUC_UNUSED)
|
||||
{
|
||||
/* Currently we always create a 'format' layer */
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* qemuBlockStorageSourceGetCookieString:
|
||||
* @src: storage source
|
||||
|
@ -280,6 +280,9 @@ qemuBlockReopenReadOnly(virDomainObj *vm,
|
||||
bool
|
||||
qemuBlockStorageSourceNeedsStorageSliceLayer(const virStorageSource *src);
|
||||
|
||||
bool
|
||||
qemuBlockStorageSourceNeedsFormatLayer(const virStorageSource *src);
|
||||
|
||||
char *
|
||||
qemuBlockStorageSourceGetCookieString(virStorageSource *src);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user