libvirt/SOURCES/libvirt-qemublocktest-xml-json-Add-test-for-NVMe.patch

95 lines
3.3 KiB
Diff
Raw Normal View History

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