]> sourceware.org Git - lvm2.git/blame - tools/vgdisplay.c
metadata: use lv_hash in segment-specific metadata parsing
[lvm2.git] / tools / vgdisplay.c
CommitLineData
7f3859bb 1/*
67cdbd7e 2 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
be684599 3 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
7f3859bb 4 *
6606c3ae 5 * This file is part of LVM2.
7f3859bb 6 *
6606c3ae
AK
7 * This copyrighted material is made available to anyone wishing to use,
8 * modify, copy, or redistribute it subject to the terms and conditions
be684599 9 * of the GNU Lesser General Public License v.2.1.
7f3859bb 10 *
be684599 11 * You should have received a copy of the GNU Lesser General Public License
6606c3ae 12 * along with this program; if not, write to the Free Software Foundation,
fcbef05a 13 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7f3859bb
AK
14 */
15
16#include "tools.h"
17
f1cc5b12
AK
18static int _vgdisplay_single(struct cmd_context *cmd, const char *vg_name,
19 struct volume_group *vg,
20 struct processing_handle *handle __attribute__((unused)))
5a52dca9 21{
7e671e5d 22 if (arg_is_set(cmd, activevolumegroups_ARG) && !lvs_in_vg_activated(vg))
6232cac8
PR
23 return ECMD_PROCESSED;
24
7e671e5d 25 if (arg_is_set(cmd, colon_ARG)) {
5a52dca9 26 vgdisplay_colons(vg);
cfb7bfc7 27 return ECMD_PROCESSED;
5a52dca9
AK
28 }
29
7e671e5d 30 if (arg_is_set(cmd, short_ARG)) {
5a52dca9 31 vgdisplay_short(vg);
cfb7bfc7 32 return ECMD_PROCESSED;
5a52dca9
AK
33 }
34
35 vgdisplay_full(vg); /* was vg_show */
36
7e671e5d 37 if (arg_is_set(cmd, verbose_ARG)) {
5a52dca9
AK
38 vgdisplay_extents(vg);
39
f3bb1c01 40 process_each_lv_in_vg(cmd, vg, NULL, NULL, 0, NULL,
9c6c55c3 41 NULL, (process_single_lv_fn_t)lvdisplay_full);
5a52dca9
AK
42
43 log_print("--- Physical volumes ---");
f1a000a4 44 process_each_pv_in_vg(cmd, vg, NULL,
08c9ff43 45 (process_single_pv_fn_t)pvdisplay_short);
5a52dca9
AK
46 }
47
24e65464
AK
48 check_current_backup(vg);
49
cfb7bfc7 50 return ECMD_PROCESSED;
5a52dca9 51}
7f3859bb 52
60274aba 53int vgdisplay(struct cmd_context *cmd, int argc, char **argv)
7f3859bb 54{
7e671e5d
AK
55 if (arg_is_set(cmd, columns_ARG)) {
56 if (arg_is_set(cmd, colon_ARG) ||
57 arg_is_set(cmd, activevolumegroups_ARG) ||
58 arg_is_set(cmd, short_ARG)) {
4c64ed4c
AK
59 log_error("Incompatible options selected");
60 return EINVALID_CMD_LINE;
61 }
62 return vgs(cmd, argc, argv);
0bf836aa
ZK
63 }
64
65 if (arg_is_set(cmd, aligned_ARG) ||
66 arg_is_set(cmd, binary_ARG) ||
67 arg_is_set(cmd, noheadings_ARG) ||
68 arg_is_set(cmd, options_ARG) ||
69 arg_is_set(cmd, separator_ARG) ||
70 arg_is_set(cmd, sort_ARG) ||
71 arg_is_set(cmd, unbuffered_ARG)) {
72 log_error("Incompatible options selected.");
4c64ed4c
AK
73 return EINVALID_CMD_LINE;
74 }
75
7e671e5d 76 if (arg_is_set(cmd, colon_ARG) && arg_is_set(cmd, short_ARG)) {
7f3859bb
AK
77 log_error("Option -c is not allowed with option -s");
78 return EINVALID_CMD_LINE;
79 }
80
7e671e5d 81 if (argc && arg_is_set(cmd, activevolumegroups_ARG)) {
7f3859bb
AK
82 log_error("Option -A is not allowed with volume group names");
83 return EINVALID_CMD_LINE;
84 }
85
67cdbd7e
AK
86/********* FIXME: Do without this - or else 2(+) passes!
87 Figure out longest volume group name
7f3859bb
AK
88 for (c = opt; opt < argc; opt++) {
89 len = strlen(argv[opt]);
90 if (len > max_len)
91 max_len = len;
92 }
93**********/
94
8cfc3854 95 return process_each_vg(cmd, argc, argv, NULL, NULL, 0, 0, NULL,
f1cc5b12 96 _vgdisplay_single);
7f3859bb 97
67cdbd7e 98/******** FIXME Need to count number processed
7e671e5d 99 Add this to process_each_vg if arg_is_set(cmd,activevolumegroups_ARG) ?
7f3859bb
AK
100
101 if (opt == argc) {
102 log_print("no ");
7e671e5d 103 if (arg_is_set(cmd,activevolumegroups_ARG))
7f3859bb
AK
104 printf("active ");
105 printf("volume groups found\n\n");
106 return LVM_E_NO_VG;
107 }
108************/
7f3859bb 109}
This page took 0.243614 seconds and 6 git commands to generate.