def thin_lv_create(vg_name, thinpool_name='lvthinpool', thinpool_size='1.5G', thinlv_name='lvthin', thinlv_size='1G'):
 tp_cmd = ('lvcreate --thinpool %s --size %s %s' % (thinpool_name, thinpool_size, vg_name))
 try:
  utils.run(tp_cmd)
 except error.CmdError as detail:
  logging.debug(detail)
  raise error.TestError('Create thin volume pool failed.')
 logging.debug('Created thin volume pool: %s', thinpool_name)
 lv_cmd = ('lvcreate --name %s --virtualsize %s --thin %s/%s' % (thinlv_name, thinlv_size, vg_name, thinpool_name))
 try:
  utils.run(lv_cmd)
 except error.CmdError as detail:
  logging.debug(detail)
  raise error.TestError('Create thin volume failed.')
 logging.debug('Created thin volume:%s', thinlv_name)
 return (thinpool_name, thinlv_name)

def thin_lv_create ( vg_name , thinpool_name = 'lvthinpool' , thinpool_size = '1.5G' , thinlv_name = 'lvthin' , thinlv_size = '1G' ) : tp_cmd = ( 'lvcreate --thinpool %s --size %s %s' % ( thinpool_name , thinpool_size , vg_name ) ) try : utils . run ( tp_cmd ) except error . CmdError as detail : logging . debug ( detail ) raise error . TestError ( 'Create thin volume pool failed.' ) logging . debug ( 'Created thin volume pool: %s' , thinpool_name ) lv_cmd = ( 'lvcreate --name %s --virtualsize %s --thin %s/%s' % ( thinlv_name , thinlv_size , vg_name , thinpool_name ) ) try : utils . run ( lv_cmd ) except error . CmdError as detail : logging . debug ( detail ) raise error . TestError ( 'Create thin volume failed.' ) logging . debug ( 'Created thin volume:%s' , thinlv_name ) return ( thinpool_name , thinlv_name )
create a thin volume from given volume group .