summaryrefslogtreecommitdiffstats
path: root/liblvm
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2009-07-24 12:48:21 +0000
committerDave Wysochanski <dwysocha@redhat.com>2009-07-24 12:48:21 +0000
commitfe63e644d98f2c17b139346efe92e4b04705c901 (patch)
treebe55df120bfca3b3d63e312518054de965800d2b /liblvm
parent122ccd0d04a64ddc31de5e466a160bf02678e14d (diff)
downloadlvm2-fe63e644d98f2c17b139346efe92e4b04705c901.tar.gz
lvm2-fe63e644d98f2c17b139346efe92e4b04705c901.tar.xz
lvm2-fe63e644d98f2c17b139346efe92e4b04705c901.zip
Add lvm_scan_vgs liblvm fn to scan the system for LVM metadata.
The lvm_list_vg_{names|ids} functions do not do a scan so we provide a liblvm function that does a scan. Author: Dave Wysochanski <dwysocha@redhat.com>
Diffstat (limited to 'liblvm')
-rw-r--r--liblvm/.exported_symbols1
-rw-r--r--liblvm/lvm.h8
-rw-r--r--liblvm/lvm_vg.c6
3 files changed, 15 insertions, 0 deletions
diff --git a/liblvm/.exported_symbols b/liblvm/.exported_symbols
index c652625e..08d5a603 100644
--- a/liblvm/.exported_symbols
+++ b/liblvm/.exported_symbols
@@ -14,6 +14,7 @@ lvm_vg_write
lvm_vg_open
lvm_vg_close
lvm_vg_remove
+lvm_scan_vgs
lvm_errno
lvm_errmsg
lvm_vg_list_pvs
diff --git a/liblvm/lvm.h b/liblvm/lvm.h
index 2897fc0a..c2157a87 100644
--- a/liblvm/lvm.h
+++ b/liblvm/lvm.h
@@ -265,6 +265,8 @@ struct dm_list *lvm_vg_list_pvs(vg_t *vg);
* Return a list of VG names or VG uuids in the system.
*
* NOTE: This function will _NOT_ scan devices in the system for LVM metadata.
+ * To scan the system, use lvm_scan_vgs.
+ *
* To process the list, use the dm_list iterator functions. For example:
* vg_t *vg;
* struct dm_list *vgnames;
@@ -286,5 +288,11 @@ struct dm_list *lvm_vg_list_pvs(vg_t *vg);
struct dm_list *lvm_list_vg_names(lvm_t libh);
struct dm_list *lvm_list_vg_ids(lvm_t libh);
+/**
+ * Scan all devices on the system for VGs and LVM metadata.
+ *
+ * \return Status code of 1 (success) or 0 (failure).
+ */
+int lvm_scan_vgs(lvm_t libh);
#endif /* _LIB_LVM_H */
diff --git a/liblvm/lvm_vg.c b/liblvm/lvm_vg.c
index 44120921..52de4905 100644
--- a/liblvm/lvm_vg.c
+++ b/liblvm/lvm_vg.c
@@ -22,6 +22,7 @@
#include "archiver.h"
#include "locking.h"
#include "lvm-string.h"
+#include "lvmcache.h"
vg_t *lvm_vg_create(lvm_t libh, const char *vg_name)
{
@@ -198,3 +199,8 @@ struct dm_list *lvm_list_vg_ids(lvm_t libh)
{
return get_vgids((struct cmd_context *)libh, 0);
}
+
+int lvm_scan_vgs(lvm_t libh)
+{
+ return lvmcache_label_scan((struct cmd_context *)libh, 2);
+}