<br>hello, i write a little patch that add a force (or recursive ?) option to vgremove <br>i think the semantic is better if you call vgremove -f <vg> than <br>call lvremove <vg> and then vgremove <vg>
<br><br>Example:<br><br>root@cobalto:/usr/local/src/LVM2/tools# lvm lvs<br> LV VG Attr LSize Origin Snap% Move Log Copy% <br> lvprueba1 prueba -wi-a- 128.00M <br> lvprueba2 prueba -wi-a-
128.00M <br> lvprueba3 prueba -wi-a- 128.00M <br> lvprueba4 prueba -wi-a- 128.00M <br><br>root@cobalto:/usr/local/src/LVM2/tools# ./lvm vgremove -f prueba
<br> Logical volume "lvprueba1" successfully removed<br> Logical volume "lvprueba2" successfully removed<br> Logical volume "lvprueba3" successfully removed<br> Logical volume "lvprueba4" successfully removed
<br> Volume group "prueba" successfully removed<br><br><br>root@cobalto:/usr/local/src/LVM2/tools# ./lvm lvs <br>root@cobalto:/usr/local/src/LVM2/tools# <br>root@cobalto:/usr/local/src/LVM2/tools# ./lvm vgdisplay prueba
<br> Volume group "prueba" not found<br><br><br clear="all">Sorry i dont know the procedure to submit a patch, this is my firt time ever a send a patch to any gnu project. <br><br>Thanks!<br><br>Saludos<br>--------------------------------------
<br>Index: commands.h<br>===================================================================<br>RCS file: /cvs/lvm2/LVM2/tools/commands.h,v<br>retrieving revision 1.98<br>diff -u -r1.98 commands.h<br>--- commands.h 1 Aug 2007 21:01:06 -0000
1.98<br>+++ commands.h 9 Aug 2007 02:28:01 -0000<br>@@ -806,6 +806,7 @@<br> xx(vgremove,<br> "Remove volume group(s)",<br> "vgremove\n"<br>+ "\t[-f|--force]\n"<br> "\t[-d|--debug]\n"
<br> "\t[-h|--help]\n"<br> "\t[-t|--test]\n"<br>@@ -813,7 +814,7 @@<br> "\t[--version]" "\n"<br> "\tVolumeGroupName [VolumeGroupName...]\n",<br> <br>- test_ARG)
<br>+ force_ARG,test_ARG)<br> <br> xx(vgrename,<br> "Rename a volume group",<br>@@ -827,7 +828,7 @@<br> "\tOldVolumeGroupPath NewVolumeGroupPath |\n"<br> "\tOldVolumeGroupName NewVolumeGroupName\n",
<br> <br>- autobackup_ARG, force_ARG, test_ARG)<br>+ autobackup_ARG, test_ARG)<br> <br> xx(vgs,<br> "Display information about volume groups",<br>Index: lvm.c<br><br>Index: vgremove.c<br>===================================================================
<br>RCS file: /cvs/lvm2/LVM2/tools/vgremove.c,v<br>retrieving revision 1.41<br>diff -u -r1.41 vgremove.c<br>--- vgremove.c 19 Jun 2007 04:36:12 -0000 1.41<br>+++ vgremove.c 9 Aug 2007 02:28:04 -0000<br>@@ -34,9 +34,13 @@
<br> if (!vg_check_status(vg, EXPORTED_VG))<br> return ECMD_FAILED;<br> <br>+ /* <br>+ * If there is 1 or more lv print a error<br>+ * */<br> if (vg->lv_count) {<br> log_error("Volume group \"%s\" still contains %d "
<br> "logical volume(s)", vg_name, vg->lv_count);<br>+<br> return ECMD_FAILED;<br> }<br> <br>@@ -84,21 +88,39 @@<br> int vgremove(struct cmd_context *cmd, int argc, char **argv)
<br> {<br> int ret;<br>-<br>+ <br>+<br> if (!argc) {<br> log_error("Please enter one or more volume group paths");<br> return EINVALID_CMD_LINE;<br> }<br>-<br>
+ //printf("argv= %s \n", argv[0]);<br>+ <br>+ //printf("hostname = %s \n" , cmd->cmd_line);<br>+<br>+<br>+<br>+<br> if (!lock_vol(cmd, ORPHAN, LCK_VG_WRITE)) {<br> log_error("Can't get lock for orphan PVs");
<br> return ECMD_FAILED;<br> }<br>-<br>+/* check -f argument */<br>+ if( arg_count(cmd,force_ARG ) ) {<br>+ ret=lvremove(cmd, argc, argv);<br>+ if( ret==1 ){<br>+ ret = process_each_vg(cmd, argc, argv,
<br>+ <br>+ LCK_VG_WRITE | LCK_NONBLOCK,1,<br>+ NULL, & vgremove_single);
<br>+ }<br>+<br>+ }<br>+ else{<br> ret = process_each_vg(cmd, argc, argv,<br> LCK_VG_WRITE | LCK_NONBLOCK, 1, <br> NULL, &vgremove_single);
<br>-<br>+ }<br> unlock_vg(cmd, ORPHAN);<br> <br> return ret;<br><br>-- <br>No vivas solo por que respiras, vive para cumplir tus sue~os