2 * Copyright (C) 2010 Red Hat, Inc. All rights reserved.
4 * This file is part of LVM2.
6 * This copyrighted material is made available to anyone wishing to use,
7 * modify, copy, or redistribute it subject to the terms and conditions
8 * of the GNU Lesser General Public License v.2.1.
10 * You should have received a copy of the GNU Lesser General Public License
11 * along with this program; if not, write to the Free Software Foundation,
12 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 #define assert(x) do { if (!(x)) goto bad; } while (0)
19 int main(int argc, char *argv[])
24 struct lvm_property_value v;
26 handle = lvm_init(NULL);
29 vg = lvm_vg_open(handle, argv[1], "r", 0);
32 lv = lvm_lv_from_name(vg, "snap");
35 v = lvm_lv_get_property(lv, "snap_percent");
37 assert(v.value.integer == PERCENT_0);
39 lv = lvm_lv_from_name(vg, "mirr");
42 v = lvm_lv_get_property(lv, "copy_percent");
44 assert(v.value.integer == PERCENT_100);
46 lv = lvm_lv_from_name(vg, "snap2");
49 v = lvm_lv_get_property(lv, "snap_percent");
51 assert(v.value.integer == 50 * PERCENT_1);
57 if (handle && lvm_errno(handle))
58 fprintf(stderr, "LVM Error: %s\n", lvm_errmsg(handle));