4 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
5 * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
7 * This file is part of LVM2.
9 * This copyrighted material is made available to anyone wishing to use,
10 * modify, copy, or redistribute it subject to the terms and conditions
11 * of the GNU Lesser General Public License v.2.1.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program; if not, write to the Free Software Foundation,
15 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 static int vgremove_single(struct cmd_context
*cmd
, const char *vg_name
,
21 struct volume_group
*vg
,
22 void *handle
__attribute((unused
)))
27 if (!vg_check_status(vg
, EXPORTED_VG
)) {
32 lv_count
= vg_visible_lvs(vg
);
34 force
= arg_count(cmd
, force_ARG
);
36 if ((force
== PROMPT
) &&
37 (yes_no_prompt("Do you really want to remove volume "
38 "group \"%s\" containing %u "
39 "logical volumes? [y/n]: ",
40 vg_name
, lv_count
) == 'n')) {
41 log_print("Volume group \"%s\" not removed", vg_name
);
44 if (!remove_lvs_in_vg(cmd
, vg
, force
)) {
50 if (!vg_remove_check(vg
)) {
60 return ECMD_PROCESSED
;
63 int vgremove(struct cmd_context
*cmd
, int argc
, char **argv
)
68 log_error("Please enter one or more volume group paths");
69 return EINVALID_CMD_LINE
;
72 ret
= process_each_vg(cmd
, argc
, argv
,
74 NULL
, &vgremove_single
);