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

	  disks = libzfs_common.get_free_disks()

          opts = ["none", "none", CPATH, "-", CPATH1, CPATH1]
	  for i in range(0, 5, 2):
              logging.info("create a zpool with cachefile and altroot property..")
	      status = libzpool.create(TESTPOOL, disks[0], cachefile = opts[i],
			               altroot = TESTDIR)
              if status != SUCCESS:
                 raise error.TestFail("zpool create failed..")

	      if opts[i] == "none":
                 status = pool_in_cache(TESTPOOL, CPATH)
                 if status == SUCCESS:
	            raise error.TestFail("pool was in cache..")
              else:
	          status = pool_in_cache(TESTPOOL, opts[i])
                  if status != SUCCESS:
		     raise error.TestFail("pool was not in cache..")

              prop_val = libzpool.get_property(TESTPOOL, "cachefile")
              if prop_val != opts[i + 1]:
	         raise error.TestFail("cachefile property not set as expected..")

              libzpool.destroy(TESTPOOL)

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

	  disks = libzfs_common.get_free_disks()

          opts = ["none", "false", "none", CPATH, "true", "-", CPATH1, "true", CPATH1]
	  for i in range(0, 8, 3):
              logging.info("create a zpool with cachefile property..")

	      status = libzpool.create(TESTPOOL, disks[0], cachefile = opts[i])
              if status != SUCCESS:
                 raise error.TestFail("zpool create failed..")

	      # checking for the pool name in the strings output of
	      # the given cachefile, default is /etc/zfs/zpool.cache
	      if opts[i + 1] == "false":
	         tmp = "strings " + CPATH + " | grep -w " + TESTPOOL
	      else:
	         tmp = "strings " + opts[i] + " | grep -w " + TESTPOOL
	      try:
		 status = SUCCESS
                 utils.system_output(tmp)
              except:
	         status = FAIL

              if status == SUCCESS:
	         if opts[i + 1] != "true":
		    raise error.TestFail("pool was not in cache..")
              else:
		 if opts[i + 1] != "false":
		    raise error.TestFail("pool was in cache..")

              prop_val = libzpool.get_property(TESTPOOL, "cachefile")
              if prop_val != opts[i + 2]:
	         raise error.TestFail("cachefile property not set as expected..")

              libzpool.destroy(TESTPOOL)

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