mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
qemu: block: Use qemuBlockStorageSourceNeedsStorageSliceLayer only for setup
Add a note stating that qemuBlockStorageSourceNeedsStorageSliceLayer must be used only when setting up a new blockdev, any other case when the device might been already set up must use the existence of the nodename to do so. Adjust qemuBlockStorageSourceAttachPrepareBlockdev to do so and refactor qemuBlockStorageSourceDetachPrepare to use the same logic. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
05326395a9
commit
aaf828d3d4
@ -1535,11 +1535,9 @@ qemuBlockStorageSourceAttachPrepareBlockdev(virStorageSource *src,
|
||||
data->storageNodeName = qemuBlockStorageSourceGetStorageNodename(src);
|
||||
data->formatNodeName = qemuBlockStorageSourceGetFormatNodename(src);
|
||||
|
||||
if (qemuBlockStorageSourceNeedsStorageSliceLayer(src)) {
|
||||
if ((data->storageSliceNodeName = qemuBlockStorageSourceGetSliceNodename(src))) {
|
||||
if (!(data->storageSliceProps = qemuBlockStorageSourceGetBlockdevStorageSliceProps(src)))
|
||||
return NULL;
|
||||
|
||||
data->storageSliceNodeName = src->sliceStorage->nodename;
|
||||
}
|
||||
|
||||
return g_steal_pointer(&data);
|
||||
@ -1756,13 +1754,8 @@ qemuBlockStorageSourceDetachPrepare(virStorageSource *src)
|
||||
data->storageNodeName = qemuBlockStorageSourceGetStorageNodename(src);
|
||||
data->storageAttached = true;
|
||||
|
||||
/* 'raw' format doesn't need the extra 'raw' layer when slicing, thus
|
||||
* the nodename is NULL */
|
||||
if (src->sliceStorage &&
|
||||
src->sliceStorage->nodename) {
|
||||
data->storageSliceNodeName = src->sliceStorage->nodename;
|
||||
if ((data->storageSliceNodeName = qemuBlockStorageSourceGetSliceNodename(src)))
|
||||
data->storageSliceAttached = true;
|
||||
}
|
||||
|
||||
if (src->pr &&
|
||||
!virStoragePRDefIsManaged(src->pr))
|
||||
@ -3274,6 +3267,12 @@ qemuBlockReopenReadOnly(virDomainObj *vm,
|
||||
*
|
||||
* Returns true if @src requires an extra 'raw' layer for handling of the storage
|
||||
* slice.
|
||||
*
|
||||
* Important: This helper must be used only for decisions when setting up a
|
||||
* '-blockdev' backend in which case the storage slice layer node name will be
|
||||
* populated.
|
||||
* Any cases when the backend can be already in use must decide based on the
|
||||
* existence of the storage slice layer nodename.
|
||||
*/
|
||||
bool
|
||||
qemuBlockStorageSourceNeedsStorageSliceLayer(const virStorageSource *src)
|
||||
|
Loading…
Reference in New Issue
Block a user