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

	  disks = libzfs_common.get_free_disks()

	  logging.info("create a zpool with cachefile property..")
	  status = libzpool.create(TESTPOOL, disks[0], cachefile = "none")
          if status != SUCCESS:
	     raise error.TestFail("zpool create failed..")

          status = pool_in_cache(TESTPOOL, CPATH)
	  if status == SUCCESS:
	     raise error.TestFail("pool was in cache..")

	  libzpool.export_pool(TESTPOOL)
          libzpool.import_pool(TESTPOOL)

          status = pool_in_cache(TESTPOOL, CPATH)
          if status != SUCCESS:
             raise error.TestFail("pool was not in cache..")

          libzpool.export_pool(TESTPOOL)
	  libzpool.import_pool(TESTPOOL, cachefile="none")

	  status = pool_in_cache(TESTPOOL, CPATH)
	  if status == SUCCESS:
	     raise error.TestFail("pool was not in cache..")

          libzpool.export_pool(TESTPOOL)
          libzpool.import_pool(TESTPOOL, cachefile = CPATH1)

	  status = pool_in_cache(TESTPOOL, CPATH1)
	  if status != SUCCESS:
	     raise error.TestFail("pool was not in cache..")

	  logging.info("cachefile_002_pos test passed successfully..")
Пример #2
0
      def run_once(self):
          logging.info("In run_once function.. ")

	  logging.info("Verify set, export and destroy when cachefile is set on pool.")
          disks = libzfs_common.get_free_disks()

          logging.info("create a zpool with cachefile property..")
          status = libzpool.create(TESTPOOL, disks[0], cachefile = CPATH1)
          if status != SUCCESS:
	     raise error.TestFail("zpool create failed..")

	  status = pool_in_cache(TESTPOOL, CPATH1)
	  if status != SUCCESS:
	     raise error.TestFail("pool was not in cache..")

	  status = libzpool.create(TESTPOOL1, disks[3], cachefile = CPATH1)
	  if status != SUCCESS:
	     raise error.TestFail("zpool create failed..")

          status = pool_in_cache(TESTPOOL1, CPATH1)
	  if status != SUCCESS:
	     raise error.TestFail("pool was not in cache..")

	  status = libzpool.set_property(TESTPOOL, "cachefile", CPATH2)
	  if status != SUCCESS:
	     raise error.TestFail("zpool set property failed..")

          status = pool_in_cache(TESTPOOL, CPATH2)
	  if status != SUCCESS:
	     raise error.TestFail("pool was not in cache..")

	  status = libzpool.set_property(TESTPOOL1, "cachefile", CPATH2)
          if status != SUCCESS:
	     raise error.TestFail("zpool set property failed..")

          status = pool_in_cache(TESTPOOL1, CPATH2)
	  if status != SUCCESS:
	     raise error.TestFail("pool was not in cache..")

	  if os.path.isfile(CPATH1) :
	     raise error.TestFail(CPATH1 + " file still exist..")

	  libzpool.export_pool(TESTPOOL)
	  libzpool.export_pool(TESTPOOL1)

          if os.path.isfile(CPATH2) :
	     raise error.TestFail(CPATH2 + " file still exist..")

	  libzpool.import_pool(TESTPOOL)

          status = libzpool.set_property(TESTPOOL, "cachefile", CPATH2)
	  if status != SUCCESS:
	     raise error.TestFail("zpool set property failed..")

          status = pool_in_cache(TESTPOOL, CPATH2)
	  if status != SUCCESS:
             raise error.TestFail("pool was not in cache..")

          libzpool.import_pool(TESTPOOL1)

          status = libzpool.set_property(TESTPOOL1, "cachefile", CPATH2)
	  if status != SUCCESS:
	     raise error.TestFail("zpool set property failed..")

	  status = pool_in_cache(TESTPOOL1, CPATH2)
          if status != SUCCESS:
             raise error.TestFail("pool was not in cache..")

          libzpool.destroy(TESTPOOL)
          libzpool.destroy(TESTPOOL1)

	  if os.path.isfile(CPATH2):
	     raise error.TestFail(CPATH2 + " file still exist..")

	  logging.info("cachefile_003_pos test passed successfully..")