summaryrefslogtreecommitdiffstats
path: root/tools/vgremove.c
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2001-10-11 21:35:55 +0000
committerAlasdair Kergon <agk@redhat.com>2001-10-11 21:35:55 +0000
commit6e91eeef1353ead8a0327b1905a4bcf093de91aa (patch)
tree1410944f27e05fa4044e9083322eb111153a99bd /tools/vgremove.c
parentc4bf9638e338cc917e7d78fe2ecb85f22bbb9963 (diff)
downloadlvm2-6e91eeef1353ead8a0327b1905a4bcf093de91aa.tar.gz
lvm2-6e91eeef1353ead8a0327b1905a4bcf093de91aa.tar.xz
lvm2-6e91eeef1353ead8a0327b1905a4bcf093de91aa.zip
vgreduce, vgremove, vgrename & vgscan
Diffstat (limited to 'tools/vgremove.c')
-rw-r--r--tools/vgremove.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/tools/vgremove.c b/tools/vgremove.c
index ad1aaf4e..da1bf299 100644
--- a/tools/vgremove.c
+++ b/tools/vgremove.c
@@ -32,13 +32,13 @@ static int vgremove_single(const char *vg_name)
struct volume_group *vg;
struct physical_volume *pv;
struct list_head *pvh;
+ int ret = 0;
- log_verbose("Checking for volume group %s", vg_name);
- if (!(vg = ios->vg_read(ios, vg_name))) {
- log_error("Volume group %s doesn't exist", vg_name);
- return ECMD_FAILED;
- }
-
+ log_verbose("Checking for volume group %s", vg_name);
+ if (!(vg = ios->vg_read(ios, vg_name))) {
+ log_error("Volume group %s doesn't exist", vg_name);
+ return ECMD_FAILED;
+ }
if (vg->status & ACTIVE) {
log_error("Volume group %s is still active", vg_name);
@@ -47,7 +47,7 @@ static int vgremove_single(const char *vg_name)
if (vg->lv_count) {
log_error("Volume group %s still contains %d logical volume(s)",
- vg_name, vg->lv_count);
+ vg_name, vg->lv_count);
return ECMD_FAILED;
}
@@ -58,19 +58,23 @@ static int vgremove_single(const char *vg_name)
}
*************/
-
/* init physical volumes */
list_for_each(pvh, &vg->pvs) {
pv = &list_entry(pvh, struct pv_list, list)->pv;
log_verbose("Removing physical volume %s from volume group %s",
pv->dev->name, vg_name);
- pv->vg_name = '\0';
- if (!(ios->pv_write(ios, pv)))
+ *pv->vg_name = '\0';
+ if (!(ios->pv_write(ios, pv))) {
log_error("Failed to remove physical volume %s from "
- "volume group %s", pv->dev->name, vg_name);
+ "volume group %s", pv->dev->name, vg_name);
+ ret = ECMD_FAILED;
+ }
}
- log_print("Volume group %s successfully removed", vg_name);
+ if (!ret)
+ log_print("Volume group %s successfully removed", vg_name);
+ else
+ log_error("Volume group %s not properly removed", vg_name);
- return 0;
+ return ret;
}