mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Allocate new pv->vg_name from pool, it can be destroyed later.
(The mempool rename will be used later by vg private mempools)
This commit is contained in:
parent
212a510f04
commit
ec5703ea07
@ -201,15 +201,17 @@ int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
|
|||||||
static int _copy_pv(struct physical_volume *pv_to,
|
static int _copy_pv(struct physical_volume *pv_to,
|
||||||
struct physical_volume *pv_from)
|
struct physical_volume *pv_from)
|
||||||
{
|
{
|
||||||
|
struct dm_pool *pvmem = pv_from->fmt->cmd->mem;
|
||||||
|
|
||||||
memcpy(pv_to, pv_from, sizeof(*pv_to));
|
memcpy(pv_to, pv_from, sizeof(*pv_to));
|
||||||
|
|
||||||
if (!str_list_dup(pv_to->fmt->cmd->mem, &pv_to->tags, &pv_from->tags)) {
|
if (!(pv_to->vg_name = dm_pool_strdup(pvmem, pv_from->vg_name)))
|
||||||
log_error("PV tags duplication failed");
|
return_0;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!peg_dup(pv_to->fmt->cmd->mem, &pv_to->segments,
|
if (!str_list_dup(pvmem, &pv_to->tags, &pv_from->tags))
|
||||||
&pv_from->segments))
|
return_0;
|
||||||
|
|
||||||
|
if (!peg_dup(pvmem, &pv_to->segments, &pv_from->segments))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -235,8 +237,10 @@ int get_pv_from_vg_by_id(const struct format_type *fmt, const char *vg_name,
|
|||||||
|
|
||||||
dm_list_iterate_items(pvl, &vg->pvs) {
|
dm_list_iterate_items(pvl, &vg->pvs) {
|
||||||
if (id_equal(&pvl->pv->id, (const struct id *) pvid)) {
|
if (id_equal(&pvl->pv->id, (const struct id *) pvid)) {
|
||||||
if (!_copy_pv(pv, pvl->pv))
|
if (!_copy_pv(pv, pvl->pv)) {
|
||||||
|
log_error("internal PV duplication failed");
|
||||||
return_0;
|
return_0;
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user