]> sourceware.org Git - lvm2.git/blame - tools/lvscan.c
integrity: add --integritysettings for tuning
[lvm2.git] / tools / lvscan.c
CommitLineData
34e1c94b 1/*
67cdbd7e 2 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
be684599 3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
34e1c94b 4 *
6606c3ae 5 * This file is part of LVM2.
34e1c94b 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.
34e1c94b 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
34e1c94b
AK
14 */
15
16#include "tools.h"
17
f1cc5b12
AK
18static int _lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,
19 struct processing_handle *handle __attribute__((unused)))
34e1c94b 20{
199e490e 21 struct lvinfo info;
e6493477 22 int inkernel, snap_active = 1;
cfed0d09 23 dm_percent_t snap_percent; /* fused, fsize; */
34e1c94b 24
34e1c94b
AK
25 const char *active_str, *snapshot_str;
26
7e671e5d 27 if (!arg_is_set(cmd, all_ARG) && !lv_is_visible(lv))
191abde9
AK
28 return ECMD_PROCESSED;
29
401a40d9 30 inkernel = lv_info(cmd, lv, 0, &info, 0, 0) && info.exists;
d1aba7cc 31 if (lv_is_cow(lv)) {
e6493477 32 if (inkernel &&
8191fe4f 33 (snap_active = lv_snapshot_percent(lv, &snap_percent)))
cfed0d09 34 if (snap_percent == DM_PERCENT_INVALID)
e6493477
AK
35 snap_active = 0;
36 }
37
8ef2b021 38/* FIXME Add -D arg to skip this! */
e6493477 39 if (inkernel && snap_active)
9b7742bb 40 active_str = "ACTIVE ";
41967a02 41 else
9b7742bb 42 active_str = "inactive ";
34e1c94b 43
b6afcf64 44 if (lv_is_origin(lv))
9b7742bb 45 snapshot_str = "Original";
b6afcf64 46 else if (lv_is_cow(lv))
9b7742bb
AK
47 snapshot_str = "Snapshot";
48 else
49 snapshot_str = " ";
34e1c94b 50
438e0050
AK
51 log_print_unless_silent("%s%s '%s%s/%s' [%s] %s", active_str, snapshot_str,
52 cmd->dev_dir, lv->vg->name, lv->name,
53 display_size(cmd, lv->size),
54 get_alloc_string(lv->alloc));
34e1c94b 55
cfb7bfc7 56 return ECMD_PROCESSED;
34e1c94b 57}
5a52dca9
AK
58
59int lvscan(struct cmd_context *cmd, int argc, char **argv)
60{
117160b2 61 if (arg_is_set(cmd, cache_long_ARG)) {
81ef1fd0 62 log_warn("WARNING: Ignoring lvscan --cache because lvmetad is no longer used.");
117160b2 63 return ECMD_PROCESSED;
56c68b34
DT
64 }
65
f1cc5b12 66 return process_each_lv(cmd, argc, argv, NULL, NULL, 0, NULL, NULL, &_lvscan_single);
5a52dca9 67}
This page took 0.213161 seconds and 6 git commands to generate.