Sheepdog and possibly others use nested objects for network server and
thus could be specified in a way that libvirt would not parse.
Validates that
https://bugzilla.redhat.com/show_bug.cgi?id=1464821
is fixed properly.
---
tests/virjsondata/deflatten-qemu-sheepdog-in.json | 11 +++++++++++
tests/virjsondata/deflatten-qemu-sheepdog-out.json | 13 +++++++++++++
tests/virjsontest.c | 1 +
tests/virstoragetest.c | 10 ++++++++++
4 files changed, 35 insertions(+)
create mode 100644 tests/virjsondata/deflatten-qemu-sheepdog-in.json
create mode 100644 tests/virjsondata/deflatten-qemu-sheepdog-out.json
diff --git a/tests/virjsondata/deflatten-qemu-sheepdog-in.json
b/tests/virjsondata/deflatten-qemu-sheepdog-in.json
new file mode 100644
index 000000000..7c0286300
--- /dev/null
+++ b/tests/virjsondata/deflatten-qemu-sheepdog-in.json
@@ -0,0 +1,11 @@
+{
+ "driver": "raw",
+ "file": {
+ "server.host": "10.10.10.10",
+ "server.port": "7000",
+ "tag": "",
+ "driver": "sheepdog",
+ "server.type": "inet",
+ "vdi": "Alice"
+ }
+}
diff --git a/tests/virjsondata/deflatten-qemu-sheepdog-out.json
b/tests/virjsondata/deflatten-qemu-sheepdog-out.json
new file mode 100644
index 000000000..258b44a76
--- /dev/null
+++ b/tests/virjsondata/deflatten-qemu-sheepdog-out.json
@@ -0,0 +1,13 @@
+{
+ "driver": "raw",
+ "file": {
+ "server": {
+ "host": "10.10.10.10",
+ "port": "7000",
+ "type": "inet"
+ },
+ "tag": "",
+ "driver": "sheepdog",
+ "vdi": "Alice"
+ }
+}
diff --git a/tests/virjsontest.c b/tests/virjsontest.c
index b3ce6591a..5f89a3e1c 100644
--- a/tests/virjsontest.c
+++ b/tests/virjsontest.c
@@ -521,6 +521,7 @@ mymain(void)
DO_TEST_DEFLATTEN("double-key", false);
DO_TEST_DEFLATTEN("concat", true);
DO_TEST_DEFLATTEN("concat-double-key", false);
+ DO_TEST_DEFLATTEN("qemu-sheepdog", true);
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index f34408395..90fcf36ca 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -1575,6 +1575,16 @@ mymain(void)
"<source protocol='sheepdog'
name='test'>\n"
" <host name='example.com'
port='321'/>\n"
"</source>\n");
+ TEST_BACKING_PARSE("json:{\"driver\": \"raw\","
+ "\"file\": {\"server.host\":
\"10.10.10.10\","
+ "\"server.port\":
\"7000\","
+ "\"tag\": \"\","
+ "\"driver\":
\"sheepdog\","
+ "\"server.type\":
\"inet\","
+ "\"vdi\":
\"Alice\"}}",
+ "<source protocol='sheepdog'
name='Alice'>\n"
+ " <host name='10.10.10.10'
port='7000'/>\n"
+ "</source>\n");
#endif /* WITH_YAJL */
cleanup:
--
2.12.2