Skip to content

Commit

Permalink
Merge pull request #1008 from vojtechtrefny/master_nvme-is-tech-avail…
Browse files Browse the repository at this point in the history
…-api

nvme: Add bd_nvme_is_tech_avail to the API file
  • Loading branch information
vojtechtrefny authored Mar 15, 2024
2 parents ed47e6c + 8a05273 commit 8aafe98
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/lib/plugin_apis/nvme.api
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
/**
Expand Down
8 changes: 8 additions & 0 deletions tests/nvme_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 8aafe98

Please sign in to comment.