Branch data Line data Source code
1 : : /*
2 : : * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3 : : * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
4 : : *
5 : : * This file is part of LVM2.
6 : : *
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.
10 : : *
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
14 : : */
15 : :
16 : : #include "tools.h"
17 : :
18 : 0 : static int vgscan_single(struct cmd_context *cmd, const char *vg_name,
19 : : struct volume_group *vg,
20 : : void *handle __attribute((unused)))
21 : : {
22 [ # # ]: 0 : log_print("Found %svolume group \"%s\" using metadata type %s",
23 : : vg_is_exported(vg) ? "exported " : "", vg_name,
24 : : vg->fid->fmt->name);
25 : :
26 : 0 : check_current_backup(vg);
27 : :
28 : 0 : return ECMD_PROCESSED;
29 : : }
30 : :
31 : 0 : int vgscan(struct cmd_context *cmd, int argc, char **argv)
32 : : {
33 : : int maxret, ret;
34 : :
35 [ # # ]: 0 : if (argc) {
36 : 0 : log_error("Too many parameters on command line");
37 : 0 : return EINVALID_CMD_LINE;
38 : : }
39 : :
40 [ # # ]: 0 : if (!lock_vol(cmd, VG_GLOBAL, LCK_VG_WRITE)) {
41 : 0 : log_error("Unable to obtain global lock.");
42 : 0 : return ECMD_FAILED;
43 : : }
44 : :
45 : 0 : persistent_filter_wipe(cmd->filter);
46 : 0 : lvmcache_destroy(cmd, 1);
47 : :
48 : 0 : log_print("Reading all physical volumes. This may take a while...");
49 : :
50 : 0 : maxret = process_each_vg(cmd, argc, argv, 0, NULL,
51 : : &vgscan_single);
52 : :
53 [ # # ]: 0 : if (arg_count(cmd, mknodes_ARG)) {
54 : 0 : ret = vgmknodes(cmd, argc, argv);
55 [ # # ]: 0 : if (ret > maxret)
56 : 0 : maxret = ret;
57 : : }
58 : :
59 : 0 : unlock_vg(cmd, VG_GLOBAL);
60 : 0 : return maxret;
61 : : }
|