]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: block: Use qemuBlockStorageSourceAddBlockdevCommonProps for storage slice
authorPeter Krempa <pkrempa@redhat.com>
Tue, 24 Oct 2023 10:38:57 +0000 (12:38 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 2 Nov 2023 14:31:40 +0000 (15:31 +0100)
Use the new helper in qemuBlockStorageSourceGetBlockdevStorageSliceProps
to format the common bits.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_block.c
tests/qemuxml2argvdata/disk-slices.x86_64-latest.args

index 3de73be656b4c33f78fbbfc016449fb6c478708f..54aa847dff61105111ca97337e88a96960cc4e4d 100644 (file)
@@ -1485,26 +1485,21 @@ static virJSONValue *
 qemuBlockStorageSourceGetBlockdevStorageSliceProps(virStorageSource *src)
 {
     g_autoptr(virJSONValue) props = NULL;
-    g_autoptr(virJSONValue) cache = NULL;
-
-    if (qemuBlockNodeNameValidate(src->sliceStorage->nodename) < 0)
-        return NULL;
-
-    if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, &cache) < 0)
-        return NULL;
 
     if (virJSONValueObjectAdd(&props,
                               "s:driver", "raw",
-                              "s:node-name", src->sliceStorage->nodename,
                               "U:offset", src->sliceStorage->offset,
                               "U:size", src->sliceStorage->size,
                               "s:file", qemuBlockStorageSourceGetStorageNodename(src),
-                              "b:auto-read-only", true,
-                              "s:discard", "unmap",
-                              "A:cache", &cache,
                               NULL) < 0)
         return NULL;
 
+    if (qemuBlockStorageSourceAddBlockdevCommonProps(&props,
+                                                     src,
+                                                     src->sliceStorage->nodename,
+                                                     false) < 0)
+        return NULL;
+
     return g_steal_pointer(&props);
 }
 
index deaa09437918bd991535f951cfc3076c22166c5c..363f0c0361f9604669fb45a94bc99cdd9f81c800 100644 (file)
@@ -31,14 +31,14 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
 -blockdev '{"node-name":"libvirt-6-format","read-only":false,"driver":"raw","offset":0,"size":321,"file":"libvirt-6-storage"}' \
 -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","node-name":"libvirt-5-slice-sto","offset":9876,"size":123456789,"file":"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"}' \
 -blockdev '{"node-name":"libvirt-5-format","read-only":true,"driver":"qcow2","file":"libvirt-5-slice-sto","backing":null}' \
 -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/overlay.qcow2","node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-4-format","read-only":false,"driver":"qcow2","file":"libvirt-4-storage","backing":"libvirt-5-format"}' \
 -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x3","drive":"libvirt-4-format","id":"virtio-disk1"}' \
 -object '{"qom-type":"secret","id":"libvirt-3-format-encryption-secret0","data":"9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1","keyid":"masterKey0","iv":"AAECAwQFBgcICQoLDA0ODw==","format":"base64"}' \
 -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/luks.img","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \
--blockdev '{"driver":"raw","node-name":"libvirt-3-slice-sto","offset":1234,"size":321,"file":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \
+-blockdev '{"driver":"raw","offset":1234,"size":321,"file":"libvirt-3-storage","node-name":"libvirt-3-slice-sto","auto-read-only":true,"discard":"unmap"}' \
 -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"}' \
@@ -46,7 +46,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
 -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}}' \
--blockdev '{"driver":"raw","node-name":"libvirt-1-slice-sto","offset":1234,"size":321,"file":"libvirt-1-storage","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \
+-blockdev '{"driver":"raw","offset":1234,"size":321,"file":"libvirt-1-storage","node-name":"libvirt-1-slice-sto","auto-read-only":true,"discard":"unmap","cache":{"direct":true,"no-flush":false}}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"qcow2","encrypt":{"format":"luks","key-secret":"libvirt-1-format-encryption-secret0"},"file":"libvirt-1-slice-sto"}' \
 -device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x7","drive":"libvirt-1-format","id":"virtio-disk4","write-cache":"on"}' \
 -audiodev '{"id":"audio1","driver":"none"}' \