[RFC PATCH 4/5] qemu: block: Always add extra 'raw' layer for storage slice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove the simplification logic for the storage slice layer, as in
upcoming patches we'll be getting rid of the raw 'format' layer.

Doing this here will make it more clear what configuration is being
changed.

Since adding an extra layer creates just overhead and it will be removed
within the same release we can do it in steps.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_block.c                         | 36 ++-----------------
 .../disk-slices.x86_64-latest.args            |  6 ++--
 2 files changed, 6 insertions(+), 36 deletions(-)

diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 7e9daf0bdc..738a8fedd3 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1203,27 +1203,6 @@ qemuBlockStorageSourceGetFormatLUKSProps(virStorageSource *src,
 }


-static int
-qemuBlockStorageSourceGetFormatRawProps(virStorageSource *src,
-                                        virJSONValue *props)
-{
-    if (virJSONValueObjectAdd(&props, "s:driver", "raw", NULL) < 0)
-        return -1;
-
-    /* Currently only storage slices are supported. We'll have to calculate
-     * the union of the slices here if we don't want to be adding needless
-     * 'raw' nodes. */
-    if (src->sliceStorage &&
-        virJSONValueObjectAdd(&props,
-                              "U:offset", src->sliceStorage->offset,
-                              "U:size", src->sliceStorage->size,
-                              NULL) < 0)
-        return -1;
-
-    return 0;
-}
-
-
 static int
 qemuBlockStorageSourceGetCryptoProps(virStorageSource *src,
                                      virJSONValue **encprops)
@@ -1343,8 +1322,7 @@ qemuBlockStorageSourceGetBlockdevFormatProps(virStorageSource *src)
             if (qemuBlockStorageSourceGetFormatLUKSProps(src, props) < 0)
                 return NULL;
         } else {
-            if (qemuBlockStorageSourceGetFormatRawProps(src, props) < 0)
-                return NULL;
+            driver = "raw";
         }
         break;

@@ -3253,17 +3231,7 @@ qemuBlockReopenReadOnly(virDomainObj *vm,
 bool
 qemuBlockStorageSourceNeedsStorageSliceLayer(const virStorageSource *src)
 {
-    if (!src->sliceStorage)
-        return false;
-
-    if (src->format != VIR_STORAGE_FILE_RAW)
-        return true;
-
-    if (src->encryption &&
-        src->encryption->format == VIR_STORAGE_ENCRYPTION_FORMAT_LUKS)
-        return true;
-
-    return false;
+    return !!src->sliceStorage;
 }


diff --git a/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args b/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
index 363f0c0361..b2c49a2df4 100644
--- a/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-slices.x86_64-latest.args
@@ -28,7 +28,8 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
 -boot strict=on \
 -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0x2"}' \
 -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/raw.img","node-name":"libvirt-6-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-6-format","read-only":false,"driver":"raw","offset":0,"size":321,"file":"libvirt-6-storage"}' \
+-blockdev '{"driver":"raw","offset":0,"size":321,"file":"libvirt-6-storage","node-name":"libvirt-6-slice-sto","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-6-format","read-only":false,"driver":"raw","file":"libvirt-6-slice-sto"}' \
 -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x2","drive":"libvirt-6-format","id":"virtio-disk0","bootindex":1}' \
 -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/raw.img","node-name":"libvirt-5-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"driver":"raw","offset":9876,"size":123456789,"file":"libvirt-5-storage","node-name":"libvirt-5-slice-sto","auto-read-only":true,"discard":"unmap"}' \
@@ -42,7 +43,8 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
 -blockdev '{"node-name":"libvirt-3-format","read-only":false,"driver":"luks","key-secret":"libvirt-3-format-encryption-secret0","file":"libvirt-3-slice-sto"}' \
 -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x4","drive":"libvirt-3-format","id":"virtio-disk2"}' \
 -blockdev '{"driver":"nvme","device":"0000:02:00.0","namespace":1,"node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"raw","offset":1234,"size":321,"file":"libvirt-2-storage"}' \
+-blockdev '{"driver":"raw","offset":1234,"size":321,"file":"libvirt-2-storage","node-name":"libvirt-2-slice-sto","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"raw","file":"libvirt-2-slice-sto"}' \
 -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x6","drive":"libvirt-2-format","id":"virtio-disk3"}' \
 -object '{"qom-type":"secret","id":"libvirt-1-format-encryption-secret0","data":"9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1","keyid":"masterKey0","iv":"AAECAwQFBgcICQoLDA0ODw==","format":"base64"}' \
 -blockdev '{"driver":"nvme","device":"0001:02:00.0","namespace":2,"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \
-- 
2.43.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux