2010-12-21 04:14:34 +03:00
/*
* Copyright ( C ) 2010 Red Hat , Inc . All rights reserved .
*
* This file is part of LVM2 .
*
* This copyrighted material is made available to anyone wishing to use ,
* modify , copy , or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License v .2 .1 .
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program ; if not , write to the Free Software Foundation ,
* Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
*/
2011-01-03 18:07:39 +03:00
# undef NDEBUG
2010-12-15 02:20:58 +03:00
2011-01-03 18:07:39 +03:00
# include "lvm2app.h"
# include "assert.h"
2010-12-15 02:20:58 +03:00
int main ( int argc , char * argv [ ] )
{
2010-12-20 15:29:39 +03:00
lvm_t handle ;
vg_t vg = NULL ;
lv_t lv ;
struct lvm_property_value v ;
2012-10-05 12:32:49 +04:00
struct lvm_property_value d ;
2010-12-20 15:29:39 +03:00
handle = lvm_init ( NULL ) ;
2010-12-15 02:20:58 +03:00
assert ( handle ) ;
2010-12-20 15:29:39 +03:00
vg = lvm_vg_open ( handle , argv [ 1 ] , " r " , 0 ) ;
2010-12-15 02:20:58 +03:00
assert ( vg ) ;
2010-12-20 15:29:39 +03:00
lv = lvm_lv_from_name ( vg , " snap " ) ;
2010-12-15 02:20:58 +03:00
assert ( lv ) ;
2010-12-20 15:29:39 +03:00
v = lvm_lv_get_property ( lv , " snap_percent " ) ;
2010-12-15 02:20:58 +03:00
assert ( v . is_valid ) ;
assert ( v . value . integer = = PERCENT_0 ) ;
2011-01-27 00:21:56 +03:00
lv = lvm_lv_from_name ( vg , " mirr " ) ;
2010-12-15 02:20:58 +03:00
assert ( lv ) ;
v = lvm_lv_get_property ( lv , " copy_percent " ) ;
assert ( v . is_valid ) ;
assert ( v . value . integer = = PERCENT_100 ) ;
lv = lvm_lv_from_name ( vg , " snap2 " ) ;
assert ( lv ) ;
v = lvm_lv_get_property ( lv , " snap_percent " ) ;
assert ( v . is_valid ) ;
assert ( v . value . integer = = 50 * PERCENT_1 ) ;
2012-10-05 12:32:49 +04:00
d = lvm_lv_get_property ( lv , " data_percent " ) ;
assert ( d . is_valid ) ;
assert ( d . value . integer = = v . value . integer ) ;
2010-12-15 02:20:58 +03:00
lvm_vg_close ( vg ) ;
2011-01-27 00:21:56 +03:00
lvm_quit ( handle ) ;
2010-12-15 02:20:58 +03:00
return 0 ;
}