[libvirt] [PATCH 28/35] tests: qemublock: Add test-case for the 'vvfat' driver in qemu

Peter Krempa posted 35 patches 7 years ago
[libvirt] [PATCH 28/35] tests: qemublock: Add test-case for the 'vvfat' driver in qemu
Posted by Peter Krempa 7 years ago
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

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 tests/qemublocktest.c                                  |  2 ++
 tests/qemublocktestdata/xml2json/dir-fat-floppy.json   | 14 ++++++++++++++
 tests/qemublocktestdata/xml2json/dir-fat-floppy.xml    | 14 ++++++++++++++
 tests/qemublocktestdata/xml2json/dir-fat-readonly.json | 14 ++++++++++++++
 tests/qemublocktestdata/xml2json/dir-fat-readonly.xml  | 13 +++++++++++++
 5 files changed, 57 insertions(+)
 create mode 100644 tests/qemublocktestdata/xml2json/dir-fat-floppy.json
 create mode 100644 tests/qemublocktestdata/xml2json/dir-fat-floppy.xml
 create mode 100644 tests/qemublocktestdata/xml2json/dir-fat-readonly.json
 create mode 100644 tests/qemublocktestdata/xml2json/dir-fat-readonly.xml

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 881d7c17ee..81a2261dab 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -414,6 +414,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
index 0000000000..9685acaa8b
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/dir-fat-floppy.json
@@ -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
index 0000000000..8f085a1832
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/dir-fat-floppy.xml
@@ -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
index 0000000000..7d35d255cc
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/dir-fat-readonly.json
@@ -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
index 0000000000..9ac24b5d41
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/dir-fat-readonly.xml
@@ -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>
-- 
2.16.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 28/35] tests: qemublock: Add test-case for the 'vvfat' driver in qemu
Posted by John Ferlan 7 years ago

On 04/25/2018 11:15 AM, Peter Krempa wrote:
> 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
> 

May as well show dir-fat-floppy.xml too

> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  tests/qemublocktest.c                                  |  2 ++
>  tests/qemublocktestdata/xml2json/dir-fat-floppy.json   | 14 ++++++++++++++
>  tests/qemublocktestdata/xml2json/dir-fat-floppy.xml    | 14 ++++++++++++++
>  tests/qemublocktestdata/xml2json/dir-fat-readonly.json | 14 ++++++++++++++
>  tests/qemublocktestdata/xml2json/dir-fat-readonly.xml  | 13 +++++++++++++
>  5 files changed, 57 insertions(+)
>  create mode 100644 tests/qemublocktestdata/xml2json/dir-fat-floppy.json
>  create mode 100644 tests/qemublocktestdata/xml2json/dir-fat-floppy.xml
>  create mode 100644 tests/qemublocktestdata/xml2json/dir-fat-readonly.json
>  create mode 100644 tests/qemublocktestdata/xml2json/dir-fat-readonly.xml
> 

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list