mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
Turn _add_pv_to_vg() into external library function add_pv_to_vg()
This commit is contained in:
parent
30303765a3
commit
0c795e2e18
@ -1,6 +1,7 @@
|
|||||||
Version 2.02.27 -
|
Version 2.02.27 -
|
||||||
================================
|
================================
|
||||||
Add pv_read_path external library function.
|
Turn _add_pv_to_vg() into external library function add_pv_to_vg().
|
||||||
|
Add pv_read_path() external library function.
|
||||||
Tidy clvmd-openais of redundant bits, and improve an error report.
|
Tidy clvmd-openais of redundant bits, and improve an error report.
|
||||||
Cope with find_seg_by_le() failure in check_lv_segments().
|
Cope with find_seg_by_le() failure in check_lv_segments().
|
||||||
Call dev_iter_destroy() if _process_all_devs() is interrupted by sigint.
|
Call dev_iter_destroy() if _process_all_devs() is interrupted by sigint.
|
||||||
|
@ -66,10 +66,21 @@ unsigned long pe_align(void)
|
|||||||
return MAX(65536UL, lvm_getpagesize()) >> SECTOR_SHIFT;
|
return MAX(65536UL, lvm_getpagesize()) >> SECTOR_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _add_pv_to_vg(struct volume_group *vg, const char *pv_name)
|
/**
|
||||||
|
* add_pv_to_vg - Add a physical volume to a volume group
|
||||||
|
* @vg - volume group to add to
|
||||||
|
* @pv_name - name of the pv (to be removed)
|
||||||
|
* @pv - physical volume to add to volume group
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 0 - failure
|
||||||
|
* 1 - success
|
||||||
|
* FIXME: remove pv_name - obtain safely from pv
|
||||||
|
*/
|
||||||
|
int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
|
||||||
|
struct physical_volume *pv)
|
||||||
{
|
{
|
||||||
struct pv_list *pvl;
|
struct pv_list *pvl;
|
||||||
struct physical_volume *pv;
|
|
||||||
struct format_instance *fid = vg->fid;
|
struct format_instance *fid = vg->fid;
|
||||||
struct dm_pool *mem = fid->fmt->cmd->mem;
|
struct dm_pool *mem = fid->fmt->cmd->mem;
|
||||||
|
|
||||||
@ -81,12 +92,6 @@ static int _add_pv_to_vg(struct volume_group *vg, const char *pv_name)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pv = pv_read_path(fid->fmt->cmd, pv_name))) {
|
|
||||||
log_error("%s not identified as an existing physical volume",
|
|
||||||
pv_name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*pv->vg_name) {
|
if (*pv->vg_name) {
|
||||||
log_error("Physical volume '%s' is already in volume group "
|
log_error("Physical volume '%s' is already in volume group "
|
||||||
"'%s'", pv_name, pv->vg_name);
|
"'%s'", pv_name, pv->vg_name);
|
||||||
@ -246,11 +251,19 @@ int vg_rename(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
int vg_extend(struct volume_group *vg, int pv_count, char **pv_names)
|
int vg_extend(struct volume_group *vg, int pv_count, char **pv_names)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
struct physical_volume *pv;
|
||||||
|
|
||||||
/* attach each pv */
|
/* attach each pv */
|
||||||
for (i = 0; i < pv_count; i++)
|
for (i = 0; i < pv_count; i++) {
|
||||||
if (!_add_pv_to_vg(vg, pv_names[i]))
|
if (!(pv = pv_read_path(vg->fid->fmt->cmd, pv_names[i]))) {
|
||||||
|
log_error("%s not identified as an existing "
|
||||||
|
"physical volume", pv_names[i]);
|
||||||
goto bad;
|
goto bad;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!add_pv_to_vg(vg, pv_names[i], pv))
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
|
||||||
/* FIXME Decide whether to initialise and add new mdahs to format instance */
|
/* FIXME Decide whether to initialise and add new mdahs to format instance */
|
||||||
|
|
||||||
@ -1854,7 +1867,7 @@ uint32_t vg_status(vg_t *vg)
|
|||||||
* non-NULL - PV handle corresponding to device path
|
* non-NULL - PV handle corresponding to device path
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
pv_t *pv_read_path(const struct cmd_context *cmd, const char *pv_name)
|
pv_t *pv_read_path(struct cmd_context *cmd, const char *pv_name)
|
||||||
{
|
{
|
||||||
struct list mdas;
|
struct list mdas;
|
||||||
|
|
||||||
|
@ -654,6 +654,8 @@ uint32_t pv_pe_alloc_count(pv_t *pv);
|
|||||||
|
|
||||||
uint32_t vg_status(vg_t *vg);
|
uint32_t vg_status(vg_t *vg);
|
||||||
|
|
||||||
pv_t *pv_read_path(const struct cmd_context *cmd, const char *pv_name);
|
pv_t *pv_read_path(struct cmd_context *cmd, const char *pv_name);
|
||||||
|
int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
|
||||||
|
struct physical_volume *pv);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user