[libvirt] [RFC PATCH 25/30] tests: qemublock: Add test cases for 'aio' options of 'file' storage

Peter Krempa pkrempa at redhat.com
Thu Apr 19 15:25:22 UTC 2018


Test that the 'aio' option is applied correctly for the 'file' protocol
backend and across the backing chain.

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

file-backing_basic-aio_threads:
-drive file=/var/lib/libvirt/images/a,format=qcow,if=none,id=drive-dummy,aio=threads
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy

file-raw-aio_native:
-drive file=/path/to/i.img,format=raw,if=none,id=drive-dummy,cache=none,aio=native
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy,write-cache=on

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tests/qemublocktest.c                              |  2 +
 .../xml2json/file-backing_basic-aio_threads.json   | 62 ++++++++++++++++++++++
 .../xml2json/file-backing_basic-aio_threads.xml    | 35 ++++++++++++
 .../xml2json/file-raw-aio_native.json              | 21 ++++++++
 .../xml2json/file-raw-aio_native.xml               |  9 ++++
 5 files changed, 129 insertions(+)
 create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.json
 create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.xml
 create mode 100644 tests/qemublocktestdata/xml2json/file-raw-aio_native.json
 create mode 100644 tests/qemublocktestdata/xml2json/file-raw-aio_native.xml

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 81a2261dab..a79ffa90d8 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -416,6 +416,8 @@ mymain(void)
     TEST_DISK_TO_JSON("file-backing_basic-noopts");
     TEST_DISK_TO_JSON("dir-fat-readonly");
     TEST_DISK_TO_JSON("dir-fat-floppy");
+    TEST_DISK_TO_JSON("file-raw-aio_native");
+    TEST_DISK_TO_JSON("file-backing_basic-aio_threads");

  cleanup:
     virHashFree(diskxmljsondata.schema);
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.json b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.json
new file mode 100644
index 0000000000..dcaf905085
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.json
@@ -0,0 +1,62 @@
+{
+  "node-name": "node-a-f",
+  "read-only": false,
+  "driver": "qcow",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/a",
+    "aio": "threads",
+    "node-name": "node-a-s",
+    "read-only": false,
+    "discard": "unmap"
+  },
+  "backing": "node-b-f"
+}
+{
+  "node-name": "node-b-f",
+  "read-only": true,
+  "driver": "qed",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/b",
+    "aio": "threads",
+    "node-name": "node-b-s",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "node-c-f"
+}
+{
+  "node-name": "node-c-f",
+  "read-only": true,
+  "driver": "vmdk",
+  "file": {
+    "driver": "gluster",
+    "volume": "images",
+    "path": "c",
+    "server": [
+      {
+        "type": "inet",
+        "host": "test.org",
+        "port": "24007"
+      }
+    ],
+    "node-name": "node-c-s",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "node-d-f"
+}
+{
+  "node-name": "node-d-f",
+  "read-only": true,
+  "driver": "raw",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/d",
+    "aio": "threads",
+    "node-name": "node-d-s",
+    "read-only": true,
+    "discard": "unmap"
+  }
+}
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.xml
new file mode 100644
index 0000000000..0bd1388f0f
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-aio_threads.xml
@@ -0,0 +1,35 @@
+<disk type='file' device='disk'>
+  <driver name='qemu' type='qcow' io='threads'/>
+  <source file='/var/lib/libvirt/images/a'>
+    <privateData>
+      <nodename storage='node-a-s' format='node-a-f'/>
+    </privateData>
+  </source>
+  <backingStore type='file' index='1'>
+    <format type='qed'/>
+    <source file='/var/lib/libvirt/images/b'>
+      <privateData>
+        <nodename storage='node-b-s' format='node-b-f'/>
+      </privateData>
+    </source>
+    <backingStore type='network' index='2'>
+      <format type='vmdk'/>
+      <source protocol='gluster' name='images/c'>
+        <host name='test.org'/>
+        <privateData>
+          <nodename storage='node-c-s' format='node-c-f'/>
+        </privateData>
+      </source>
+      <backingStore type='file' index='3'>
+        <format type='raw'/>
+        <source file='/var/lib/libvirt/images/d'>
+          <privateData>
+            <nodename storage='node-d-s' format='node-d-f'/>
+          </privateData>
+        </source>
+        <backingStore/>
+      </backingStore>
+    </backingStore>
+  </backingStore>
+  <target dev='vda'/>
+</disk>
diff --git a/tests/qemublocktestdata/xml2json/file-raw-aio_native.json b/tests/qemublocktestdata/xml2json/file-raw-aio_native.json
new file mode 100644
index 0000000000..2752e0b204
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-raw-aio_native.json
@@ -0,0 +1,21 @@
+{
+  "node-name": "test1",
+  "read-only": false,
+  "cache": {
+    "direct": true,
+    "no-flush": false
+  },
+  "driver": "raw",
+  "file": {
+    "driver": "file",
+    "filename": "/path/to/i.img",
+    "aio": "native",
+    "node-name": "test2",
+    "cache": {
+      "direct": true,
+      "no-flush": false
+    },
+    "read-only": false,
+    "discard": "unmap"
+  }
+}
diff --git a/tests/qemublocktestdata/xml2json/file-raw-aio_native.xml b/tests/qemublocktestdata/xml2json/file-raw-aio_native.xml
new file mode 100644
index 0000000000..d1b98ff992
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-raw-aio_native.xml
@@ -0,0 +1,9 @@
+<disk device='disk'>
+  <driver name='qemu' type='raw' io='native' cache='none'/>
+  <source file='/path/to/i.img'>
+    <privateData>
+      <nodename format='test1' storage='test2'/>
+    </privateData>
+  </source>
+  <target dev='vda'/>
+</disk>
-- 
2.14.3




More information about the libvir-list mailing list