]>
sourceware.org Git - lvm2.git/blob - tools/pvremove.c
2 * Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
3 * Copyright (C) 2004-2013 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 int pvremove(struct cmd_context
*cmd
, int argc
, char **argv
)
20 struct processing_handle
*handle
;
21 struct pvcreate_params pp
;
25 log_error("Please enter a physical volume path");
26 return EINVALID_CMD_LINE
;
29 pvcreate_params_set_defaults(&pp
);
32 pp
.force
= arg_count(cmd
, force_ARG
);
33 pp
.yes
= arg_count(cmd
, yes_ARG
);
37 /* Needed to change the set of orphan PVs. */
38 if (!lock_global(cmd
, "ex")) {
39 /* Let pvremove -ff skip locks */
40 if (pp
.force
== DONT_PROMPT_OVERRIDE
)
41 log_warn("WARNING: skipping global lock for force.");
48 if (!lvmcache_label_scan(cmd
))
51 /* When forcibly clearing a PV we don't care about a VG lock. */
52 if (pp
.force
== DONT_PROMPT_OVERRIDE
)
53 cmd
->lockd_vg_disable
= 1;
55 if (!(handle
= init_processing_handle(cmd
, NULL
))) {
56 log_error("Failed to initialize processing handle.");
61 * pvremove uses the same toollib function as pvcreate,
62 * but sets "is_remove" which changes the check function,
63 * and the actual create vs remove step.
66 if (!pvcreate_each_device(cmd
, handle
, &pp
))
71 destroy_processing_handle(cmd
, handle
);
This page took 0.042057 seconds and 6 git commands to generate.