render / rpms / libvirt

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