|
|
d76c62 |
From d4877aae453a0ed1104dfd8aa12806a110f08b07 Mon Sep 17 00:00:00 2001
|
|
|
d76c62 |
Message-Id: <d4877aae453a0ed1104dfd8aa12806a110f08b07@dist-git>
|
|
|
d76c62 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
d76c62 |
Date: Tue, 24 Mar 2020 16:26:05 +0100
|
|
|
d76c62 |
Subject: [PATCH] qemuBlockGetBackingStoreString: Add extra wrapping object to
|
|
|
d76c62 |
JSON strings
|
|
|
d76c62 |
MIME-Version: 1.0
|
|
|
d76c62 |
Content-Type: text/plain; charset=UTF-8
|
|
|
d76c62 |
Content-Transfer-Encoding: 8bit
|
|
|
d76c62 |
|
|
|
d76c62 |
QEMU requires an extra wrapper object where only the "file" member is
|
|
|
d76c62 |
populated. This is basically a placeholder for establishing the format
|
|
|
d76c62 |
layer. We did the same in qemuDiskSourceGetProps for the old-school
|
|
|
d76c62 |
JSON usage with -drive but forgot to adopt this for -blockdev.
|
|
|
d76c62 |
|
|
|
d76c62 |
https://bugzilla.redhat.com/show_bug.cgi?id=1804617
|
|
|
d76c62 |
|
|
|
d76c62 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
d76c62 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
d76c62 |
(cherry picked from commit 7ba2208addf1cad4d6c06d3c172cca93f84ead11)
|
|
|
d76c62 |
Message-Id: <9a56b9f7e03d41bf99399b14f399bc9007ed1a4e.1585063415.git.pkrempa@redhat.com>
|
|
|
d76c62 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
d76c62 |
---
|
|
|
d76c62 |
src/qemu/qemu_block.c | 2 +-
|
|
|
d76c62 |
.../imagecreate/qcow2-backing-qcow2-slice.json | 2 +-
|
|
|
d76c62 |
.../qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json | 2 +-
|
|
|
d76c62 |
.../network-qcow2-backing-chain-cache-unsafe-srconly.json | 3 ++-
|
|
|
d76c62 |
.../network-qcow2-backing-chain-encryption_auth-srconly.json | 3 ++-
|
|
|
d76c62 |
tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json | 3 ++-
|
|
|
d76c62 |
6 files changed, 9 insertions(+), 6 deletions(-)
|
|
|
d76c62 |
|
|
|
d76c62 |
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
|
|
|
d76c62 |
index 5a7364576a..73a424f7a8 100644
|
|
|
d76c62 |
--- a/src/qemu/qemu_block.c
|
|
|
d76c62 |
+++ b/src/qemu/qemu_block.c
|
|
|
d76c62 |
@@ -2091,7 +2091,7 @@ qemuBlockGetBackingStoreString(virStorageSourcePtr src,
|
|
|
d76c62 |
if (!(backingJSON = virJSONValueToString(props, pretty)))
|
|
|
d76c62 |
return NULL;
|
|
|
d76c62 |
|
|
|
d76c62 |
- return g_strdup_printf("json:%s", backingJSON);
|
|
|
d76c62 |
+ return g_strdup_printf("json:{\"file\":%s}", backingJSON);
|
|
|
d76c62 |
}
|
|
|
d76c62 |
|
|
|
d76c62 |
|
|
|
d76c62 |
diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json
|
|
|
d76c62 |
index 2fa27c1933..2526740b9a 100644
|
|
|
d76c62 |
--- a/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json
|
|
|
d76c62 |
+++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-qcow2-slice.json
|
|
|
d76c62 |
@@ -10,6 +10,6 @@ format:
|
|
|
d76c62 |
"driver": "qcow2",
|
|
|
d76c62 |
"file": "0123456789ABCDEF0123456789ABCDE",
|
|
|
d76c62 |
"size": 8589934590,
|
|
|
d76c62 |
- "backing-file": "json:{\"driver\":\"raw\",\"offset\":1234,\"size\":5768,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/images/i.qcow2\"}}",
|
|
|
d76c62 |
+ "backing-file": "json:{\"file\":{\"driver\":\"raw\",\"offset\":1234,\"size\":5768,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/images/i.qcow2\"}}}",
|
|
|
d76c62 |
"backing-fmt": "qcow2"
|
|
|
d76c62 |
}
|
|
|
d76c62 |
diff --git a/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json
|
|
|
d76c62 |
index 761002afd9..e76221da16 100644
|
|
|
d76c62 |
--- a/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json
|
|
|
d76c62 |
+++ b/tests/qemublocktestdata/imagecreate/qcow2-backing-raw-slice.json
|
|
|
d76c62 |
@@ -10,6 +10,6 @@ format:
|
|
|
d76c62 |
"driver": "qcow2",
|
|
|
d76c62 |
"file": "0123456789ABCDEF0123456789ABCDE",
|
|
|
d76c62 |
"size": 8589934590,
|
|
|
d76c62 |
- "backing-file": "json:{\"driver\":\"raw\",\"offset\":9876,\"size\":54321,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/images/i.img\"}}",
|
|
|
d76c62 |
+ "backing-file": "json:{\"file\":{\"driver\":\"raw\",\"offset\":9876,\"size\":54321,\"file\":{\"driver\":\"file\",\"filename\":\"/var/lib/libvirt/images/i.img\"}}}",
|
|
|
d76c62 |
"backing-fmt": "raw"
|
|
|
d76c62 |
}
|
|
|
d76c62 |
diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe-srconly.json b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe-srconly.json
|
|
|
d76c62 |
index 2d7eeb3bca..0fb0b8eff9 100644
|
|
|
d76c62 |
--- a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe-srconly.json
|
|
|
d76c62 |
+++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-cache-unsafe-srconly.json
|
|
|
d76c62 |
@@ -16,7 +16,7 @@
|
|
|
d76c62 |
]
|
|
|
d76c62 |
}
|
|
|
d76c62 |
backing store string:
|
|
|
d76c62 |
- json:{
|
|
|
d76c62 |
+ json:{"file":{
|
|
|
d76c62 |
"driver": "rbd",
|
|
|
d76c62 |
"pool": "rbdpool",
|
|
|
d76c62 |
"image": "rbdimg",
|
|
|
d76c62 |
@@ -31,6 +31,7 @@
|
|
|
d76c62 |
}
|
|
|
d76c62 |
]
|
|
|
d76c62 |
}
|
|
|
d76c62 |
+ }
|
|
|
d76c62 |
)
|
|
|
d76c62 |
(
|
|
|
d76c62 |
source only properties:
|
|
|
d76c62 |
diff --git a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encryption_auth-srconly.json b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encryption_auth-srconly.json
|
|
|
d76c62 |
index 5679318fbe..777a372471 100644
|
|
|
d76c62 |
--- a/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encryption_auth-srconly.json
|
|
|
d76c62 |
+++ b/tests/qemublocktestdata/xml2json/network-qcow2-backing-chain-encryption_auth-srconly.json
|
|
|
d76c62 |
@@ -16,7 +16,7 @@
|
|
|
d76c62 |
]
|
|
|
d76c62 |
}
|
|
|
d76c62 |
backing store string:
|
|
|
d76c62 |
- json:{
|
|
|
d76c62 |
+ json:{"file":{
|
|
|
d76c62 |
"driver": "rbd",
|
|
|
d76c62 |
"pool": "rbdpool",
|
|
|
d76c62 |
"image": "rbdimg",
|
|
|
d76c62 |
@@ -31,6 +31,7 @@
|
|
|
d76c62 |
}
|
|
|
d76c62 |
]
|
|
|
d76c62 |
}
|
|
|
d76c62 |
+ }
|
|
|
d76c62 |
)
|
|
|
d76c62 |
(
|
|
|
d76c62 |
source only properties:
|
|
|
d76c62 |
diff --git a/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json b/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json
|
|
|
d76c62 |
index 970e1bb8af..26f9557c80 100644
|
|
|
d76c62 |
--- a/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json
|
|
|
d76c62 |
+++ b/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json
|
|
|
d76c62 |
@@ -6,9 +6,10 @@
|
|
|
d76c62 |
"namespace": 1
|
|
|
d76c62 |
}
|
|
|
d76c62 |
backing store string:
|
|
|
d76c62 |
- json:{
|
|
|
d76c62 |
+ json:{"file":{
|
|
|
d76c62 |
"driver": "nvme",
|
|
|
d76c62 |
"device": "0000:01:00.0",
|
|
|
d76c62 |
"namespace": 1
|
|
|
d76c62 |
}
|
|
|
d76c62 |
+ }
|
|
|
d76c62 |
)
|
|
|
d76c62 |
--
|
|
|
d76c62 |
2.26.0
|
|
|
d76c62 |
|