def run_once(self): logging.info("In run_once function.. ") logging.info("Here we will create the pool..") disks = libzfs_common.get_free_disks() status = libzpool.create(TESTPOOL, disks[0]) if status != SUCCESS: raise error.TestFail("zpool create failed..") logging.info("Create a file system and set its mount point....") utils.system("mkdir -p " + TESTDIR) libzfs.create(TESTPOOL, fs1) libzfs.set_property(TESTPOOL, fs1, "mountpoint", TESTDIR) logging.info("Create nested file system..") libzfs.create(TESTPOOL, fs2) status = libzfs.destroy(TESTPOOL, fs1) if status == SUCCESS: raise error.TestFail("Parent file system destroyed..") logging.info("The nestedfs test passed successfully..") return SUCCESS
def cleanup(self): logging.info("In cleanup function.. ") fs = TESTPOOL + "/" + TESTFS status = libzfs.is_mounted(fs) if status == SUCCESS : libzfs.unmount(fs) libzfs.destroy(fs) status = os.path.exists(TESTDIR) if status == True: utils.system("rm -r " + TESTDIR) status = libzpool.pool_exists(TESTPOOL) if status == SUCCESS: libzpool.destroy(TESTPOOL) logging.info("Cleanup done successfully...") return SUCCESS