libstoragemgmt.h(0p)

πŸ“¦
version 1.10.3 Β· 3 versions
, in fedora 43, fedora 44

πŸ’– libstoragemgmt.h β€” the Storage Management Library πŸ’–

okay bestie, so this page is libstoragemgmt.h(0p), like, straight out of the libStorageMgmt manual set. It's the big-picture, front-door page for the whole library. Grab a snack, we're going in 🫢


✨ NAME ✨

libstoragemgmt.h β€” Storage Management Library. That's the whole name, no notes πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libstoragemgmt/libstoragemgmt.h>

that's it. one include and you're in the group chat πŸ’œ


🌸 DESCRIPTION 🌸

LibStorageMgmt is a vendor neutral library that hands you an API and tools for managing SAN/NAS/DAS storage. It's a community open source project, licensed under LGPL 2.1+, and it gives you β€” but is absolutely not limited to β€” these features:

  • List storage pools, volumes, access groups, or file systems. ✨
  • Create and delete volumes, access groups, file systems, or NFS exports.
  • Grant and remove access to volumes, access groups, or initiators.
  • Replicate volumes with snapshots, clones, and copies. πŸ”₯
  • Create and delete access groups and edit members of a group.
  • List Linux local SCSI/ATA/NVMe disks.
  • Control IDENT/FAULT LED of local disk via SES (SCSI Enclosure Service). πŸ’‘

Full documentation can be found at:

http://libstorage.github.io/libstoragemgmt-doc/

Now, the libstoragemgmt girlies provide two types of functions:

  • Plugin level function.

Plugin functions require the libstoragemgmt daemon (lsmd) running, and a runtime plugin connection created by lsm_connect_password(). Check the CONNECTION section for the deets, bestie.

  • Library level functions.

Library level functions need no daemon and no plugin connection. Everything about local disk is a library level function. Check the LOCAL DISK section for detail.

Also, literally every function mentioned on this manpage has its own manpage with the full tea. Obsessed. β˜•


πŸ‘‘ USAGE πŸ‘‘

To use libstoragemgmt in your project:

Add these lines to configure.ac

PKG_CHECK_MODULES(
    [LSM], [libstoragemgmt >= 1.3.0],,
    AC_MSG_ERROR([libstoragemgmt 1.3.0 or newer not found.]))

And similar lines below into your Makefile.am file:

foo_CFLAGS = $(LSM_CFLAGS)
foo_LDADD = $(LSM_LIBS)

πŸŽ€ EXAMPLE πŸŽ€

here's the whole thing, verbatim, no cap:

#include <stdio.h>
#include <libstoragemgmt/libstoragemgmt.h>

void error(char *msg, int rc, lsm_error *e)
{
    if( rc ) {
        printf("%s: error: %d0, msg, rc);

        if( e && lsm_error_message_get(e) ) {
            printf("Msg: %s0, lsm_error_message_get(e));
            lsm_error_free(e);
        }
    }
}

void list_pools(lsm_connect *c)
{
    lsm_pool **pools = NULL;
    int rc = 0;
    uint32_t count = 0;

    rc = lsm_pool_list(c, NULL, NULL, &pools, &count, LSM_FLAG_RSVD);
    if( LSM_ERR_OK == rc ) {
        uint32_t i;
        for( i = 0; i < count; ++i) {
            printf("pool name: %s freespace: %"PRIu64"0,
                lsm_pool_name_get(pools[i]),
                lsm_pool_free_space_get(pools[i]));
        }

        lsm_pool_record_array_free(pools, count);
    } else {
        error("Volume list", rc, lsm_error_last_get(c));
    }
}

int main()
{
    lsm_connect *c = NULL;
    lsm_error *e = NULL;
    int rc = 0;

    const char *uri = "sim://";

    rc = lsm_connect_password(uri, NULL, &c, 30000, &e, LSM_FLAG_RSVD);

    if( LSM_ERR_OK == rc ) {
        printf("We connected...0);

        list_pools(c);

        rc = lsm_connect_close(c, LSM_FLAG_RSVD);
        if( LSM_ERR_OK != rc ) {
            error("Close", rc, lsm_error_last_get(c));
        } else {
            printf("We closed0);
        }
    } else {
        error("Connect", rc, e);
    }

    return rc;
}

πŸ’… CONNECTION πŸ’…

Explain daemon, plugin, and URI here.

not me just telling you what the page tells you β€” it literally says that, bestie, it's a placeholder πŸ™ˆ

🌈 SYSTEM 🌈

TODO(Gris Ge): Example terminology here.

Functions:

lsm_system_list()

Query all systems.

lsm_system_record_copy()

lsm_system_record_free()

lsm_system_record_array_free()

lsm_system_id_get()

lsm_system_name_get()

lsm_system_read_cache_pct_get()

lsm_system_status_get()

lsm_system_fw_version_get()

lsm_system_mode_get()


πŸ“ POOL πŸ“

TODO


🧚 VOLUME 🧚

TODO


⭐ DISK ⭐

TODO


πŸ’œ LOCAL DISK πŸ’œ

TODO


😭 ERROR HANDLING 😭

TODO(Gris Ge): Put a simple example on lsm_error string and error number here.


πŸ’€ BUGS πŸ’€

Please report bugs to <libstoragemgmt-devel@lists.fedorahosted.org> Or

https://github.com/libstorage/libstoragemgmt/issues

like, please actually report them, we wanna know πŸ₯Ί


🌸 AUTHOR 🌸

  • Tony Asleson <tasleson@redhat.com>
  • Gris Ge <fge@redhat.com>

and that's the page, bestie!! this one's from libstoragemgmt.h version 1.10.3, dated September 2014 β€” the libstoragemgmt.h(0p) of it all. go forth and manage some storage, you absolute icon πŸ‘‘βœ¨πŸ’–

πŸ“¦ where this page comes from