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

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