~ubuntu-branches/debian/sid/lvm2/sid

« back to all changes in this revision

Viewing changes to test/api/thin_percent.c

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2013-03-03 12:33:47 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20130303123347-smfwei6dodkdth55
Tags: 2.02.98-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2012 Red Hat, Inc. All rights reserved.
 
3
 *
 
4
 * This file is part of LVM2.
 
5
 *
 
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.
 
9
 *
 
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
 
13
 */
 
14
 
 
15
#undef NDEBUG
 
16
 
 
17
#include "lvm2app.h"
 
18
#include "assert.h"
 
19
 
 
20
int main(int argc, char *argv[])
 
21
{
 
22
        lvm_t handle;
 
23
        vg_t vg;
 
24
        lv_t lv;
 
25
        struct lvm_property_value v;
 
26
 
 
27
        handle = lvm_init(NULL);
 
28
        assert(handle);
 
29
 
 
30
        vg = lvm_vg_open(handle, argv[1], "r", 0);
 
31
        assert(vg);
 
32
 
 
33
        lv = lvm_lv_from_name(vg, "pool");
 
34
        assert(lv);
 
35
 
 
36
        v = lvm_lv_get_property(lv, "data_percent");
 
37
        assert(v.is_valid);
 
38
        assert(v.value.integer == 25 * PERCENT_1);
 
39
 
 
40
 
 
41
        lv = lvm_lv_from_name(vg, "thin");
 
42
        assert(lv);
 
43
 
 
44
        v = lvm_lv_get_property(lv, "data_percent");
 
45
        assert(v.is_valid);
 
46
        assert(v.value.integer == 50 * PERCENT_1);
 
47
 
 
48
 
 
49
        lv = lvm_lv_from_name(vg, "snap");
 
50
        assert(lv);
 
51
 
 
52
        v = lvm_lv_get_property(lv, "data_percent");
 
53
        assert(v.is_valid);
 
54
        assert(v.value.integer == 75 * PERCENT_1);
 
55
 
 
56
        v = lvm_lv_get_property(lv, "snap_percent");
 
57
        assert(v.is_valid);
 
58
        assert(v.value.integer == PERCENT_INVALID);
 
59
 
 
60
        v = lvm_lv_get_property(lv, "origin");
 
61
        assert(v.is_valid);
 
62
        assert(strcmp(v.value.string, "thin") == 0);
 
63
 
 
64
        lvm_vg_close(vg);
 
65
        lvm_quit(handle);
 
66
 
 
67
        return 0;
 
68
}