mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
metadata: Add a pv_label accessor (go from a PV to its label).
This commit is contained in:
parent
a2034e9a99
commit
dc3a071145
@ -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);
|
||||
}
|
||||
|
@ -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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user