libstoragemgmt.h(0p)
π 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
- fedora 43: libstoragemgmt-devel 1.10.3-1.fc43 Β· LGPL-2.1-or-later
- fedora 44: libstoragemgmt-devel 1.10.3-1.fc44 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms