Пример #1
0
        def run_once(self):
            logging.info("In run_once function.. ")

            logging.info("Here we will create the pool..")
            disks = "/dev/sda1"
            libzpool.create(TESTPOOL, disks)

            logging.info("Create a file system with mount point, so it will mount automatically..")
            utils.system("mkdir -p " + TESTDIR)
            fs = TESTPOOL + "/" + TESTFS
            libzfs.create(fs)
            libzfs.set_mount_point(TESTDIR,fs)

            status = libzfs.is_mounted(fs)
            if status != SUCCESS :
               raise error.TestFail("File system " + TESTFS +" is not mounted..")

            logging.info("Unmount the file system..")
            libzfs.unmount(fs)

            logging.info("Make sure file system " + fs + " is unmounted..")
            status = libzfs.is_mounted(fs)
            if status == SUCCESS :
               raise error.TestFail("File system " + fs +" is mounted..")

            logging.info("File system " + fs +" is unmounted..")

            logging.info("Here we will mount the file system..")
            fs = TESTPOOL + "/" + TESTFS
            libzfs.mount(fs)

            logging.info("Make sure the file system is mounted..")
            status = libzfs.is_mounted(fs)
            if status != SUCCESS :
               raise error.TestFail("File system " + TESTFS +" is not mounted..")

            logging.info("Unmount the file system..")
            libzfs.unmount(fs)

            logging.info("Make sure the file system is unmounted..")
            status = libzfs.is_mounted(fs)
            if status == SUCCESS :
               raise error.TestFail("File system " + TESTFS +" is  mounted..")

            logging.info("Mount test passed successfully..")
            return SUCCESS
Пример #2
0
        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