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

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