]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: qemublock: Add test-case for the 'vvfat' driver in qemu
authorPeter Krempa <pkrempa@redhat.com>
Mon, 19 Mar 2018 07:00:19 +0000 (08:00 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 7 May 2018 13:55:16 +0000 (15:55 +0200)
Test mapping of the 'FAT' disk format to 'vvfat' in qemu.

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

dir-fat-readonly.xml:
-drive file=fat:/var/somefiles,if=none,id=drive-dummy,readonly=on
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy

dir-fat-floppy.xml
-drive file=fat:floppy:/var/somefiles,if=none,id=drive-dummy,readonly=on

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

index a112627853087989eb6e6c63161c3ba5487eb661..ec42d1d6a4f7fa13536350ea7a53b72b70fb63ad 100644 (file)
@@ -415,6 +415,8 @@ mymain(void)
     TEST_DISK_TO_JSON("file-vpc-noopts");
 
     TEST_DISK_TO_JSON("file-backing_basic-noopts");
+    TEST_DISK_TO_JSON("dir-fat-readonly");
+    TEST_DISK_TO_JSON("dir-fat-floppy");
 
  cleanup:
     virHashFree(diskxmljsondata.schema);
diff --git a/tests/qemublocktestdata/xml2json/dir-fat-floppy.json b/tests/qemublocktestdata/xml2json/dir-fat-floppy.json
new file mode 100644 (file)
index 0000000..9685aca
--- /dev/null
@@ -0,0 +1,14 @@
+{
+  "node-name": "node-f",
+  "read-only": true,
+  "driver": "raw",
+  "file": {
+    "driver": "vvfat",
+    "dir": "/var/somefiles",
+    "floppy": true,
+    "rw": false,
+    "node-name": "node-s",
+    "read-only": true,
+    "discard": "unmap"
+  }
+}
diff --git a/tests/qemublocktestdata/xml2json/dir-fat-floppy.xml b/tests/qemublocktestdata/xml2json/dir-fat-floppy.xml
new file mode 100644 (file)
index 0000000..8f085a1
--- /dev/null
@@ -0,0 +1,14 @@
+<disk type='dir' device='floppy'>
+  <driver name='qemu' type='fat'/>
+  <source dir='/var/somefiles'>
+    <privateData>
+      <nodenames>
+        <nodename type='storage' name='node-s'/>
+        <nodename type='format' name='node-f'/>
+      </nodenames>
+    </privateData>
+  </source>
+  <target dev='fda'/>
+  <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+  <readonly/>
+</disk>
diff --git a/tests/qemublocktestdata/xml2json/dir-fat-readonly.json b/tests/qemublocktestdata/xml2json/dir-fat-readonly.json
new file mode 100644 (file)
index 0000000..7d35d25
--- /dev/null
@@ -0,0 +1,14 @@
+{
+  "node-name": "node-f",
+  "read-only": true,
+  "driver": "raw",
+  "file": {
+    "driver": "vvfat",
+    "dir": "/var/somefiles",
+    "floppy": false,
+    "rw": false,
+    "node-name": "node-s",
+    "read-only": true,
+    "discard": "unmap"
+  }
+}
diff --git a/tests/qemublocktestdata/xml2json/dir-fat-readonly.xml b/tests/qemublocktestdata/xml2json/dir-fat-readonly.xml
new file mode 100644 (file)
index 0000000..9ac24b5
--- /dev/null
@@ -0,0 +1,13 @@
+<disk type='dir' device='disk'>
+  <driver name='qemu' type='fat'/>
+  <source dir='/var/somefiles'>
+    <privateData>
+      <nodenames>
+        <nodename type='storage' name='node-s'/>
+        <nodename type='format' name='node-f'/>
+      </nodenames>
+    </privateData>
+  </source>
+  <target dev='vda'/>
+  <readonly/>
+</disk>