]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: qemublock: Add basic 'raw' file test
authorPeter Krempa <pkrempa@redhat.com>
Wed, 28 Mar 2018 07:40:03 +0000 (09:40 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 7 May 2018 13:51:45 +0000 (15:51 +0200)
Test the JSON props generator with a very simple 'raw' image with no
other options. The node-names for the image are 31 bytes long so that we
validate our node name detector.

The top level disk image would generate the following '-drive' cmdline:

-drive file=/var/lib/libvirt/images/i.img,format=raw,if=none,id=drive-dummy
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
tests/qemublocktest.c
tests/qemublocktestdata/xml2json/file-raw-noopts.json [new file with mode: 0644]
tests/qemublocktestdata/xml2json/file-raw-noopts.xml [new file with mode: 0644]

index efad256df7f3bae3272ede53253c857907c0b051..874ee0085565873d837b0a803990e8333cd5682e 100644 (file)
@@ -405,6 +405,8 @@ mymain(void)
     TEST_DISK_TO_JSON_FULL("nodename-long-format", true);
     TEST_DISK_TO_JSON_FULL("nodename-long-protocol", true);
 
+    TEST_DISK_TO_JSON("file-raw-noopts");
+
  cleanup:
     virHashFree(diskxmljsondata.schema);
     qemuTestDriverFree(&driver);
diff --git a/tests/qemublocktestdata/xml2json/file-raw-noopts.json b/tests/qemublocktestdata/xml2json/file-raw-noopts.json
new file mode 100644 (file)
index 0000000..25de571
--- /dev/null
@@ -0,0 +1,12 @@
+{
+  "node-name": "0123456789ABCDEF0123456789ABCDE",
+  "read-only": false,
+  "driver": "raw",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/i.img",
+    "node-name": "0123456789ABCDEF0123456789ABCDE",
+    "read-only": false,
+    "discard": "unmap"
+  }
+}
diff --git a/tests/qemublocktestdata/xml2json/file-raw-noopts.xml b/tests/qemublocktestdata/xml2json/file-raw-noopts.xml
new file mode 100644 (file)
index 0000000..8255e64
--- /dev/null
@@ -0,0 +1,12 @@
+<disk device='disk'>
+  <driver name='qemu' type='raw'/>
+  <source file='/var/lib/libvirt/images/i.img'>
+    <privateData>
+      <nodenames>
+        <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/>
+        <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/>
+      </nodenames>
+    </privateData>
+  </source>
+  <target dev='vda'/>
+</disk>