55 lines
1.8 KiB
Diff
55 lines
1.8 KiB
Diff
From 11c7d2542addb74b62849caa3c8c7057c41fd45f Mon Sep 17 00:00:00 2001
|
|
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
Date: Thu, 14 Mar 2024 13:53:04 +0100
|
|
Subject: [PATCH] nvme: Add bd_nvme_is_tech_avail to the API file
|
|
|
|
---
|
|
src/lib/plugin_apis/nvme.api | 11 +++++++++++
|
|
tests/nvme_test.py | 8 ++++++++
|
|
2 files changed, 19 insertions(+)
|
|
|
|
diff --git a/src/lib/plugin_apis/nvme.api b/src/lib/plugin_apis/nvme.api
|
|
index 44f8bf73..2f17e0c9 100644
|
|
--- a/src/lib/plugin_apis/nvme.api
|
|
+++ b/src/lib/plugin_apis/nvme.api
|
|
@@ -66,6 +66,17 @@ typedef enum {
|
|
BD_NVME_TECH_MODE_INITIATOR = 1 << 2,
|
|
} BDNVMETechMode;
|
|
|
|
+/**
|
|
+ * bd_nvme_is_tech_avail:
|
|
+ * @tech: the queried tech
|
|
+ * @mode: a bit mask of queried modes of operation (#BDNVMETechMode) for @tech
|
|
+ * @error: (out) (nullable): place to store error (details about why the @tech-@mode combination is not available)
|
|
+ *
|
|
+ * Returns: whether the @tech-@mode combination is available -- supported by the
|
|
+ * plugin implementation and having all the runtime dependencies available
|
|
+ */
|
|
+gboolean bd_nvme_is_tech_avail (BDNVMETech tech, G_GNUC_UNUSED guint64 mode, GError **error);
|
|
+
|
|
|
|
/* BpG-skip */
|
|
/**
|
|
diff --git a/tests/nvme_test.py b/tests/nvme_test.py
|
|
index f31de546..df31f112 100644
|
|
--- a/tests/nvme_test.py
|
|
+++ b/tests/nvme_test.py
|
|
@@ -44,6 +44,14 @@ class NVMePluginVersionTestCase(NVMeTest):
|
|
def test_plugin_version(self):
|
|
self.assertEqual(BlockDev.get_plugin_soname(BlockDev.Plugin.NVME), "libbd_nvme.so.3")
|
|
|
|
+ @tag_test(TestTags.NOSTORAGE)
|
|
+ def test_availability(self):
|
|
+ avail = BlockDev.nvme_is_tech_avail(BlockDev.NVMETech.NVME, 0)
|
|
+ self.assertTrue(avail)
|
|
+
|
|
+ avail = BlockDev.nvme_is_tech_avail(BlockDev.NVMETech.FABRICS, 0)
|
|
+ self.assertTrue(avail)
|
|
+
|
|
|
|
class NVMeTestCase(NVMeTest):
|
|
def setUp(self):
|
|
--
|
|
2.46.2
|
|
|