All of lore.kernel.org
 help / color / mirror / Atom feed
From: jorge alberto garcia gonzalez <jorge.garcia.gonzalez@gmail.com>
To: lvm-devel@redhat.com
Subject: LVM2/lib/metadata lv_manip.c
Date: Thu, 9 Aug 2007 02:52:58 +0000	[thread overview]
Message-ID: <89a913ed0708081952x646b40d6x71a4bfc017abb80c@mail.gmail.com> (raw)
In-Reply-To: <20070808180037.18571.qmail@sourceware.org>

hello,  i write a little patch that add a force (or recursive ?) option to
vgremove
i think  the semantic is better if you call vgremove -f <vg>  than
call lvremove <vg> and then vgremove <vg>

Example:

root at cobalto:/usr/local/src/LVM2/tools# lvm lvs
  LV        VG     Attr   LSize   Origin Snap%  Move Log Copy%
  lvprueba1 prueba -wi-a- 128.00M
  lvprueba2 prueba -wi-a- 128.00M
  lvprueba3 prueba -wi-a- 128.00M
  lvprueba4 prueba -wi-a- 128.00M

root at cobalto:/usr/local/src/LVM2/tools# ./lvm vgremove -f prueba
  Logical volume "lvprueba1" successfully removed
  Logical volume "lvprueba2" successfully removed
  Logical volume "lvprueba3" successfully removed
  Logical volume "lvprueba4" successfully removed
  Volume group "prueba" successfully removed


root at cobalto:/usr/local/src/LVM2/tools# ./lvm lvs
root at cobalto:/usr/local/src/LVM2/tools#
root at cobalto:/usr/local/src/LVM2/tools# ./lvm vgdisplay prueba
  Volume group "prueba" not found


Sorry i dont know the procedure to submit a patch, this is my firt time ever
a send a patch to any gnu project.

Thanks!

Saludos
--------------------------------------
Index: commands.h
===================================================================
RCS file: /cvs/lvm2/LVM2/tools/commands.h,v
retrieving revision 1.98
diff -u -r1.98 commands.h
--- commands.h  1 Aug 2007 21:01:06 -0000       1.98
+++ commands.h  9 Aug 2007 02:28:01 -0000
@@ -806,6 +806,7 @@
 xx(vgremove,
    "Remove volume group(s)",
    "vgremove\n"
+   "\t[-f|--force]\n"
    "\t[-d|--debug]\n"
    "\t[-h|--help]\n"
    "\t[-t|--test]\n"
@@ -813,7 +814,7 @@
    "\t[--version]" "\n"
    "\tVolumeGroupName [VolumeGroupName...]\n",

-   test_ARG)
+   force_ARG,test_ARG)

 xx(vgrename,
    "Rename a volume group",
@@ -827,7 +828,7 @@
    "\tOldVolumeGroupPath NewVolumeGroupPath |\n"
    "\tOldVolumeGroupName NewVolumeGroupName\n",

-   autobackup_ARG, force_ARG, test_ARG)
+   autobackup_ARG, test_ARG)

 xx(vgs,
    "Display information about volume groups",
Index: lvm.c

Index: vgremove.c
===================================================================
RCS file: /cvs/lvm2/LVM2/tools/vgremove.c,v
retrieving revision 1.41
diff -u -r1.41 vgremove.c
--- vgremove.c  19 Jun 2007 04:36:12 -0000      1.41
+++ vgremove.c  9 Aug 2007 02:28:04 -0000
@@ -34,9 +34,13 @@
        if (!vg_check_status(vg, EXPORTED_VG))
                return ECMD_FAILED;

+       /*
+        * If there is 1 or more lv print a error
+        * */
        if (vg->lv_count) {
                log_error("Volume group \"%s\" still contains %d "
                          "logical volume(s)", vg_name, vg->lv_count);
+
                return ECMD_FAILED;
        }

@@ -84,21 +88,39 @@
 int vgremove(struct cmd_context *cmd, int argc, char **argv)
 {
        int ret;
-
+
+
        if (!argc) {
                log_error("Please enter one or more volume group paths");
                return EINVALID_CMD_LINE;
        }
-
+    //printf("argv= %s \n", argv[0]);
+
+       //printf("hostname = %s \n" , cmd->cmd_line);
+
+
+
+
        if (!lock_vol(cmd, ORPHAN, LCK_VG_WRITE)) {
                log_error("Can't get lock for orphan PVs");
                return ECMD_FAILED;
        }
-
+/* check  -f argument  */
+       if( arg_count(cmd,force_ARG ) ) {
+               ret=lvremove(cmd,  argc, argv);
+               if( ret==1 ){
+               ret = process_each_vg(cmd, argc, argv,
+
+                                                 LCK_VG_WRITE |
LCK_NONBLOCK,1,
+                                                 NULL, & vgremove_single);
+               }
+
+       }
+       else{
        ret = process_each_vg(cmd, argc, argv,
                              LCK_VG_WRITE | LCK_NONBLOCK, 1,
                              NULL, &vgremove_single);
-
+       }
        unlock_vg(cmd, ORPHAN);

        return ret;

-- 
No vivas solo por que respiras, vive para cumplir tus sue~os
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20070809/6722d230/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vgremove-force_option.diff
Type: text/x-patch
Size: 11367 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20070809/6722d230/attachment.bin>

  parent reply	other threads:[~2007-08-09  2:52 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-08 18:00 LVM2/lib/metadata lv_manip.c wysochanski
2007-08-09  2:46 ` jorge alberto garcia gonzalez
2007-08-09  2:52 ` jorge alberto garcia gonzalez [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-05-11 15:32 agk
2012-05-11 15:26 agk
2012-03-04 15:57 zkabelac
2012-03-01 10:09 zkabelac
2012-02-28 10:08 zkabelac
2012-02-12 21:37 agk
2012-02-01  2:11 agk
2012-01-26 21:39 zkabelac
2012-01-25 11:27 zkabelac
2012-01-25  9:15 zkabelac
2012-01-25  9:14 zkabelac
2012-01-25  9:02 zkabelac
2012-01-25  8:57 zkabelac
2012-01-24 14:54 agk
2012-01-24 14:15 mbroz
2012-01-19 15:39 zkabelac
2011-11-15 17:29 zkabelac
2011-11-15 17:23 zkabelac
2011-11-12 22:53 zkabelac
2011-11-12 22:52 zkabelac
2011-11-12 22:51 zkabelac
2011-11-10 12:42 zkabelac
2011-11-10 12:42 zkabelac
2011-11-10 12:39 zkabelac
2011-11-07 13:54 agk
2011-11-04 22:45 zkabelac
2011-11-03 15:46 zkabelac
2011-11-03 14:56 zkabelac
2011-10-30 22:02 zkabelac
2011-10-28 20:29 zkabelac
2011-10-28 20:18 zkabelac
2011-10-22 16:48 zkabelac
2011-10-22 16:46 zkabelac
2011-10-21  9:55 zkabelac
2011-10-20 10:35 zkabelac
2011-10-03 18:43 zkabelac
2011-09-16 18:39 jbrassow
2011-09-16 12:12 zkabelac
2011-09-16 11:59 zkabelac
2011-09-06 15:39 agk
2011-08-19 22:55 agk
2011-08-19 16:41 agk
2011-08-10 16:44 jbrassow
2011-08-05  9:21 prajnoha
2011-06-06 12:08 agk
2011-03-25 22:02 jbrassow
2011-03-25 22:10 ` Zdenek Kabelac
2010-04-08  0:56 agk
2010-04-08  0:52 agk
2010-04-02  1:35 agk
2010-04-01 13:58 agk
2010-04-01 12:29 agk
2010-03-31 20:26 agk
2010-02-17 23:36 snitzer
2010-01-20 21:53 snitzer
2010-01-14 10:17 zkabelac
2010-01-14 10:09 zkabelac
2010-01-14 10:08 zkabelac
2010-01-13  1:52 snitzer
2010-01-13  1:51 snitzer
2010-01-10 20:44 snitzer
2010-01-08 23:06 jbrassow
2009-06-06 16:37 mbroz
2009-06-01 14:23 mbroz
2009-01-06 17:24 mbroz
2008-01-16 20:00 agk
2007-11-04 16:28 agk
2007-08-07 18:55 wysochanski
2007-08-07 16:57 wysochanski
2007-08-06 20:35 wysochanski
2007-08-07 12:52 ` Alasdair G Kergon
2007-08-07 12:56   ` Alasdair G Kergon
2007-08-07 21:15   ` Jun'ichi Nomura

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=89a913ed0708081952x646b40d6x71a4bfc017abb80c@mail.gmail.com \
    --to=jorge.garcia.gonzalez@gmail.com \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.