def make_lv(lv_name, vg_name): return lvm.makeLV( "uuid", lv_name, vg_name, "-wi-------", "128", "0", "/dev/mapper/a", "IU_image-uid,PU_00000000,MD_1", )
def fakeGetLV(vgName): """ This function returns lvs output in lvm.getLV() format. Input file name: lvs_<sdName>.out Input file should be the output of: lvs --noheadings --units b --nosuffix --separator '|' \ -o uuid,name,vg_name,attr,size,seg_start_pe,devices,tags <sdName> """ # TODO: simplify by returning fake lvs instead of parsing real lvs output. lvs_output = os.path.join(TESTDIR, 'lvs_%s.out' % vgName) lvs = [] with open(lvs_output) as f: for line in f: fields = [field.strip() for field in line.split(lvm.SEPARATOR)] lvs.append(lvm.makeLV(*fields)) return lvs