]> sourceware.org Git - lvm2.git/commitdiff
Refactor vg_remove_check to place pv removal into separate function.
authorDave Wysochanski <dwysocha@redhat.com>
Wed, 30 Jun 2010 18:03:52 +0000 (18:03 +0000)
committerDave Wysochanski <dwysocha@redhat.com>
Wed, 30 Jun 2010 18:03:52 +0000 (18:03 +0000)
lib/metadata/metadata-exported.h
lib/metadata/metadata.c
liblvm/lvm_vg.c
tools/vgremove.c

index 89a0f6a4174dbd7f06e523f42d69d5df919a9c9b..8d0f744d981785df9f6c22f0423b3717ed6362ea 100644 (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);
index 0b7063d215fea58b36a7df500078ed2b25ec17d4..b998219007da4040707f507755d8007191066e23 100644 (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)
index ada4070706d859daa88173762245e59feba0615e..20aeb4f33ea4dd1b599e4924c402bfcb9dd54afc 100644 (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;
 }
 
index 56e18ef0b0636dca758a94df99fbe28383eac3ed..ce0334754cb4a09d4f4c83ac840e6a7f3f3eb322 100644 (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;
This page took 1.287571 seconds and 5 git commands to generate.