summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Rockai <prockai@redhat.com>2013-07-29 18:54:59 +0200
committerPetr Rockai <prockai@redhat.com>2013-11-17 21:41:27 +0100
commitdc3a0711454938e1a6264b7e3bf24a6dd1ac7e9f (patch)
tree743d36bfc8e3bdf9ed147b2ce321b710999d151d
parenta2034e9a99337ac16ee415f7f2398e0b8e976716 (diff)
downloadlvm2-dc3a0711454938e1a6264b7e3bf24a6dd1ac7e9f.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 */