nvme: Add bd_nvme_is_tech_avail to the API file

Resolves: RHEL-60061
This commit is contained in:
Vojtech Trefny 2024-09-25 15:59:14 +02:00
parent 90e61b5a38
commit 5b67618c26
2 changed files with 60 additions and 1 deletions

View File

@ -0,0 +1,54 @@
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

View File

@ -86,7 +86,7 @@
Name: libblockdev
Version: 3.1.0
Release: 7%{?dist}
Release: 8%{?dist}
Summary: A library for low-level manipulation with block devices
License: LGPL-2.1-or-later
URL: https://github.com/storaged-project/libblockdev
@ -99,6 +99,7 @@ Patch2: 0003-Fix-passing-size-for-pvresize-over-DBus.patch
Patch3: 0004-Upstream-kernel-VDO-support.patch
Patch4: 0005-libext2fs-unused-parameters-fix.patch
Patch5: 0006-smart-plugin.patch
Patch6: 0007-nvme-Add-bd_nvme_is_tech_avail-to-the-API-file.patch
BuildRequires: make
BuildRequires: glib2-devel
@ -955,6 +956,10 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm}
%files plugins-all
%changelog
* Wed Sep 25 2024 Vojtech Trefny <vtrefny@redhat.com> - 3.1.0-8
- nvme: Add bd_nvme_is_tech_avail to the API file
Resolves: RHEL-60061
* Wed Jul 24 2024 Vojtech Trefny <vtrefny@redhat.com> - 3.1.0-7
- Backport libblockdev-smart plugin
Resolves: RHEL-49675