summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Rockai <prockai@redhat.com>2013-07-29 18:54:59 +0200
committerPetr Rockai <prockai@redhat.com>2013-08-28 14:54:32 +0200
commit2f4d7c73c54dfbc8743305629884f96667e9f9e8 (patch)
treef3744579aa6164a5c057aa2b58f76c320de28407
parent69970f19202fd742860cb97ff4dd60ffe272dfe3 (diff)
downloadlvm2-2f4d7c73c54dfbc8743305629884f96667e9f9e8.tar.gz
metadata: Add a pv_label accessor (go from a PV to its label).
-rw-r--r--lib/metadata/pv.c10
-rw-r--r--lib/metadata/pv.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/metadata/pv.c b/lib/metadata/pv.c
index 5b08998e6..0288f0740 100644
--- a/lib/metadata/pv.c
+++ b/lib/metadata/pv.c
@@ -350,3 +350,13 @@ unsigned pv_mda_set_ignored(const struct physical_volume *pv, unsigned mda_ignor
return 1;
}
+struct label *pv_label(const struct physical_volume *pv)
+{
+ struct lvmcache_info *info =
+ lvmcache_info_from_pvid((const char *)&pv->id.uuid, 0);
+ if (!info) {
+ log_error(INTERNAL_ERROR "PV %s unexpectedly not in cache.", dev_name(pv->dev));
+ return NULL;
+ }
+ return lvmcache_get_label(info);
+}
diff --git a/lib/metadata/pv.h b/lib/metadata/pv.h
index ff708f8e3..8fd3061fa 100644
--- a/lib/metadata/pv.h
+++ b/lib/metadata/pv.h
@@ -95,5 +95,6 @@ unsigned pv_mda_set_ignored(const struct physical_volume *pv, unsigned ignored);
int is_orphan(const struct physical_volume *pv);
int is_missing_pv(const struct physical_volume *pv);
int is_pv(const struct physical_volume *pv);
+struct label *pv_label(const struct physical_volume *pv);
#endif /* _LVM_PV_H */