]>
sourceware.org Git - lvm2.git/blob - tools/vgremove.c
2 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3 * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
5 * This file is part of LVM2.
7 * This copyrighted material is made available to anyone wishing to use,
8 * modify, copy, or redistribute it subject to the terms and conditions
9 * of the GNU Lesser General Public License v.2.1.
11 * You should have received a copy of the GNU Lesser General Public License
12 * along with this program; if not, write to the Free Software Foundation,
13 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 static int vgremove_single(struct cmd_context
*cmd
, const char *vg_name
,
19 struct volume_group
*vg
,
20 void *handle
__attribute__((unused
)))
22 unsigned lv_count
, missing
;
25 if (!vg_check_status(vg
, EXPORTED_VG
)) {
30 lv_count
= vg_visible_lvs(vg
);
32 force
= (force_t
) arg_count(cmd
, force_ARG
);
34 if (force
== PROMPT
) {
35 if ((missing
= vg_missing_pv_count(vg
)))
36 log_warn("WARNING: %d physical volumes are currently missing "
37 "from the system.", missing
);
38 if (yes_no_prompt("Do you really want to remove volume "
39 "group \"%s\" containing %u "
40 "logical volumes? [y/n]: ",
41 vg_name
, lv_count
) == 'n') {
42 log_error("Volume group \"%s\" not removed", vg_name
);
46 if (!remove_lvs_in_vg(cmd
, vg
, force
)) {
52 if (!force
&& !vg_remove_check(vg
)) {
64 return ECMD_PROCESSED
;
67 int vgremove(struct cmd_context
*cmd
, int argc
, char **argv
)
72 log_error("Please enter one or more volume group paths");
73 return EINVALID_CMD_LINE
;
76 cmd
->handles_missing_pvs
= 1;
77 ret
= process_each_vg(cmd
, argc
, argv
,
79 NULL
, &vgremove_single
);
This page took 0.037389 seconds and 5 git commands to generate.