Esempio n. 1
0
 def cleanup(self):
     logging.info("In cleanup function..")
     status = libzpool.pool_exists(TESTPOOL)
     if status == SUCCESS:
        libzpool.destroy(TESTPOOL)
     logging.info("Cleanup done successfully")
     return SUCCESS
Esempio n. 2
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..")
Esempio n. 3
0
      def cleanup(self):
          logging.info("In cleanup function.. ")

          status = libzpool.pool_exists(TESTPOOL)
          if status == SUCCESS:
             libzpool.destroy(TESTPOOL)

          for file in [CPATH, CPATH1]:
              if os.path.isfile(file):
		 utils.system("rm " + file)

          logging.info("Cleanup done successfully...")
          return SUCCESS
Esempio n. 4
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
Esempio n. 5
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..")
Esempio n. 6
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..")