a41c76
From 9fac737d1a60821d00d5c0352ee8c6b01f56d15c Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <9fac737d1a60821d00d5c0352ee8c6b01f56d15c@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Tue, 24 Mar 2020 16:25:56 +0100
a41c76
Subject: [PATCH] qemublocktest: xml->json: Add test for NVMe
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Based on the configuration from the only qemuxml2argv test.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
a41c76
(cherry picked from commit 2337dbfdd1271891e3aa56c3d01389030ca10741)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1804617
a41c76
Message-Id: <3b5eb8505338de198ce8c783bffaecf2ee0127a3.1585063415.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 tests/qemublocktest.c                              |  2 ++
a41c76
 .../xml2json/nvme-raw-noopts-srconly.json          |  5 +++++
a41c76
 .../xml2json/nvme-raw-noopts.json                  | 14 ++++++++++++++
a41c76
 .../qemublocktestdata/xml2json/nvme-raw-noopts.xml | 13 +++++++++++++
a41c76
 4 files changed, 34 insertions(+)
a41c76
 create mode 100644 tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json
a41c76
 create mode 100644 tests/qemublocktestdata/xml2json/nvme-raw-noopts.json
a41c76
 create mode 100644 tests/qemublocktestdata/xml2json/nvme-raw-noopts.xml
a41c76
a41c76
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
a41c76
index cd7ea6bb2b..189e95f46a 100644
a41c76
--- a/tests/qemublocktest.c
a41c76
+++ b/tests/qemublocktest.c
a41c76
@@ -1203,6 +1203,8 @@ mymain(void)
a41c76
     TEST_DISK_TO_JSON("block-raw-noopts");
a41c76
     TEST_DISK_TO_JSON("block-raw-reservations");
a41c76
 
a41c76
+    TEST_DISK_TO_JSON("nvme-raw-noopts");
a41c76
+
a41c76
 #define TEST_JSON_TO_JSON(nme) \
a41c76
     do { \
a41c76
         jsontojsondata.name = nme; \
a41c76
diff --git a/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json b/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json
a41c76
new file mode 100644
a41c76
index 0000000000..ed55c08cbf
a41c76
--- /dev/null
a41c76
+++ b/tests/qemublocktestdata/xml2json/nvme-raw-noopts-srconly.json
a41c76
@@ -0,0 +1,5 @@
a41c76
+{
a41c76
+  "driver": "nvme",
a41c76
+  "device": "0000:01:00.0",
a41c76
+  "namespace": 1
a41c76
+}
a41c76
diff --git a/tests/qemublocktestdata/xml2json/nvme-raw-noopts.json b/tests/qemublocktestdata/xml2json/nvme-raw-noopts.json
a41c76
new file mode 100644
a41c76
index 0000000000..e18e96099c
a41c76
--- /dev/null
a41c76
+++ b/tests/qemublocktestdata/xml2json/nvme-raw-noopts.json
a41c76
@@ -0,0 +1,14 @@
a41c76
+{
a41c76
+  "node-name": "0123456789ABCDEF0123456789ABCDE",
a41c76
+  "read-only": false,
a41c76
+  "driver": "raw",
a41c76
+  "file": "0123456789ABCDEF0123456789ABCDE"
a41c76
+}
a41c76
+{
a41c76
+  "driver": "nvme",
a41c76
+  "device": "0000:01:00.0",
a41c76
+  "namespace": 1,
a41c76
+  "node-name": "0123456789ABCDEF0123456789ABCDE",
a41c76
+  "auto-read-only": true,
a41c76
+  "discard": "unmap"
a41c76
+}
a41c76
diff --git a/tests/qemublocktestdata/xml2json/nvme-raw-noopts.xml b/tests/qemublocktestdata/xml2json/nvme-raw-noopts.xml
a41c76
new file mode 100644
a41c76
index 0000000000..1e4dbd6e56
a41c76
--- /dev/null
a41c76
+++ b/tests/qemublocktestdata/xml2json/nvme-raw-noopts.xml
a41c76
@@ -0,0 +1,13 @@
a41c76
+<disk type='nvme' device='disk'>
a41c76
+  <driver name='qemu' type='raw'/>
a41c76
+  <source type='pci' managed='yes' namespace='1'>
a41c76
+    <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
a41c76
+    <privateData>
a41c76
+      <nodenames>
a41c76
+        <nodename type='storage' name='0123456789ABCDEF0123456789ABCDE'/>
a41c76
+        <nodename type='format' name='0123456789ABCDEF0123456789ABCDE'/>
a41c76
+      </nodenames>
a41c76
+    </privateData>
a41c76
+  </source>
a41c76
+  <target dev='vda' bus='virtio'/>
a41c76
+</disk>
a41c76
-- 
a41c76
2.26.0
a41c76