[PATCH 33/35] tests: qemublock: Test handling of 'unmap' and 'detect-zeroes' options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The test cases would correspond to the following -drive command lines:

file-backing_basic-detect.xml:
-drive file=/var/lib/libvirt/images/a,format=qcow,if=none,id=drive-dummy,detect-zeroes=on
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy

file-backing_basic-unmap-detect.xml:
-drive file=/var/lib/libvirt/images/a,format=qcow,if=none,id=drive-dummy,discard=unmap,detect-zeroes=unmap
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy

file-backing_basic-unmap-ignore.xml:
-drive file=/var/lib/libvirt/images/a,format=qcow,if=none,id=drive-dummy,discard=ignore,detect-zeroes=on
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy

file-backing_basic-unmap.xml:
-drive file=/var/lib/libvirt/images/a,format=qcow,if=none,id=drive-dummy,discard=unmap
-device virtio-blk-pci,scsi=off,drive=drive-dummy,id=dummy
---
 tests/qemublocktest.c                              |  5 ++
 .../xml2json/file-backing_basic-detect.json        | 60 ++++++++++++++++++++
 .../xml2json/file-backing_basic-detect.xml         | 47 ++++++++++++++++
 .../xml2json/file-backing_basic-unmap-detect.json  | 64 ++++++++++++++++++++++
 .../xml2json/file-backing_basic-unmap-detect.xml   | 47 ++++++++++++++++
 .../xml2json/file-backing_basic-unmap-discard.json |  0
 .../xml2json/file-backing_basic-unmap-ignore.json  | 64 ++++++++++++++++++++++
 .../xml2json/file-backing_basic-unmap-ignore.xml   | 47 ++++++++++++++++
 .../xml2json/file-backing_basic-unmap.json         | 63 +++++++++++++++++++++
 .../xml2json/file-backing_basic-unmap.xml          | 47 ++++++++++++++++
 10 files changed, 444 insertions(+)
 create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-detect.json
 create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-detect.xml
 create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json
 create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.xml
 create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unmap-discard.json
 create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json
 create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.xml
 create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json
 create mode 100644 tests/qemublocktestdata/xml2json/file-backing_basic-unmap.xml

diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 34509be543..4a2051da57 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -465,6 +465,11 @@ mymain(void)
     TEST_DISK_TO_JSON("file-qcow2-backing-chain-encryption");
     TEST_DISK_TO_JSON("network-qcow2-backing-chain-encryption_auth");

+    TEST_DISK_TO_JSON("file-backing_basic-unmap");
+    TEST_DISK_TO_JSON("file-backing_basic-unmap-detect");
+    TEST_DISK_TO_JSON("file-backing_basic-unmap-ignore");
+    TEST_DISK_TO_JSON("file-backing_basic-detect");
+
  cleanup:
     virHashFree(diskxmljsondata.schema);
     qemuTestDriverFree(&driver);
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json
new file mode 100644
index 0000000000..c1e4c40757
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.json
@@ -0,0 +1,60 @@
+{
+  "node-name": "node-a-f",
+  "read-only": false,
+  "detect-zeroes": "on",
+  "driver": "qcow",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/a",
+    "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",
+    "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",
+    "node-name": "node-d-s",
+    "read-only": true,
+    "discard": "unmap"
+  }
+}
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-detect.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.xml
new file mode 100644
index 0000000000..eaf89d316a
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-detect.xml
@@ -0,0 +1,47 @@
+<disk type='file' device='disk'>
+  <driver name='qemu' type='qcow' detect_zeroes='unmap'/>
+  <source file='/var/lib/libvirt/images/a'>
+    <privateData>
+      <nodenames>
+        <nodename type='storage' name='node-a-s'/>
+        <nodename type='format' name='node-a-f'/>
+      </nodenames>
+    </privateData>
+  </source>
+  <backingStore type='file' index='1'>
+    <format type='qed'/>
+    <source file='/var/lib/libvirt/images/b'>
+      <privateData>
+        <nodenames>
+          <nodename type='storage' name='node-b-s'/>
+          <nodename type='format' name='node-b-f'/>
+        </nodenames>
+      </privateData>
+    </source>
+    <backingStore type='network' index='2'>
+      <format type='vmdk'/>
+      <source protocol='gluster' name='images/c'>
+        <host name='test.org'/>
+        <privateData>
+          <nodenames>
+            <nodename type='storage' name='node-c-s'/>
+            <nodename type='format' name='node-c-f'/>
+          </nodenames>
+        </privateData>
+      </source>
+      <backingStore type='file' index='3'>
+        <format type='raw'/>
+        <source file='/var/lib/libvirt/images/d'>
+          <privateData>
+            <nodenames>
+              <nodename type='storage' name='node-d-s'/>
+              <nodename type='format' name='node-d-f'/>
+            </nodenames>
+          </privateData>
+        </source>
+        <backingStore/>
+      </backingStore>
+    </backingStore>
+  </backingStore>
+  <target dev='vda'/>
+</disk>
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json
new file mode 100644
index 0000000000..b00008dd54
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.json
@@ -0,0 +1,64 @@
+{
+  "node-name": "node-a-f",
+  "read-only": false,
+  "discard": "unmap",
+  "detect-zeroes": "unmap",
+  "driver": "qcow",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/a",
+    "node-name": "node-a-s",
+    "read-only": false,
+    "discard": "unmap"
+  },
+  "backing": "node-b-f"
+}
+{
+  "node-name": "node-b-f",
+  "read-only": true,
+  "discard": "unmap",
+  "driver": "qed",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/b",
+    "node-name": "node-b-s",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "node-c-f"
+}
+{
+  "node-name": "node-c-f",
+  "read-only": true,
+  "discard": "unmap",
+  "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,
+  "discard": "unmap",
+  "driver": "raw",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/d",
+    "node-name": "node-d-s",
+    "read-only": true,
+    "discard": "unmap"
+  }
+}
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.xml
new file mode 100644
index 0000000000..4638a78541
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-detect.xml
@@ -0,0 +1,47 @@
+<disk type='file' device='disk'>
+  <driver name='qemu' type='qcow' discard='unmap' detect_zeroes='unmap'/>
+  <source file='/var/lib/libvirt/images/a'>
+    <privateData>
+      <nodenames>
+        <nodename type='storage' name='node-a-s'/>
+        <nodename type='format' name='node-a-f'/>
+      </nodenames>
+    </privateData>
+  </source>
+  <backingStore type='file' index='1'>
+    <format type='qed'/>
+    <source file='/var/lib/libvirt/images/b'>
+      <privateData>
+        <nodenames>
+          <nodename type='storage' name='node-b-s'/>
+          <nodename type='format' name='node-b-f'/>
+        </nodenames>
+      </privateData>
+    </source>
+    <backingStore type='network' index='2'>
+      <format type='vmdk'/>
+      <source protocol='gluster' name='images/c'>
+        <host name='test.org'/>
+        <privateData>
+          <nodenames>
+            <nodename type='storage' name='node-c-s'/>
+            <nodename type='format' name='node-c-f'/>
+          </nodenames>
+        </privateData>
+      </source>
+      <backingStore type='file' index='3'>
+        <format type='raw'/>
+        <source file='/var/lib/libvirt/images/d'>
+          <privateData>
+            <nodenames>
+              <nodename type='storage' name='node-d-s'/>
+              <nodename type='format' name='node-d-f'/>
+            </nodenames>
+          </privateData>
+        </source>
+        <backingStore/>
+      </backingStore>
+    </backingStore>
+  </backingStore>
+  <target dev='vda'/>
+</disk>
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-discard.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-discard.json
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json
new file mode 100644
index 0000000000..5419deafc0
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.json
@@ -0,0 +1,64 @@
+{
+  "node-name": "node-a-f",
+  "read-only": false,
+  "discard": "ignore",
+  "detect-zeroes": "on",
+  "driver": "qcow",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/a",
+    "node-name": "node-a-s",
+    "read-only": false,
+    "discard": "unmap"
+  },
+  "backing": "node-b-f"
+}
+{
+  "node-name": "node-b-f",
+  "read-only": true,
+  "discard": "ignore",
+  "driver": "qed",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/b",
+    "node-name": "node-b-s",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "node-c-f"
+}
+{
+  "node-name": "node-c-f",
+  "read-only": true,
+  "discard": "ignore",
+  "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,
+  "discard": "ignore",
+  "driver": "raw",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/d",
+    "node-name": "node-d-s",
+    "read-only": true,
+    "discard": "unmap"
+  }
+}
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.xml
new file mode 100644
index 0000000000..b2d599fc6c
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap-ignore.xml
@@ -0,0 +1,47 @@
+<disk type='file' device='disk'>
+  <driver name='qemu' type='qcow' discard='ignore' detect_zeroes='on'/>
+  <source file='/var/lib/libvirt/images/a'>
+    <privateData>
+      <nodenames>
+        <nodename type='storage' name='node-a-s'/>
+        <nodename type='format' name='node-a-f'/>
+      </nodenames>
+    </privateData>
+  </source>
+  <backingStore type='file' index='1'>
+    <format type='qed'/>
+    <source file='/var/lib/libvirt/images/b'>
+      <privateData>
+        <nodenames>
+          <nodename type='storage' name='node-b-s'/>
+          <nodename type='format' name='node-b-f'/>
+        </nodenames>
+      </privateData>
+    </source>
+    <backingStore type='network' index='2'>
+      <format type='vmdk'/>
+      <source protocol='gluster' name='images/c'>
+        <host name='test.org'/>
+        <privateData>
+          <nodenames>
+            <nodename type='storage' name='node-c-s'/>
+            <nodename type='format' name='node-c-f'/>
+          </nodenames>
+        </privateData>
+      </source>
+      <backingStore type='file' index='3'>
+        <format type='raw'/>
+        <source file='/var/lib/libvirt/images/d'>
+          <privateData>
+            <nodenames>
+              <nodename type='storage' name='node-d-s'/>
+              <nodename type='format' name='node-d-f'/>
+            </nodenames>
+          </privateData>
+        </source>
+        <backingStore/>
+      </backingStore>
+    </backingStore>
+  </backingStore>
+  <target dev='vda'/>
+</disk>
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json
new file mode 100644
index 0000000000..1efc462c06
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.json
@@ -0,0 +1,63 @@
+{
+  "node-name": "node-a-f",
+  "read-only": false,
+  "discard": "unmap",
+  "driver": "qcow",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/a",
+    "node-name": "node-a-s",
+    "read-only": false,
+    "discard": "unmap"
+  },
+  "backing": "node-b-f"
+}
+{
+  "node-name": "node-b-f",
+  "read-only": true,
+  "discard": "unmap",
+  "driver": "qed",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/b",
+    "node-name": "node-b-s",
+    "read-only": true,
+    "discard": "unmap"
+  },
+  "backing": "node-c-f"
+}
+{
+  "node-name": "node-c-f",
+  "read-only": true,
+  "discard": "unmap",
+  "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,
+  "discard": "unmap",
+  "driver": "raw",
+  "file": {
+    "driver": "file",
+    "filename": "/var/lib/libvirt/images/d",
+    "node-name": "node-d-s",
+    "read-only": true,
+    "discard": "unmap"
+  }
+}
diff --git a/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.xml b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.xml
new file mode 100644
index 0000000000..68484991c1
--- /dev/null
+++ b/tests/qemublocktestdata/xml2json/file-backing_basic-unmap.xml
@@ -0,0 +1,47 @@
+<disk type='file' device='disk'>
+  <driver name='qemu' type='qcow' discard='unmap'/>
+  <source file='/var/lib/libvirt/images/a'>
+    <privateData>
+      <nodenames>
+        <nodename type='storage' name='node-a-s'/>
+        <nodename type='format' name='node-a-f'/>
+      </nodenames>
+    </privateData>
+  </source>
+  <backingStore type='file' index='1'>
+    <format type='qed'/>
+    <source file='/var/lib/libvirt/images/b'>
+      <privateData>
+        <nodenames>
+          <nodename type='storage' name='node-b-s'/>
+          <nodename type='format' name='node-b-f'/>
+        </nodenames>
+      </privateData>
+    </source>
+    <backingStore type='network' index='2'>
+      <format type='vmdk'/>
+      <source protocol='gluster' name='images/c'>
+        <host name='test.org'/>
+        <privateData>
+          <nodenames>
+            <nodename type='storage' name='node-c-s'/>
+            <nodename type='format' name='node-c-f'/>
+          </nodenames>
+        </privateData>
+      </source>
+      <backingStore type='file' index='3'>
+        <format type='raw'/>
+        <source file='/var/lib/libvirt/images/d'>
+          <privateData>
+            <nodenames>
+              <nodename type='storage' name='node-d-s'/>
+              <nodename type='format' name='node-d-f'/>
+            </nodenames>
+          </privateData>
+        </source>
+        <backingStore/>
+      </backingStore>
+    </backingStore>
+  </backingStore>
+  <target dev='vda'/>
+</disk>
-- 
2.16.2

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux