render / rpms / libvirt

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