1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

Refactor vg_remove_check to place pv removal into separate function.

This commit is contained in:
Dave Wysochanski 2010-06-30 18:03:52 +00:00
parent 23177eda88
commit 40b4d1c3ae
4 changed files with 12 additions and 2 deletions

View File

@ -540,6 +540,7 @@ uint32_t pv_list_extents_free(const struct dm_list *pvh);
struct volume_group *vg_create(struct cmd_context *cmd, const char *vg_name);
int vg_remove_mdas(struct volume_group *vg);
int vg_remove_check(struct volume_group *vg);
void vg_remove_pvs(struct volume_group *vg);
int vg_remove(struct volume_group *vg);
int vg_rename(struct cmd_context *cmd, struct volume_group *vg,
const char *new_name);

View File

@ -510,7 +510,6 @@ int remove_lvs_in_vg(struct cmd_context *cmd,
int vg_remove_check(struct volume_group *vg)
{
unsigned lv_count;
struct pv_list *pvl, *tpvl;
if (vg_read_error(vg) || vg_missing_pv_count(vg)) {
log_error("Volume group \"%s\" not found, is inconsistent "
@ -534,11 +533,17 @@ int vg_remove_check(struct volume_group *vg)
if (!archive(vg))
return 0;
return 1;
}
void vg_remove_pvs(struct volume_group *vg)
{
struct pv_list *pvl, *tpvl;
dm_list_iterate_items_safe(pvl, tpvl, &vg->pvs) {
del_pvl_from_vgs(vg, pvl);
dm_list_add(&vg->removed_pvs, &pvl->list);
}
return 1;
}
int vg_remove(struct volume_group *vg)

View File

@ -180,6 +180,8 @@ int lvm_vg_remove(vg_t vg)
if (!vg_remove_check(vg))
return -1;
vg_remove_pvs(vg);
return 0;
}

View File

@ -54,6 +54,8 @@ static int vgremove_single(struct cmd_context *cmd, const char *vg_name,
return ECMD_FAILED;
}
vg_remove_pvs(vg);
if (!vg_remove(vg)) {
stack;
return ECMD_FAILED;