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 vgscan_single(struct cmd_context *cmd, const char *vg_name,
19 struct volume_group *vg,
20 void *handle __attribute__((unused)))
22 log_print("Found %svolume group \"%s\" using metadata type %s",
23 vg_is_exported(vg) ? "exported " : "", vg_name,
26 check_current_backup(vg);
28 return ECMD_PROCESSED;
31 int vgscan(struct cmd_context *cmd, int argc, char **argv)
36 log_error("Too many parameters on command line");
37 return EINVALID_CMD_LINE;
40 if (!lock_vol(cmd, VG_GLOBAL, LCK_VG_WRITE)) {
41 log_error("Unable to obtain global lock.");
45 persistent_filter_wipe(cmd->filter);
46 lvmcache_destroy(cmd, 1);
48 log_print("Reading all physical volumes. This may take a while...");
50 maxret = process_each_vg(cmd, argc, argv, 0, NULL,
53 if (arg_count(cmd, mknodes_ARG)) {
54 ret = vgmknodes(cmd, argc, argv);
59 unlock_vg(cmd, VG_GLOBAL);