Setup the data for detaching of the 'format' layer only when it's
present.
Restructure the logic to follow the same order as
qemuBlockStorageSourceAttachPrepareBlockdev in terms of
format/slice/storage -blockdev objects, and drop the now-misleading
comment for 'slice' of raw disks.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_block.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 749cd9fdac..7137604e36 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1771,14 +1771,15 @@ qemuBlockStorageSourceDetachPrepare(virStorageSource *src)
data = g_new0(qemuBlockStorageSourceAttachData, 1);
- data->formatNodeName = qemuBlockStorageSourceGetFormatNodename(src);
- data->formatAttached = true;
- data->storageNodeName = qemuBlockStorageSourceGetStorageNodename(src);
- data->storageAttached = true;
+ if ((data->formatNodeName = qemuBlockStorageSourceGetFormatNodename(src)))
+ data->formatAttached = true;
if ((data->storageSliceNodeName = qemuBlockStorageSourceGetSliceNodename(src)))
data->storageSliceAttached = true;
+ data->storageNodeName = qemuBlockStorageSourceGetStorageNodename(src);
+ data->storageAttached = true;
+
if (src->pr &&
!virStoragePRDefIsManaged(src->pr))
data->prmgrAlias = g_strdup(src->pr->mgralias);
--
2.42.0