mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-14 04:59:04 +03:00
Add pv_read_path, a proposed external LVM library function to take a device path and return a PV handle
This commit is contained in:
parent
49cae61254
commit
993e30a7de
@ -1,5 +1,6 @@
|
||||
Version 2.02.27 -
|
||||
================================
|
||||
Add pv_read_path external library function.
|
||||
Tidy clvmd-openais of redundant bits, and improve an error report.
|
||||
Cope with find_seg_by_le() failure in check_lv_segments().
|
||||
Call dev_iter_destroy() if _process_all_devs() is interrupted by sigint.
|
||||
|
@ -72,7 +72,6 @@ static int _add_pv_to_vg(struct volume_group *vg, const char *pv_name)
|
||||
struct physical_volume *pv;
|
||||
struct format_instance *fid = vg->fid;
|
||||
struct dm_pool *mem = fid->fmt->cmd->mem;
|
||||
struct list mdas;
|
||||
|
||||
log_verbose("Adding physical volume '%s' to volume group '%s'",
|
||||
pv_name, vg->name);
|
||||
@ -82,8 +81,7 @@ static int _add_pv_to_vg(struct volume_group *vg, const char *pv_name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
list_init(&mdas);
|
||||
if (!(pv = _pv_read(fid->fmt->cmd, pv_name, &mdas, NULL, 1))) {
|
||||
if (!(pv = pv_read_path(fid->fmt->cmd, pv_name))) {
|
||||
log_error("%s not identified as an existing physical volume",
|
||||
pv_name);
|
||||
return 0;
|
||||
@ -1842,3 +1840,22 @@ uint32_t vg_status(vg_t *vg)
|
||||
{
|
||||
return vg->status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pv_read_path - Given a device path return a PV handle if it is a PV
|
||||
* @cmd - handle to the LVM command instance
|
||||
* @pv_name - device path to read for the PV
|
||||
*
|
||||
* Returns:
|
||||
* NULL - device path does not contain a valid PV
|
||||
* non-NULL - PV handle corresponding to device path
|
||||
*
|
||||
*/
|
||||
pv_t *pv_read_path(const struct cmd_context *cmd, const char *pv_name)
|
||||
{
|
||||
struct list mdas;
|
||||
|
||||
list_init(&mdas);
|
||||
return _pv_read(cmd, pv_name, &mdas, NULL, 1);
|
||||
}
|
||||
|
@ -638,7 +638,7 @@ char *generate_lv_name(struct volume_group *vg, const char *format,
|
||||
char *buffer, size_t len);
|
||||
|
||||
/*
|
||||
* Gets/Sets for external LVM library
|
||||
* Begin skeleton for external LVM library
|
||||
*/
|
||||
struct id pv_id(pv_t *pv);
|
||||
const struct format_type *pv_format_type(pv_t *pv);
|
||||
@ -654,4 +654,6 @@ uint32_t pv_pe_alloc_count(pv_t *pv);
|
||||
|
||||
uint32_t vg_status(vg_t *vg);
|
||||
|
||||
pv_t *pv_read_path(const struct cmd_context *cmd, const char *pv_name);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user