Esempio n. 1
0
def test():
    loaded = False
    created = False
    try:
	image_size = 10*1024*1024*1024
	image_file = os.path.abspath("test.img")
        disk_num = 1
        cmd.exec_cmd2('insmod ' + settings.CDISK_MOD_KO_P, throw = True)
        loaded = True
	cmd.exec_cmd2("rm -r -f " + image_file)
	cmd.exec_cmd2("qemu-img create -f qcow2 " + image_file + " " + str(image_size), throw = True)
	cmd.exec_cmd2(settings.CDISK_CTL_P + ' --create ' + str(disk_num) + " " + image_file, throw = True)
        created = True
	#cmd.exec_cmd2("dd if=/dev/zero of=" + CDISK_DEV + str(disk_num) + " bs=" + str(BS) + " count=" + str(image_size//BS), throw = True)
	cmd.exec_cmd2("fio " + os.path.join(currentdir, "write.ini"), throw = True)
        cmd.exec_cmd2("fio " + os.path.join(currentdir, "read.ini"), throw = True)
        cmd.exec_cmd2("fio " + os.path.join(currentdir, "rw.ini"), throw = True)
        cmd.exec_cmd2("fio " + os.path.join(currentdir, "write.ini"), throw = True)
        cmd.exec_cmd2('qemu-img check ' + image_file, throw = True)
    except Exception as e:
        log.exception(str(e))
    finally:
        try:
	    if created:
		cmd.exec_cmd2(settings.CDISK_CTL_P + ' --delete ' + str(disk_num))
            if loaded:
	    	cmd.exec_cmd2('rmmod ' + settings.CDISK_MOD, throw = True)
        except Exception as e:
            log.exception(str(e))
Esempio n. 2
0
def do_cmd(cmd, elog):
    exec_cmd2(cmd, throw = True, elog = elog)
Esempio n. 3
0
def do_cmd(cmd, elog):
    exec_cmd2(cmd, throw=True, elog=elog)
Esempio n. 4
0
def test():
    try:
        disk_num = DISK_NUM
        cmd.exec_cmd2('insmod ' + settings.CD_CLI_MOD_KO_P, throw = True)
        cmd.exec_cmd2(settings.CD_CLI_CTL_P + ' --create ' + str(disk_num), throw = True)
        cmd.exec_cmd2('dd if=/dev/zero of=' + CDISK_DEV + ' bs=' + str(BS) + ' count=' + str(settings.CD_SIZE//BS), throw = True)
        cmd.exec_cmd2('/sbin/mkfs -t ' + FS_TYPE + ' ' +  CDISK_DEV + str(disk_num))
        cmd.exec_cmd2('rm -r -f ' + CDISK_MNT_DIR)
        cmd.exec_cmd2('mkdir ' + CDISK_MNT_DIR, throw = True)
        cmd.exec_cmd2('mount -t ' + FS_TYPE + ' ' + CDISK_DEV + str(disk_num) + ' ' + CDISK_MNT_DIR)
        cmd.exec_cmd2('dd if=/dev/zero of=' + os.path.join(CDISK_MNT_DIR, 'random.txt') + ' bs=' + str(BS) + ' count=1000')
        cmd.exec_cmd2('du -ah ' + CDISK_MNT_DIR)
        cmd.exec_cmd2('umount ' + CDISK_MNT_DIR)
        cmd.exec_cmd2(settings.CD_CLI_CTL_P + ' --delete ' + str(disk_num), throw = True)
    except Exception as e:
        log.exception(str(e))
    finally:
        try:
            cmd.exec_cmd2('rmmod ' + settings.CD_CLI_MOD, throw = True)
        except Exception as e:
            log.exception(str(e))