Blame SOURCES/libvirt-qemuBlockStorageSourceGetFormatRawProps-format-offset-and-size-for-slice.patch

a41c76
From 23fcd1d6a87e0fcbffc8d4ddfa9cf2b7a226cdd5 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <23fcd1d6a87e0fcbffc8d4ddfa9cf2b7a226cdd5@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Wed, 19 Feb 2020 15:10:16 +0100
a41c76
Subject: [PATCH] qemuBlockStorageSourceGetFormatRawProps: format 'offset' and
a41c76
 'size' for slice
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
If we have a 'format' type slice for a raw driver we can directly format
a41c76
the values.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit c4818812831967b8f882b2c33780aab129e245a2)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1791788
a41c76
Message-Id: <beee894a1f4af469391cee6a42a3e95e8946df98.1582120424.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/qemu/qemu_block.c | 15 ++++++++++-----
a41c76
 1 file changed, 10 insertions(+), 5 deletions(-)
a41c76
a41c76
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
a41c76
index 710ddfd2cf..b408d4c81f 100644
a41c76
--- a/src/qemu/qemu_block.c
a41c76
+++ b/src/qemu/qemu_block.c
a41c76
@@ -1194,16 +1194,21 @@ qemuBlockStorageSourceGetFormatRawProps(virStorageSourcePtr src,
a41c76
         secretalias = srcPriv->encinfo->s.aes.alias;
a41c76
     }
a41c76
 
a41c76
-    /* currently unhandled properties for the 'raw' driver:
a41c76
-     * 'offset'
a41c76
-     * 'size'
a41c76
-     */
a41c76
-
a41c76
     if (virJSONValueObjectAdd(props,
a41c76
                               "s:driver", driver,
a41c76
                               "S:key-secret", secretalias, NULL) < 0)
a41c76
         return -1;
a41c76
 
a41c76
+    /* Currently only storage slices are supported. We'll have to calculate
a41c76
+     * the union of the slices here if we don't want to be adding needless
a41c76
+     * 'raw' nodes. */
a41c76
+    if (src->sliceStorage &&
a41c76
+        virJSONValueObjectAdd(props,
a41c76
+                              "U:offset", src->sliceStorage->offset,
a41c76
+                              "U:size", src->sliceStorage->size,
a41c76
+                              NULL) < 0)
a41c76
+        return -1;
a41c76
+
a41c76
     return 0;
a41c76
 }
a41c76
 
a41c76
-- 
a41c76
2.25.0
a41c76